diff --git a/packages/google-cloud-redis/google/cloud/redis/gapic_version.py b/packages/google-cloud-redis/google/cloud/redis/gapic_version.py index 209de14827c9..360a0d13ebdd 100644 --- a/packages/google-cloud-redis/google/cloud/redis/gapic_version.py +++ b/packages/google-cloud-redis/google/cloud/redis/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.15.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-redis/google/cloud/redis_v1/gapic_version.py b/packages/google-cloud-redis/google/cloud/redis_v1/gapic_version.py index 209de14827c9..360a0d13ebdd 100644 --- a/packages/google-cloud-redis/google/cloud/redis_v1/gapic_version.py +++ b/packages/google-cloud-redis/google/cloud/redis_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.15.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-redis/google/cloud/redis_v1/services/cloud_redis/client.py b/packages/google-cloud-redis/google/cloud/redis_v1/services/cloud_redis/client.py index 5b01720ebd32..ad754d243ad1 100644 --- a/packages/google-cloud-redis/google/cloud/redis_v1/services/cloud_redis/client.py +++ b/packages/google-cloud-redis/google/cloud/redis_v1/services/cloud_redis/client.py @@ -409,6 +409,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -427,6 +428,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -501,17 +503,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CloudRedisClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CloudRedisClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-redis/google/cloud/redis_v1beta1/gapic_version.py b/packages/google-cloud-redis/google/cloud/redis_v1beta1/gapic_version.py index 209de14827c9..360a0d13ebdd 100644 --- a/packages/google-cloud-redis/google/cloud/redis_v1beta1/gapic_version.py +++ b/packages/google-cloud-redis/google/cloud/redis_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.15.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-redis/google/cloud/redis_v1beta1/services/cloud_redis/client.py b/packages/google-cloud-redis/google/cloud/redis_v1beta1/services/cloud_redis/client.py index 5f2118548e27..5f37c44db8f1 100644 --- a/packages/google-cloud-redis/google/cloud/redis_v1beta1/services/cloud_redis/client.py +++ b/packages/google-cloud-redis/google/cloud/redis_v1beta1/services/cloud_redis/client.py @@ -408,6 +408,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -426,6 +427,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -500,17 +502,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CloudRedisClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CloudRedisClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-redis/samples/generated_samples/snippet_metadata_google.cloud.redis.v1.json b/packages/google-cloud-redis/samples/generated_samples/snippet_metadata_google.cloud.redis.v1.json index 3cf35adf2bc9..174d9dff49b1 100644 --- a/packages/google-cloud-redis/samples/generated_samples/snippet_metadata_google.cloud.redis.v1.json +++ b/packages/google-cloud-redis/samples/generated_samples/snippet_metadata_google.cloud.redis.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-redis", - "version": "2.15.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-redis/samples/generated_samples/snippet_metadata_google.cloud.redis.v1beta1.json b/packages/google-cloud-redis/samples/generated_samples/snippet_metadata_google.cloud.redis.v1beta1.json index a8a7645c0052..443ce93aea7f 100644 --- a/packages/google-cloud-redis/samples/generated_samples/snippet_metadata_google.cloud.redis.v1beta1.json +++ b/packages/google-cloud-redis/samples/generated_samples/snippet_metadata_google.cloud.redis.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-redis", - "version": "2.15.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-redis/setup.py b/packages/google-cloud-redis/setup.py index 7a2803708d21..49b26986f9ae 100644 --- a/packages/google-cloud-redis/setup.py +++ b/packages/google-cloud-redis/setup.py @@ -40,6 +40,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-redis/testing/constraints-3.7.txt b/packages/google-cloud-redis/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-redis/testing/constraints-3.7.txt +++ b/packages/google-cloud-redis/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-redis/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/google-cloud-redis/tests/unit/gapic/redis_v1/test_cloud_redis.py index 41308282a0bf..a4a5d6a4f93b 100644 --- a/packages/google-cloud-redis/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/google-cloud-redis/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -94,18 +94,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -309,7 +297,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -336,42 +324,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -382,7 +377,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_cloud_redis_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -434,7 +429,7 @@ def test_cloud_redis_client_service_account_always_use_jwt( ], ) def test_cloud_redis_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -497,9 +492,7 @@ def test_cloud_redis_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CloudRedisClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -892,20 +885,20 @@ def test_cloud_redis_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -917,13 +910,11 @@ def test_cloud_redis_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -939,8 +930,7 @@ def test_cloud_redis_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1081,8 +1071,8 @@ def test_cloud_redis_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1111,7 +1101,7 @@ def test_cloud_redis_client_create_channel_credentials_file( ) def test_list_instances(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1143,7 +1133,7 @@ def test_list_instances_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1160,7 +1150,7 @@ async def test_list_instances_async( transport: str = "grpc_asyncio", request_type=cloud_redis.ListInstancesRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1197,7 +1187,7 @@ async def test_list_instances_async_from_dict(): def test_list_instances_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1227,7 +1217,7 @@ def test_list_instances_field_headers(): @pytest.mark.asyncio async def test_list_instances_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1258,7 +1248,7 @@ async def test_list_instances_field_headers_async(): def test_list_instances_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1282,7 +1272,7 @@ def test_list_instances_flattened(): def test_list_instances_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1297,7 +1287,7 @@ def test_list_instances_flattened_error(): @pytest.mark.asyncio async def test_list_instances_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1326,7 +1316,7 @@ async def test_list_instances_flattened_async(): @pytest.mark.asyncio async def test_list_instances_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1340,7 +1330,7 @@ async def test_list_instances_flattened_error_async(): def test_list_instances_pager(transport_name: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1390,7 +1380,7 @@ def test_list_instances_pager(transport_name: str = "grpc"): def test_list_instances_pages(transport_name: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1432,7 +1422,7 @@ def test_list_instances_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_instances_async_pager(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1482,7 +1472,7 @@ async def test_list_instances_async_pager(): @pytest.mark.asyncio async def test_list_instances_async_pages(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1537,7 +1527,7 @@ async def test_list_instances_async_pages(): ) def test_get_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1631,7 +1621,7 @@ def test_get_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1648,7 +1638,7 @@ async def test_get_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.GetInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1747,7 +1737,7 @@ async def test_get_instance_async_from_dict(): def test_get_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1777,7 +1767,7 @@ def test_get_instance_field_headers(): @pytest.mark.asyncio async def test_get_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1808,7 +1798,7 @@ async def test_get_instance_field_headers_async(): def test_get_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1832,7 +1822,7 @@ def test_get_instance_flattened(): def test_get_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1847,7 +1837,7 @@ def test_get_instance_flattened_error(): @pytest.mark.asyncio async def test_get_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1876,7 +1866,7 @@ async def test_get_instance_flattened_async(): @pytest.mark.asyncio async def test_get_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1897,7 +1887,7 @@ async def test_get_instance_flattened_error_async(): ) def test_get_instance_auth_string(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1929,7 +1919,7 @@ def test_get_instance_auth_string_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1949,7 +1939,7 @@ async def test_get_instance_auth_string_async( request_type=cloud_redis.GetInstanceAuthStringRequest, ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1986,7 +1976,7 @@ async def test_get_instance_auth_string_async_from_dict(): def test_get_instance_auth_string_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2018,7 +2008,7 @@ def test_get_instance_auth_string_field_headers(): @pytest.mark.asyncio async def test_get_instance_auth_string_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2051,7 +2041,7 @@ async def test_get_instance_auth_string_field_headers_async(): def test_get_instance_auth_string_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2077,7 +2067,7 @@ def test_get_instance_auth_string_flattened(): def test_get_instance_auth_string_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2092,7 +2082,7 @@ def test_get_instance_auth_string_flattened_error(): @pytest.mark.asyncio async def test_get_instance_auth_string_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2123,7 +2113,7 @@ async def test_get_instance_auth_string_flattened_async(): @pytest.mark.asyncio async def test_get_instance_auth_string_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2144,7 +2134,7 @@ async def test_get_instance_auth_string_flattened_error_async(): ) def test_create_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2171,7 +2161,7 @@ def test_create_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2188,7 +2178,7 @@ async def test_create_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.CreateInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2220,7 +2210,7 @@ async def test_create_instance_async_from_dict(): def test_create_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2250,7 +2240,7 @@ def test_create_instance_field_headers(): @pytest.mark.asyncio async def test_create_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2281,7 +2271,7 @@ async def test_create_instance_field_headers_async(): def test_create_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2313,7 +2303,7 @@ def test_create_instance_flattened(): def test_create_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2330,7 +2320,7 @@ def test_create_instance_flattened_error(): @pytest.mark.asyncio async def test_create_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2367,7 +2357,7 @@ async def test_create_instance_flattened_async(): @pytest.mark.asyncio async def test_create_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2390,7 +2380,7 @@ async def test_create_instance_flattened_error_async(): ) def test_update_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2417,7 +2407,7 @@ def test_update_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2434,7 +2424,7 @@ async def test_update_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.UpdateInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2466,7 +2456,7 @@ async def test_update_instance_async_from_dict(): def test_update_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2496,7 +2486,7 @@ def test_update_instance_field_headers(): @pytest.mark.asyncio async def test_update_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2527,7 +2517,7 @@ async def test_update_instance_field_headers_async(): def test_update_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2555,7 +2545,7 @@ def test_update_instance_flattened(): def test_update_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2571,7 +2561,7 @@ def test_update_instance_flattened_error(): @pytest.mark.asyncio async def test_update_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2604,7 +2594,7 @@ async def test_update_instance_flattened_async(): @pytest.mark.asyncio async def test_update_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2626,7 +2616,7 @@ async def test_update_instance_flattened_error_async(): ) def test_upgrade_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2653,7 +2643,7 @@ def test_upgrade_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2670,7 +2660,7 @@ async def test_upgrade_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.UpgradeInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2702,7 +2692,7 @@ async def test_upgrade_instance_async_from_dict(): def test_upgrade_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2732,7 +2722,7 @@ def test_upgrade_instance_field_headers(): @pytest.mark.asyncio async def test_upgrade_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2763,7 +2753,7 @@ async def test_upgrade_instance_field_headers_async(): def test_upgrade_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2791,7 +2781,7 @@ def test_upgrade_instance_flattened(): def test_upgrade_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2807,7 +2797,7 @@ def test_upgrade_instance_flattened_error(): @pytest.mark.asyncio async def test_upgrade_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2840,7 +2830,7 @@ async def test_upgrade_instance_flattened_async(): @pytest.mark.asyncio async def test_upgrade_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2862,7 +2852,7 @@ async def test_upgrade_instance_flattened_error_async(): ) def test_import_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2889,7 +2879,7 @@ def test_import_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2906,7 +2896,7 @@ async def test_import_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.ImportInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2938,7 +2928,7 @@ async def test_import_instance_async_from_dict(): def test_import_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2968,7 +2958,7 @@ def test_import_instance_field_headers(): @pytest.mark.asyncio async def test_import_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2999,7 +2989,7 @@ async def test_import_instance_field_headers_async(): def test_import_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3031,7 +3021,7 @@ def test_import_instance_flattened(): def test_import_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3049,7 +3039,7 @@ def test_import_instance_flattened_error(): @pytest.mark.asyncio async def test_import_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3086,7 +3076,7 @@ async def test_import_instance_flattened_async(): @pytest.mark.asyncio async def test_import_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3110,7 +3100,7 @@ async def test_import_instance_flattened_error_async(): ) def test_export_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3137,7 +3127,7 @@ def test_export_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3154,7 +3144,7 @@ async def test_export_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.ExportInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3186,7 +3176,7 @@ async def test_export_instance_async_from_dict(): def test_export_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3216,7 +3206,7 @@ def test_export_instance_field_headers(): @pytest.mark.asyncio async def test_export_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3247,7 +3237,7 @@ async def test_export_instance_field_headers_async(): def test_export_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3279,7 +3269,7 @@ def test_export_instance_flattened(): def test_export_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3297,7 +3287,7 @@ def test_export_instance_flattened_error(): @pytest.mark.asyncio async def test_export_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3334,7 +3324,7 @@ async def test_export_instance_flattened_async(): @pytest.mark.asyncio async def test_export_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3358,7 +3348,7 @@ async def test_export_instance_flattened_error_async(): ) def test_failover_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3387,7 +3377,7 @@ def test_failover_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3406,7 +3396,7 @@ async def test_failover_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.FailoverInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3440,7 +3430,7 @@ async def test_failover_instance_async_from_dict(): def test_failover_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3472,7 +3462,7 @@ def test_failover_instance_field_headers(): @pytest.mark.asyncio async def test_failover_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3505,7 +3495,7 @@ async def test_failover_instance_field_headers_async(): def test_failover_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3537,7 +3527,7 @@ def test_failover_instance_flattened(): def test_failover_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3553,7 +3543,7 @@ def test_failover_instance_flattened_error(): @pytest.mark.asyncio async def test_failover_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3590,7 +3580,7 @@ async def test_failover_instance_flattened_async(): @pytest.mark.asyncio async def test_failover_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3612,7 +3602,7 @@ async def test_failover_instance_flattened_error_async(): ) def test_delete_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3639,7 +3629,7 @@ def test_delete_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3656,7 +3646,7 @@ async def test_delete_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.DeleteInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3688,7 +3678,7 @@ async def test_delete_instance_async_from_dict(): def test_delete_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3718,7 +3708,7 @@ def test_delete_instance_field_headers(): @pytest.mark.asyncio async def test_delete_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3749,7 +3739,7 @@ async def test_delete_instance_field_headers_async(): def test_delete_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3773,7 +3763,7 @@ def test_delete_instance_flattened(): def test_delete_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3788,7 +3778,7 @@ def test_delete_instance_flattened_error(): @pytest.mark.asyncio async def test_delete_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3817,7 +3807,7 @@ async def test_delete_instance_flattened_async(): @pytest.mark.asyncio async def test_delete_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3838,7 +3828,7 @@ async def test_delete_instance_flattened_error_async(): ) def test_reschedule_maintenance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3867,7 +3857,7 @@ def test_reschedule_maintenance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3887,7 +3877,7 @@ async def test_reschedule_maintenance_async( request_type=cloud_redis.RescheduleMaintenanceRequest, ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3921,7 +3911,7 @@ async def test_reschedule_maintenance_async_from_dict(): def test_reschedule_maintenance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3953,7 +3943,7 @@ def test_reschedule_maintenance_field_headers(): @pytest.mark.asyncio async def test_reschedule_maintenance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3986,7 +3976,7 @@ async def test_reschedule_maintenance_field_headers_async(): def test_reschedule_maintenance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4020,7 +4010,7 @@ def test_reschedule_maintenance_flattened(): def test_reschedule_maintenance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4037,7 +4027,7 @@ def test_reschedule_maintenance_flattened_error(): @pytest.mark.asyncio async def test_reschedule_maintenance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4076,7 +4066,7 @@ async def test_reschedule_maintenance_flattened_async(): @pytest.mark.asyncio async def test_reschedule_maintenance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4099,7 +4089,7 @@ async def test_reschedule_maintenance_flattened_error_async(): ) def test_list_instances_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4152,7 +4142,7 @@ def test_list_instances_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_instances._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4161,7 +4151,7 @@ def test_list_instances_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_instances._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4177,7 +4167,7 @@ def test_list_instances_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4219,7 +4209,7 @@ def test_list_instances_rest_required_fields( def test_list_instances_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_instances._get_unset_required_fields({}) @@ -4237,7 +4227,7 @@ def test_list_instances_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_instances_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -4295,7 +4285,7 @@ def test_list_instances_rest_bad_request( transport: str = "rest", request_type=cloud_redis.ListInstancesRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4317,7 +4307,7 @@ def test_list_instances_rest_bad_request( def test_list_instances_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4358,7 +4348,7 @@ def test_list_instances_rest_flattened(): def test_list_instances_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4373,7 +4363,7 @@ def test_list_instances_rest_flattened_error(transport: str = "rest"): def test_list_instances_rest_pager(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4441,7 +4431,7 @@ def test_list_instances_rest_pager(transport: str = "rest"): ) def test_get_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4554,7 +4544,7 @@ def test_get_instance_rest_required_fields(request_type=cloud_redis.GetInstanceR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4563,7 +4553,7 @@ def test_get_instance_rest_required_fields(request_type=cloud_redis.GetInstanceR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4572,7 +4562,7 @@ def test_get_instance_rest_required_fields(request_type=cloud_redis.GetInstanceR assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4614,7 +4604,7 @@ def test_get_instance_rest_required_fields(request_type=cloud_redis.GetInstanceR def test_get_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_instance._get_unset_required_fields({}) @@ -4624,7 +4614,7 @@ def test_get_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -4678,7 +4668,7 @@ def test_get_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.GetInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4700,7 +4690,7 @@ def test_get_instance_rest_bad_request( def test_get_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4743,7 +4733,7 @@ def test_get_instance_rest_flattened(): def test_get_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4758,7 +4748,7 @@ def test_get_instance_rest_flattened_error(transport: str = "rest"): def test_get_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4771,7 +4761,7 @@ def test_get_instance_rest_error(): ) def test_get_instance_auth_string_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4822,7 +4812,7 @@ def test_get_instance_auth_string_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance_auth_string._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4831,7 +4821,7 @@ def test_get_instance_auth_string_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance_auth_string._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4840,7 +4830,7 @@ def test_get_instance_auth_string_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4882,7 +4872,7 @@ def test_get_instance_auth_string_rest_required_fields( def test_get_instance_auth_string_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_instance_auth_string._get_unset_required_fields({}) @@ -4892,7 +4882,7 @@ def test_get_instance_auth_string_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_instance_auth_string_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -4950,7 +4940,7 @@ def test_get_instance_auth_string_rest_bad_request( transport: str = "rest", request_type=cloud_redis.GetInstanceAuthStringRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4972,7 +4962,7 @@ def test_get_instance_auth_string_rest_bad_request( def test_get_instance_auth_string_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5016,7 +5006,7 @@ def test_get_instance_auth_string_rest_flattened(): def test_get_instance_auth_string_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5031,7 +5021,7 @@ def test_get_instance_auth_string_rest_flattened_error(transport: str = "rest"): def test_get_instance_auth_string_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5044,7 +5034,7 @@ def test_get_instance_auth_string_rest_error(): ) def test_create_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5233,7 +5223,7 @@ def test_create_instance_rest_required_fields( assert "instanceId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5245,7 +5235,7 @@ def test_create_instance_rest_required_fields( jsonified_request["instanceId"] = "instance_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_instance._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("instance_id",)) @@ -5258,7 +5248,7 @@ def test_create_instance_rest_required_fields( assert jsonified_request["instanceId"] == "instance_id_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5304,7 +5294,7 @@ def test_create_instance_rest_required_fields( def test_create_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_instance._get_unset_required_fields({}) @@ -5323,7 +5313,7 @@ def test_create_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -5383,7 +5373,7 @@ def test_create_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.CreateInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5405,7 +5395,7 @@ def test_create_instance_rest_bad_request( def test_create_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5446,7 +5436,7 @@ def test_create_instance_rest_flattened(): def test_create_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5463,7 +5453,7 @@ def test_create_instance_rest_flattened_error(transport: str = "rest"): def test_create_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5476,7 +5466,7 @@ def test_create_instance_rest_error(): ) def test_update_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5664,14 +5654,14 @@ def test_update_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_instance._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5680,7 +5670,7 @@ def test_update_instance_rest_required_fields( # verify required fields with non-default values are left alone client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5720,7 +5710,7 @@ def test_update_instance_rest_required_fields( def test_update_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_instance._get_unset_required_fields({}) @@ -5738,7 +5728,7 @@ def test_update_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -5798,7 +5788,7 @@ def test_update_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.UpdateInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5822,7 +5812,7 @@ def test_update_instance_rest_bad_request( def test_update_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5865,7 +5855,7 @@ def test_update_instance_rest_flattened(): def test_update_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5881,7 +5871,7 @@ def test_update_instance_rest_flattened_error(transport: str = "rest"): def test_update_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5894,7 +5884,7 @@ def test_update_instance_rest_error(): ) def test_upgrade_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5941,7 +5931,7 @@ def test_upgrade_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).upgrade_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5951,7 +5941,7 @@ def test_upgrade_instance_rest_required_fields( jsonified_request["redisVersion"] = "redis_version_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).upgrade_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5962,7 +5952,7 @@ def test_upgrade_instance_rest_required_fields( assert jsonified_request["redisVersion"] == "redis_version_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6002,7 +5992,7 @@ def test_upgrade_instance_rest_required_fields( def test_upgrade_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.upgrade_instance._get_unset_required_fields({}) @@ -6020,7 +6010,7 @@ def test_upgrade_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_upgrade_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -6080,7 +6070,7 @@ def test_upgrade_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.UpgradeInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6102,7 +6092,7 @@ def test_upgrade_instance_rest_bad_request( def test_upgrade_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6145,7 +6135,7 @@ def test_upgrade_instance_rest_flattened(): def test_upgrade_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6161,7 +6151,7 @@ def test_upgrade_instance_rest_flattened_error(transport: str = "rest"): def test_upgrade_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6174,7 +6164,7 @@ def test_upgrade_instance_rest_error(): ) def test_import_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6220,7 +6210,7 @@ def test_import_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6229,7 +6219,7 @@ def test_import_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6238,7 +6228,7 @@ def test_import_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6278,7 +6268,7 @@ def test_import_instance_rest_required_fields( def test_import_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_instance._get_unset_required_fields({}) @@ -6296,7 +6286,7 @@ def test_import_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -6356,7 +6346,7 @@ def test_import_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.ImportInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6378,7 +6368,7 @@ def test_import_instance_rest_bad_request( def test_import_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6423,7 +6413,7 @@ def test_import_instance_rest_flattened(): def test_import_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6441,7 +6431,7 @@ def test_import_instance_rest_flattened_error(transport: str = "rest"): def test_import_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6454,7 +6444,7 @@ def test_import_instance_rest_error(): ) def test_export_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6500,7 +6490,7 @@ def test_export_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).export_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6509,7 +6499,7 @@ def test_export_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).export_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6518,7 +6508,7 @@ def test_export_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6558,7 +6548,7 @@ def test_export_instance_rest_required_fields( def test_export_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.export_instance._get_unset_required_fields({}) @@ -6576,7 +6566,7 @@ def test_export_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_export_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -6636,7 +6626,7 @@ def test_export_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.ExportInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6658,7 +6648,7 @@ def test_export_instance_rest_bad_request( def test_export_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6703,7 +6693,7 @@ def test_export_instance_rest_flattened(): def test_export_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6721,7 +6711,7 @@ def test_export_instance_rest_flattened_error(transport: str = "rest"): def test_export_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6734,7 +6724,7 @@ def test_export_instance_rest_error(): ) def test_failover_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6780,7 +6770,7 @@ def test_failover_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).failover_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6789,7 +6779,7 @@ def test_failover_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).failover_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6798,7 +6788,7 @@ def test_failover_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6838,7 +6828,7 @@ def test_failover_instance_rest_required_fields( def test_failover_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.failover_instance._get_unset_required_fields({}) @@ -6848,7 +6838,7 @@ def test_failover_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_failover_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -6908,7 +6898,7 @@ def test_failover_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.FailoverInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6930,7 +6920,7 @@ def test_failover_instance_rest_bad_request( def test_failover_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6973,7 +6963,7 @@ def test_failover_instance_rest_flattened(): def test_failover_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6989,7 +6979,7 @@ def test_failover_instance_rest_flattened_error(transport: str = "rest"): def test_failover_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7002,7 +6992,7 @@ def test_failover_instance_rest_error(): ) def test_delete_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7048,7 +7038,7 @@ def test_delete_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7057,7 +7047,7 @@ def test_delete_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7066,7 +7056,7 @@ def test_delete_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7105,7 +7095,7 @@ def test_delete_instance_rest_required_fields( def test_delete_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_instance._get_unset_required_fields({}) @@ -7115,7 +7105,7 @@ def test_delete_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -7175,7 +7165,7 @@ def test_delete_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.DeleteInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7197,7 +7187,7 @@ def test_delete_instance_rest_bad_request( def test_delete_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7238,7 +7228,7 @@ def test_delete_instance_rest_flattened(): def test_delete_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7253,7 +7243,7 @@ def test_delete_instance_rest_flattened_error(transport: str = "rest"): def test_delete_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7266,7 +7256,7 @@ def test_delete_instance_rest_error(): ) def test_reschedule_maintenance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7312,7 +7302,7 @@ def test_reschedule_maintenance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).reschedule_maintenance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7321,7 +7311,7 @@ def test_reschedule_maintenance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).reschedule_maintenance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7330,7 +7320,7 @@ def test_reschedule_maintenance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7370,7 +7360,7 @@ def test_reschedule_maintenance_rest_required_fields( def test_reschedule_maintenance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.reschedule_maintenance._get_unset_required_fields({}) @@ -7388,7 +7378,7 @@ def test_reschedule_maintenance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_reschedule_maintenance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -7448,7 +7438,7 @@ def test_reschedule_maintenance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.RescheduleMaintenanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7470,7 +7460,7 @@ def test_reschedule_maintenance_rest_bad_request( def test_reschedule_maintenance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7514,7 +7504,7 @@ def test_reschedule_maintenance_rest_flattened(): def test_reschedule_maintenance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7531,24 +7521,24 @@ def test_reschedule_maintenance_rest_flattened_error(transport: str = "rest"): def test_reschedule_maintenance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudRedisClient( @@ -7558,7 +7548,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7573,13 +7563,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CloudRedisClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudRedisClient( @@ -7591,7 +7580,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CloudRedisClient(transport=transport) assert client.transport is transport @@ -7600,13 +7589,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CloudRedisGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7623,7 +7612,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7637,7 +7626,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CloudRedisClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7645,7 +7634,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7657,7 +7646,7 @@ def test_cloud_redis_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CloudRedisTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7669,7 +7658,7 @@ def test_cloud_redis_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CloudRedisTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7722,7 +7711,7 @@ def test_cloud_redis_base_transport_with_credentials_file(): "google.cloud.redis_v1.services.cloud_redis.transports.CloudRedisTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudRedisTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7741,7 +7730,7 @@ def test_cloud_redis_base_transport_with_adc(): "google.cloud.redis_v1.services.cloud_redis.transports.CloudRedisTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudRedisTransport() adc.assert_called_once() @@ -7749,7 +7738,7 @@ def test_cloud_redis_base_transport_with_adc(): def test_cloud_redis_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CloudRedisClient() adc.assert_called_once_with( scopes=None, @@ -7769,7 +7758,7 @@ def test_cloud_redis_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7816,7 +7805,7 @@ def test_cloud_redis_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7841,7 +7830,7 @@ def test_cloud_redis_transport_create_channel(transport_class, grpc_helpers): [transports.CloudRedisGrpcTransport, transports.CloudRedisGrpcAsyncIOTransport], ) def test_cloud_redis_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7879,7 +7868,7 @@ def test_cloud_redis_grpc_transport_client_cert_source_for_mtls(transport_class) def test_cloud_redis_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7891,7 +7880,7 @@ def test_cloud_redis_http_transport_client_cert_source_for_mtls(): def test_cloud_redis_rest_lro_client(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -7916,7 +7905,7 @@ def test_cloud_redis_rest_lro_client(): ) def test_cloud_redis_host_no_port(transport_name): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="redis.googleapis.com" ), @@ -7939,7 +7928,7 @@ def test_cloud_redis_host_no_port(transport_name): ) def test_cloud_redis_host_with_port(transport_name): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="redis.googleapis.com:8000" ), @@ -7959,8 +7948,8 @@ def test_cloud_redis_host_with_port(transport_name): ], ) def test_cloud_redis_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CloudRedisClient( credentials=creds1, transport=transport_name, @@ -8049,7 +8038,7 @@ def test_cloud_redis_transport_channel_mtls_with_client_cert_source(transport_cl mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -8124,7 +8113,7 @@ def test_cloud_redis_transport_channel_mtls_with_adc(transport_class): def test_cloud_redis_grpc_lro_client(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -8141,7 +8130,7 @@ def test_cloud_redis_grpc_lro_client(): def test_cloud_redis_grpc_lro_async_client(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -8292,7 +8281,7 @@ def test_client_with_default_client_info(): transports.CloudRedisTransport, "_prep_wrapped_messages" ) as prep: client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8302,7 +8291,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CloudRedisClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8311,7 +8300,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -8326,7 +8315,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8356,7 +8345,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -8384,7 +8373,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8412,7 +8401,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -8440,7 +8429,7 @@ def test_cancel_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.CancelOperationRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8470,7 +8459,7 @@ def test_cancel_operation_rest_bad_request( ) def test_cancel_operation_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -8498,7 +8487,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8528,7 +8517,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -8556,7 +8545,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8586,7 +8575,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -8614,7 +8603,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8644,7 +8633,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -8670,7 +8659,7 @@ def test_list_operations_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8695,7 +8684,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8719,7 +8708,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8748,7 +8737,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8775,7 +8764,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -8793,7 +8782,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -8809,7 +8798,7 @@ async def test_delete_operation_from_dict_async(): def test_cancel_operation(transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8834,7 +8823,7 @@ def test_cancel_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_cancel_operation_async(transport: str = "grpc_asyncio"): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8858,7 +8847,7 @@ async def test_cancel_operation_async(transport: str = "grpc_asyncio"): def test_cancel_operation_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8887,7 +8876,7 @@ def test_cancel_operation_field_headers(): @pytest.mark.asyncio async def test_cancel_operation_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8914,7 +8903,7 @@ async def test_cancel_operation_field_headers_async(): def test_cancel_operation_from_dict(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -8932,7 +8921,7 @@ def test_cancel_operation_from_dict(): @pytest.mark.asyncio async def test_cancel_operation_from_dict_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -8948,7 +8937,7 @@ async def test_cancel_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8973,7 +8962,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8999,7 +8988,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9028,7 +9017,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9057,7 +9046,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -9075,7 +9064,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -9093,7 +9082,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9118,7 +9107,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9144,7 +9133,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9173,7 +9162,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9202,7 +9191,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -9220,7 +9209,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -9238,7 +9227,7 @@ async def test_list_operations_from_dict_async(): def test_list_locations(transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9263,7 +9252,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9289,7 +9278,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9318,7 +9307,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9347,7 +9336,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -9365,7 +9354,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -9383,7 +9372,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9408,7 +9397,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9433,7 +9422,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): - client = CloudRedisClient(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = CloudRedisClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -9460,9 +9449,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): - client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + client = CloudRedisAsyncClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -9490,7 +9477,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -9508,7 +9495,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -9532,7 +9519,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -9549,7 +9536,7 @@ def test_client_ctx(): ] for transport in transports: client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-redis/tests/unit/gapic/redis_v1beta1/test_cloud_redis.py b/packages/google-cloud-redis/tests/unit/gapic/redis_v1beta1/test_cloud_redis.py index 5c1c6ed236d4..327829ac203b 100644 --- a/packages/google-cloud-redis/tests/unit/gapic/redis_v1beta1/test_cloud_redis.py +++ b/packages/google-cloud-redis/tests/unit/gapic/redis_v1beta1/test_cloud_redis.py @@ -94,18 +94,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -309,7 +297,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -336,42 +324,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -382,7 +377,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_cloud_redis_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -434,7 +429,7 @@ def test_cloud_redis_client_service_account_always_use_jwt( ], ) def test_cloud_redis_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -497,9 +492,7 @@ def test_cloud_redis_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CloudRedisClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -892,20 +885,20 @@ def test_cloud_redis_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -917,13 +910,11 @@ def test_cloud_redis_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -939,8 +930,7 @@ def test_cloud_redis_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1081,8 +1071,8 @@ def test_cloud_redis_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1111,7 +1101,7 @@ def test_cloud_redis_client_create_channel_credentials_file( ) def test_list_instances(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1143,7 +1133,7 @@ def test_list_instances_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1160,7 +1150,7 @@ async def test_list_instances_async( transport: str = "grpc_asyncio", request_type=cloud_redis.ListInstancesRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1197,7 +1187,7 @@ async def test_list_instances_async_from_dict(): def test_list_instances_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1227,7 +1217,7 @@ def test_list_instances_field_headers(): @pytest.mark.asyncio async def test_list_instances_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1258,7 +1248,7 @@ async def test_list_instances_field_headers_async(): def test_list_instances_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1282,7 +1272,7 @@ def test_list_instances_flattened(): def test_list_instances_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1297,7 +1287,7 @@ def test_list_instances_flattened_error(): @pytest.mark.asyncio async def test_list_instances_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1326,7 +1316,7 @@ async def test_list_instances_flattened_async(): @pytest.mark.asyncio async def test_list_instances_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1340,7 +1330,7 @@ async def test_list_instances_flattened_error_async(): def test_list_instances_pager(transport_name: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1390,7 +1380,7 @@ def test_list_instances_pager(transport_name: str = "grpc"): def test_list_instances_pages(transport_name: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1432,7 +1422,7 @@ def test_list_instances_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_instances_async_pager(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1482,7 +1472,7 @@ async def test_list_instances_async_pager(): @pytest.mark.asyncio async def test_list_instances_async_pages(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1537,7 +1527,7 @@ async def test_list_instances_async_pages(): ) def test_get_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1617,7 +1607,7 @@ def test_get_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1634,7 +1624,7 @@ async def test_get_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.GetInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1719,7 +1709,7 @@ async def test_get_instance_async_from_dict(): def test_get_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1749,7 +1739,7 @@ def test_get_instance_field_headers(): @pytest.mark.asyncio async def test_get_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1780,7 +1770,7 @@ async def test_get_instance_field_headers_async(): def test_get_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1804,7 +1794,7 @@ def test_get_instance_flattened(): def test_get_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1819,7 +1809,7 @@ def test_get_instance_flattened_error(): @pytest.mark.asyncio async def test_get_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1848,7 +1838,7 @@ async def test_get_instance_flattened_async(): @pytest.mark.asyncio async def test_get_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1869,7 +1859,7 @@ async def test_get_instance_flattened_error_async(): ) def test_get_instance_auth_string(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1901,7 +1891,7 @@ def test_get_instance_auth_string_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1921,7 +1911,7 @@ async def test_get_instance_auth_string_async( request_type=cloud_redis.GetInstanceAuthStringRequest, ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1958,7 +1948,7 @@ async def test_get_instance_auth_string_async_from_dict(): def test_get_instance_auth_string_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1990,7 +1980,7 @@ def test_get_instance_auth_string_field_headers(): @pytest.mark.asyncio async def test_get_instance_auth_string_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2023,7 +2013,7 @@ async def test_get_instance_auth_string_field_headers_async(): def test_get_instance_auth_string_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2049,7 +2039,7 @@ def test_get_instance_auth_string_flattened(): def test_get_instance_auth_string_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2064,7 +2054,7 @@ def test_get_instance_auth_string_flattened_error(): @pytest.mark.asyncio async def test_get_instance_auth_string_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2095,7 +2085,7 @@ async def test_get_instance_auth_string_flattened_async(): @pytest.mark.asyncio async def test_get_instance_auth_string_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2116,7 +2106,7 @@ async def test_get_instance_auth_string_flattened_error_async(): ) def test_create_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2143,7 +2133,7 @@ def test_create_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2160,7 +2150,7 @@ async def test_create_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.CreateInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2192,7 +2182,7 @@ async def test_create_instance_async_from_dict(): def test_create_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2222,7 +2212,7 @@ def test_create_instance_field_headers(): @pytest.mark.asyncio async def test_create_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2253,7 +2243,7 @@ async def test_create_instance_field_headers_async(): def test_create_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2285,7 +2275,7 @@ def test_create_instance_flattened(): def test_create_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2302,7 +2292,7 @@ def test_create_instance_flattened_error(): @pytest.mark.asyncio async def test_create_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2339,7 +2329,7 @@ async def test_create_instance_flattened_async(): @pytest.mark.asyncio async def test_create_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2362,7 +2352,7 @@ async def test_create_instance_flattened_error_async(): ) def test_update_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2389,7 +2379,7 @@ def test_update_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2406,7 +2396,7 @@ async def test_update_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.UpdateInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2438,7 +2428,7 @@ async def test_update_instance_async_from_dict(): def test_update_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2468,7 +2458,7 @@ def test_update_instance_field_headers(): @pytest.mark.asyncio async def test_update_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2499,7 +2489,7 @@ async def test_update_instance_field_headers_async(): def test_update_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2527,7 +2517,7 @@ def test_update_instance_flattened(): def test_update_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2543,7 +2533,7 @@ def test_update_instance_flattened_error(): @pytest.mark.asyncio async def test_update_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2576,7 +2566,7 @@ async def test_update_instance_flattened_async(): @pytest.mark.asyncio async def test_update_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2598,7 +2588,7 @@ async def test_update_instance_flattened_error_async(): ) def test_upgrade_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2625,7 +2615,7 @@ def test_upgrade_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2642,7 +2632,7 @@ async def test_upgrade_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.UpgradeInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2674,7 +2664,7 @@ async def test_upgrade_instance_async_from_dict(): def test_upgrade_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2704,7 +2694,7 @@ def test_upgrade_instance_field_headers(): @pytest.mark.asyncio async def test_upgrade_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2735,7 +2725,7 @@ async def test_upgrade_instance_field_headers_async(): def test_upgrade_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2763,7 +2753,7 @@ def test_upgrade_instance_flattened(): def test_upgrade_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2779,7 +2769,7 @@ def test_upgrade_instance_flattened_error(): @pytest.mark.asyncio async def test_upgrade_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2812,7 +2802,7 @@ async def test_upgrade_instance_flattened_async(): @pytest.mark.asyncio async def test_upgrade_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2834,7 +2824,7 @@ async def test_upgrade_instance_flattened_error_async(): ) def test_import_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2861,7 +2851,7 @@ def test_import_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2878,7 +2868,7 @@ async def test_import_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.ImportInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2910,7 +2900,7 @@ async def test_import_instance_async_from_dict(): def test_import_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2940,7 +2930,7 @@ def test_import_instance_field_headers(): @pytest.mark.asyncio async def test_import_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2971,7 +2961,7 @@ async def test_import_instance_field_headers_async(): def test_import_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3003,7 +2993,7 @@ def test_import_instance_flattened(): def test_import_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3021,7 +3011,7 @@ def test_import_instance_flattened_error(): @pytest.mark.asyncio async def test_import_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3058,7 +3048,7 @@ async def test_import_instance_flattened_async(): @pytest.mark.asyncio async def test_import_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3082,7 +3072,7 @@ async def test_import_instance_flattened_error_async(): ) def test_export_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3109,7 +3099,7 @@ def test_export_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3126,7 +3116,7 @@ async def test_export_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.ExportInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3158,7 +3148,7 @@ async def test_export_instance_async_from_dict(): def test_export_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3188,7 +3178,7 @@ def test_export_instance_field_headers(): @pytest.mark.asyncio async def test_export_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3219,7 +3209,7 @@ async def test_export_instance_field_headers_async(): def test_export_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3251,7 +3241,7 @@ def test_export_instance_flattened(): def test_export_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3269,7 +3259,7 @@ def test_export_instance_flattened_error(): @pytest.mark.asyncio async def test_export_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3306,7 +3296,7 @@ async def test_export_instance_flattened_async(): @pytest.mark.asyncio async def test_export_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3330,7 +3320,7 @@ async def test_export_instance_flattened_error_async(): ) def test_failover_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3359,7 +3349,7 @@ def test_failover_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3378,7 +3368,7 @@ async def test_failover_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.FailoverInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3412,7 +3402,7 @@ async def test_failover_instance_async_from_dict(): def test_failover_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3444,7 +3434,7 @@ def test_failover_instance_field_headers(): @pytest.mark.asyncio async def test_failover_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3477,7 +3467,7 @@ async def test_failover_instance_field_headers_async(): def test_failover_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3509,7 +3499,7 @@ def test_failover_instance_flattened(): def test_failover_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3525,7 +3515,7 @@ def test_failover_instance_flattened_error(): @pytest.mark.asyncio async def test_failover_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3562,7 +3552,7 @@ async def test_failover_instance_flattened_async(): @pytest.mark.asyncio async def test_failover_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3584,7 +3574,7 @@ async def test_failover_instance_flattened_error_async(): ) def test_delete_instance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3611,7 +3601,7 @@ def test_delete_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3628,7 +3618,7 @@ async def test_delete_instance_async( transport: str = "grpc_asyncio", request_type=cloud_redis.DeleteInstanceRequest ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3660,7 +3650,7 @@ async def test_delete_instance_async_from_dict(): def test_delete_instance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3690,7 +3680,7 @@ def test_delete_instance_field_headers(): @pytest.mark.asyncio async def test_delete_instance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3721,7 +3711,7 @@ async def test_delete_instance_field_headers_async(): def test_delete_instance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3745,7 +3735,7 @@ def test_delete_instance_flattened(): def test_delete_instance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3760,7 +3750,7 @@ def test_delete_instance_flattened_error(): @pytest.mark.asyncio async def test_delete_instance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3789,7 +3779,7 @@ async def test_delete_instance_flattened_async(): @pytest.mark.asyncio async def test_delete_instance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3810,7 +3800,7 @@ async def test_delete_instance_flattened_error_async(): ) def test_reschedule_maintenance(request_type, transport: str = "grpc"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3839,7 +3829,7 @@ def test_reschedule_maintenance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3859,7 +3849,7 @@ async def test_reschedule_maintenance_async( request_type=cloud_redis.RescheduleMaintenanceRequest, ): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3893,7 +3883,7 @@ async def test_reschedule_maintenance_async_from_dict(): def test_reschedule_maintenance_field_headers(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3925,7 +3915,7 @@ def test_reschedule_maintenance_field_headers(): @pytest.mark.asyncio async def test_reschedule_maintenance_field_headers_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3958,7 +3948,7 @@ async def test_reschedule_maintenance_field_headers_async(): def test_reschedule_maintenance_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3992,7 +3982,7 @@ def test_reschedule_maintenance_flattened(): def test_reschedule_maintenance_flattened_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4009,7 +3999,7 @@ def test_reschedule_maintenance_flattened_error(): @pytest.mark.asyncio async def test_reschedule_maintenance_flattened_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4048,7 +4038,7 @@ async def test_reschedule_maintenance_flattened_async(): @pytest.mark.asyncio async def test_reschedule_maintenance_flattened_error_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4071,7 +4061,7 @@ async def test_reschedule_maintenance_flattened_error_async(): ) def test_list_instances_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4124,7 +4114,7 @@ def test_list_instances_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_instances._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4133,7 +4123,7 @@ def test_list_instances_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_instances._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4149,7 +4139,7 @@ def test_list_instances_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4191,7 +4181,7 @@ def test_list_instances_rest_required_fields( def test_list_instances_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_instances._get_unset_required_fields({}) @@ -4209,7 +4199,7 @@ def test_list_instances_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_instances_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -4267,7 +4257,7 @@ def test_list_instances_rest_bad_request( transport: str = "rest", request_type=cloud_redis.ListInstancesRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4289,7 +4279,7 @@ def test_list_instances_rest_bad_request( def test_list_instances_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4331,7 +4321,7 @@ def test_list_instances_rest_flattened(): def test_list_instances_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4346,7 +4336,7 @@ def test_list_instances_rest_flattened_error(transport: str = "rest"): def test_list_instances_rest_pager(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4414,7 +4404,7 @@ def test_list_instances_rest_pager(transport: str = "rest"): ) def test_get_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4513,7 +4503,7 @@ def test_get_instance_rest_required_fields(request_type=cloud_redis.GetInstanceR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4522,7 +4512,7 @@ def test_get_instance_rest_required_fields(request_type=cloud_redis.GetInstanceR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4531,7 +4521,7 @@ def test_get_instance_rest_required_fields(request_type=cloud_redis.GetInstanceR assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4573,7 +4563,7 @@ def test_get_instance_rest_required_fields(request_type=cloud_redis.GetInstanceR def test_get_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_instance._get_unset_required_fields({}) @@ -4583,7 +4573,7 @@ def test_get_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -4637,7 +4627,7 @@ def test_get_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.GetInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4659,7 +4649,7 @@ def test_get_instance_rest_bad_request( def test_get_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4703,7 +4693,7 @@ def test_get_instance_rest_flattened(): def test_get_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4718,7 +4708,7 @@ def test_get_instance_rest_flattened_error(transport: str = "rest"): def test_get_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4731,7 +4721,7 @@ def test_get_instance_rest_error(): ) def test_get_instance_auth_string_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4782,7 +4772,7 @@ def test_get_instance_auth_string_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance_auth_string._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4791,7 +4781,7 @@ def test_get_instance_auth_string_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance_auth_string._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4800,7 +4790,7 @@ def test_get_instance_auth_string_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4842,7 +4832,7 @@ def test_get_instance_auth_string_rest_required_fields( def test_get_instance_auth_string_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_instance_auth_string._get_unset_required_fields({}) @@ -4852,7 +4842,7 @@ def test_get_instance_auth_string_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_instance_auth_string_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -4910,7 +4900,7 @@ def test_get_instance_auth_string_rest_bad_request( transport: str = "rest", request_type=cloud_redis.GetInstanceAuthStringRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4932,7 +4922,7 @@ def test_get_instance_auth_string_rest_bad_request( def test_get_instance_auth_string_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4976,7 +4966,7 @@ def test_get_instance_auth_string_rest_flattened(): def test_get_instance_auth_string_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4991,7 +4981,7 @@ def test_get_instance_auth_string_rest_flattened_error(transport: str = "rest"): def test_get_instance_auth_string_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5004,7 +4994,7 @@ def test_get_instance_auth_string_rest_error(): ) def test_create_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5186,7 +5176,7 @@ def test_create_instance_rest_required_fields( assert "instanceId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5198,7 +5188,7 @@ def test_create_instance_rest_required_fields( jsonified_request["instanceId"] = "instance_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_instance._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("instance_id",)) @@ -5211,7 +5201,7 @@ def test_create_instance_rest_required_fields( assert jsonified_request["instanceId"] == "instance_id_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5257,7 +5247,7 @@ def test_create_instance_rest_required_fields( def test_create_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_instance._get_unset_required_fields({}) @@ -5276,7 +5266,7 @@ def test_create_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -5336,7 +5326,7 @@ def test_create_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.CreateInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5358,7 +5348,7 @@ def test_create_instance_rest_bad_request( def test_create_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5400,7 +5390,7 @@ def test_create_instance_rest_flattened(): def test_create_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5417,7 +5407,7 @@ def test_create_instance_rest_flattened_error(transport: str = "rest"): def test_create_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5430,7 +5420,7 @@ def test_create_instance_rest_error(): ) def test_update_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5611,14 +5601,14 @@ def test_update_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_instance._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5627,7 +5617,7 @@ def test_update_instance_rest_required_fields( # verify required fields with non-default values are left alone client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5667,7 +5657,7 @@ def test_update_instance_rest_required_fields( def test_update_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_instance._get_unset_required_fields({}) @@ -5685,7 +5675,7 @@ def test_update_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -5745,7 +5735,7 @@ def test_update_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.UpdateInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5769,7 +5759,7 @@ def test_update_instance_rest_bad_request( def test_update_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5812,7 +5802,7 @@ def test_update_instance_rest_flattened(): def test_update_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5828,7 +5818,7 @@ def test_update_instance_rest_flattened_error(transport: str = "rest"): def test_update_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5841,7 +5831,7 @@ def test_update_instance_rest_error(): ) def test_upgrade_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5888,7 +5878,7 @@ def test_upgrade_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).upgrade_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5898,7 +5888,7 @@ def test_upgrade_instance_rest_required_fields( jsonified_request["redisVersion"] = "redis_version_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).upgrade_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5909,7 +5899,7 @@ def test_upgrade_instance_rest_required_fields( assert jsonified_request["redisVersion"] == "redis_version_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5949,7 +5939,7 @@ def test_upgrade_instance_rest_required_fields( def test_upgrade_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.upgrade_instance._get_unset_required_fields({}) @@ -5967,7 +5957,7 @@ def test_upgrade_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_upgrade_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -6027,7 +6017,7 @@ def test_upgrade_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.UpgradeInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6049,7 +6039,7 @@ def test_upgrade_instance_rest_bad_request( def test_upgrade_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6092,7 +6082,7 @@ def test_upgrade_instance_rest_flattened(): def test_upgrade_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6108,7 +6098,7 @@ def test_upgrade_instance_rest_flattened_error(transport: str = "rest"): def test_upgrade_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6121,7 +6111,7 @@ def test_upgrade_instance_rest_error(): ) def test_import_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6167,7 +6157,7 @@ def test_import_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6176,7 +6166,7 @@ def test_import_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6185,7 +6175,7 @@ def test_import_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6225,7 +6215,7 @@ def test_import_instance_rest_required_fields( def test_import_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_instance._get_unset_required_fields({}) @@ -6243,7 +6233,7 @@ def test_import_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -6303,7 +6293,7 @@ def test_import_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.ImportInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6325,7 +6315,7 @@ def test_import_instance_rest_bad_request( def test_import_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6370,7 +6360,7 @@ def test_import_instance_rest_flattened(): def test_import_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6388,7 +6378,7 @@ def test_import_instance_rest_flattened_error(transport: str = "rest"): def test_import_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6401,7 +6391,7 @@ def test_import_instance_rest_error(): ) def test_export_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6447,7 +6437,7 @@ def test_export_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).export_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6456,7 +6446,7 @@ def test_export_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).export_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6465,7 +6455,7 @@ def test_export_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6505,7 +6495,7 @@ def test_export_instance_rest_required_fields( def test_export_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.export_instance._get_unset_required_fields({}) @@ -6523,7 +6513,7 @@ def test_export_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_export_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -6583,7 +6573,7 @@ def test_export_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.ExportInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6605,7 +6595,7 @@ def test_export_instance_rest_bad_request( def test_export_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6650,7 +6640,7 @@ def test_export_instance_rest_flattened(): def test_export_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6668,7 +6658,7 @@ def test_export_instance_rest_flattened_error(transport: str = "rest"): def test_export_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6681,7 +6671,7 @@ def test_export_instance_rest_error(): ) def test_failover_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6727,7 +6717,7 @@ def test_failover_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).failover_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6736,7 +6726,7 @@ def test_failover_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).failover_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6745,7 +6735,7 @@ def test_failover_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6785,7 +6775,7 @@ def test_failover_instance_rest_required_fields( def test_failover_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.failover_instance._get_unset_required_fields({}) @@ -6795,7 +6785,7 @@ def test_failover_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_failover_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -6855,7 +6845,7 @@ def test_failover_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.FailoverInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6877,7 +6867,7 @@ def test_failover_instance_rest_bad_request( def test_failover_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6920,7 +6910,7 @@ def test_failover_instance_rest_flattened(): def test_failover_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6936,7 +6926,7 @@ def test_failover_instance_rest_flattened_error(transport: str = "rest"): def test_failover_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6949,7 +6939,7 @@ def test_failover_instance_rest_error(): ) def test_delete_instance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6995,7 +6985,7 @@ def test_delete_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7004,7 +6994,7 @@ def test_delete_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7013,7 +7003,7 @@ def test_delete_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7052,7 +7042,7 @@ def test_delete_instance_rest_required_fields( def test_delete_instance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_instance._get_unset_required_fields({}) @@ -7062,7 +7052,7 @@ def test_delete_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_instance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -7122,7 +7112,7 @@ def test_delete_instance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.DeleteInstanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7144,7 +7134,7 @@ def test_delete_instance_rest_bad_request( def test_delete_instance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7186,7 +7176,7 @@ def test_delete_instance_rest_flattened(): def test_delete_instance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7201,7 +7191,7 @@ def test_delete_instance_rest_flattened_error(transport: str = "rest"): def test_delete_instance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7214,7 +7204,7 @@ def test_delete_instance_rest_error(): ) def test_reschedule_maintenance_rest(request_type): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7260,7 +7250,7 @@ def test_reschedule_maintenance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).reschedule_maintenance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7269,7 +7259,7 @@ def test_reschedule_maintenance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).reschedule_maintenance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7278,7 +7268,7 @@ def test_reschedule_maintenance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7318,7 +7308,7 @@ def test_reschedule_maintenance_rest_required_fields( def test_reschedule_maintenance_rest_unset_required_fields(): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.reschedule_maintenance._get_unset_required_fields({}) @@ -7336,7 +7326,7 @@ def test_reschedule_maintenance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_reschedule_maintenance_rest_interceptors(null_interceptor): transport = transports.CloudRedisRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudRedisRestInterceptor(), @@ -7396,7 +7386,7 @@ def test_reschedule_maintenance_rest_bad_request( transport: str = "rest", request_type=cloud_redis.RescheduleMaintenanceRequest ): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7418,7 +7408,7 @@ def test_reschedule_maintenance_rest_bad_request( def test_reschedule_maintenance_rest_flattened(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7462,7 +7452,7 @@ def test_reschedule_maintenance_rest_flattened(): def test_reschedule_maintenance_rest_flattened_error(transport: str = "rest"): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7479,24 +7469,24 @@ def test_reschedule_maintenance_rest_flattened_error(transport: str = "rest"): def test_reschedule_maintenance_rest_error(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudRedisClient( @@ -7506,7 +7496,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7521,13 +7511,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CloudRedisClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudRedisClient( @@ -7539,7 +7528,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CloudRedisClient(transport=transport) assert client.transport is transport @@ -7548,13 +7537,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CloudRedisGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CloudRedisGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7571,7 +7560,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7585,7 +7574,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CloudRedisClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7593,7 +7582,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7605,7 +7594,7 @@ def test_cloud_redis_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CloudRedisTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7617,7 +7606,7 @@ def test_cloud_redis_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CloudRedisTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7664,7 +7653,7 @@ def test_cloud_redis_base_transport_with_credentials_file(): "google.cloud.redis_v1beta1.services.cloud_redis.transports.CloudRedisTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudRedisTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7683,7 +7672,7 @@ def test_cloud_redis_base_transport_with_adc(): "google.cloud.redis_v1beta1.services.cloud_redis.transports.CloudRedisTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudRedisTransport() adc.assert_called_once() @@ -7691,7 +7680,7 @@ def test_cloud_redis_base_transport_with_adc(): def test_cloud_redis_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CloudRedisClient() adc.assert_called_once_with( scopes=None, @@ -7711,7 +7700,7 @@ def test_cloud_redis_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7758,7 +7747,7 @@ def test_cloud_redis_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7783,7 +7772,7 @@ def test_cloud_redis_transport_create_channel(transport_class, grpc_helpers): [transports.CloudRedisGrpcTransport, transports.CloudRedisGrpcAsyncIOTransport], ) def test_cloud_redis_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7821,7 +7810,7 @@ def test_cloud_redis_grpc_transport_client_cert_source_for_mtls(transport_class) def test_cloud_redis_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7833,7 +7822,7 @@ def test_cloud_redis_http_transport_client_cert_source_for_mtls(): def test_cloud_redis_rest_lro_client(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -7858,7 +7847,7 @@ def test_cloud_redis_rest_lro_client(): ) def test_cloud_redis_host_no_port(transport_name): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="redis.googleapis.com" ), @@ -7881,7 +7870,7 @@ def test_cloud_redis_host_no_port(transport_name): ) def test_cloud_redis_host_with_port(transport_name): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="redis.googleapis.com:8000" ), @@ -7901,8 +7890,8 @@ def test_cloud_redis_host_with_port(transport_name): ], ) def test_cloud_redis_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CloudRedisClient( credentials=creds1, transport=transport_name, @@ -7991,7 +7980,7 @@ def test_cloud_redis_transport_channel_mtls_with_client_cert_source(transport_cl mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -8066,7 +8055,7 @@ def test_cloud_redis_transport_channel_mtls_with_adc(transport_class): def test_cloud_redis_grpc_lro_client(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -8083,7 +8072,7 @@ def test_cloud_redis_grpc_lro_client(): def test_cloud_redis_grpc_lro_async_client(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -8234,7 +8223,7 @@ def test_client_with_default_client_info(): transports.CloudRedisTransport, "_prep_wrapped_messages" ) as prep: client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8244,7 +8233,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CloudRedisClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8253,7 +8242,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CloudRedisAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -8272,7 +8261,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8289,7 +8278,7 @@ def test_client_ctx(): ] for transport in transports: client = CloudRedisClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-resource-manager/google/cloud/resourcemanager/gapic_version.py b/packages/google-cloud-resource-manager/google/cloud/resourcemanager/gapic_version.py index 18a7732658ee..360a0d13ebdd 100644 --- a/packages/google-cloud-resource-manager/google/cloud/resourcemanager/gapic_version.py +++ b/packages/google-cloud-resource-manager/google/cloud/resourcemanager/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.12.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/gapic_version.py b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/gapic_version.py index 18a7732658ee..360a0d13ebdd 100644 --- a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/gapic_version.py +++ b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.12.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/folders/client.py b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/folders/client.py index 824679934120..29283fc5886a 100644 --- a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/folders/client.py +++ b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/folders/client.py @@ -385,6 +385,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -403,6 +404,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -477,17 +479,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = FoldersClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = FoldersClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/organizations/client.py b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/organizations/client.py index f58aff871b66..87b017e9e541 100644 --- a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/organizations/client.py +++ b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/organizations/client.py @@ -378,6 +378,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -396,6 +397,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -470,17 +472,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = OrganizationsClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = OrganizationsClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/projects/client.py b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/projects/client.py index d033467757a5..4baf49cfa008 100644 --- a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/projects/client.py +++ b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/projects/client.py @@ -381,6 +381,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -399,6 +400,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -473,17 +475,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ProjectsClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ProjectsClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_bindings/client.py b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_bindings/client.py index aa3f496d8e98..cf0d24589c4a 100644 --- a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_bindings/client.py +++ b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_bindings/client.py @@ -411,6 +411,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -429,6 +430,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -503,17 +505,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = TagBindingsClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = TagBindingsClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_holds/client.py b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_holds/client.py index e2d5d12bf614..7006b00e0c29 100644 --- a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_holds/client.py +++ b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_holds/client.py @@ -386,6 +386,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -404,6 +405,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -478,17 +480,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = TagHoldsClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = TagHoldsClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_keys/client.py b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_keys/client.py index 20861d05a4e6..72567c827b7e 100644 --- a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_keys/client.py +++ b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_keys/client.py @@ -381,6 +381,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -399,6 +400,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -473,17 +475,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = TagKeysClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = TagKeysClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_values/client.py b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_values/client.py index 804ebf121979..da1005b8c52b 100644 --- a/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_values/client.py +++ b/packages/google-cloud-resource-manager/google/cloud/resourcemanager_v3/services/tag_values/client.py @@ -381,6 +381,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -399,6 +400,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -473,17 +475,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = TagValuesClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = TagValuesClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-resource-manager/resourcemanager-v3-py.tar.gz b/packages/google-cloud-resource-manager/resourcemanager-v3-py.tar.gz new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/google-cloud-resource-manager/samples/generated_samples/snippet_metadata_google.cloud.resourcemanager.v3.json b/packages/google-cloud-resource-manager/samples/generated_samples/snippet_metadata_google.cloud.resourcemanager.v3.json index af5c0dd0cfc6..f05e3d14504e 100644 --- a/packages/google-cloud-resource-manager/samples/generated_samples/snippet_metadata_google.cloud.resourcemanager.v3.json +++ b/packages/google-cloud-resource-manager/samples/generated_samples/snippet_metadata_google.cloud.resourcemanager.v3.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-resource-manager", - "version": "1.12.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-resource-manager/setup.py b/packages/google-cloud-resource-manager/setup.py index d747a3d1106e..bf38c1f81bb7 100644 --- a/packages/google-cloud-resource-manager/setup.py +++ b/packages/google-cloud-resource-manager/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", diff --git a/packages/google-cloud-resource-manager/testing/constraints-3.7.txt b/packages/google-cloud-resource-manager/testing/constraints-3.7.txt index 44ffd04543a8..712d45b4c5ea 100644 --- a/packages/google-cloud-resource-manager/testing/constraints-3.7.txt +++ b/packages/google-cloud-resource-manager/testing/constraints-3.7.txt @@ -5,6 +5,7 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 grpc-google-iam-v1==0.12.4 diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_folders.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_folders.py index b23086f74e52..04c4011dcca7 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_folders.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_folders.py @@ -93,18 +93,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -296,7 +284,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -323,42 +311,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -369,7 +364,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_folders_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -419,7 +414,7 @@ def test_folders_client_service_account_always_use_jwt(transport_class, transpor ], ) def test_folders_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -476,9 +471,7 @@ def test_folders_client_get_transport_class(): def test_folders_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(FoldersClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -869,20 +862,20 @@ def test_folders_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -894,13 +887,11 @@ def test_folders_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -916,8 +907,7 @@ def test_folders_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1054,8 +1044,8 @@ def test_folders_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1087,7 +1077,7 @@ def test_folders_client_create_channel_credentials_file( ) def test_get_folder(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1125,7 +1115,7 @@ def test_get_folder_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1142,7 +1132,7 @@ async def test_get_folder_async( transport: str = "grpc_asyncio", request_type=folders.GetFolderRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1185,7 +1175,7 @@ async def test_get_folder_async_from_dict(): def test_get_folder_field_headers(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1215,7 +1205,7 @@ def test_get_folder_field_headers(): @pytest.mark.asyncio async def test_get_folder_field_headers_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1244,7 +1234,7 @@ async def test_get_folder_field_headers_async(): def test_get_folder_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1268,7 +1258,7 @@ def test_get_folder_flattened(): def test_get_folder_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1283,7 +1273,7 @@ def test_get_folder_flattened_error(): @pytest.mark.asyncio async def test_get_folder_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1310,7 +1300,7 @@ async def test_get_folder_flattened_async(): @pytest.mark.asyncio async def test_get_folder_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1331,7 +1321,7 @@ async def test_get_folder_flattened_error_async(): ) def test_list_folders(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1361,7 +1351,7 @@ def test_list_folders_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1378,7 +1368,7 @@ async def test_list_folders_async( transport: str = "grpc_asyncio", request_type=folders.ListFoldersRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1413,7 +1403,7 @@ async def test_list_folders_async_from_dict(): def test_list_folders_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1437,7 +1427,7 @@ def test_list_folders_flattened(): def test_list_folders_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1452,7 +1442,7 @@ def test_list_folders_flattened_error(): @pytest.mark.asyncio async def test_list_folders_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1481,7 +1471,7 @@ async def test_list_folders_flattened_async(): @pytest.mark.asyncio async def test_list_folders_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1495,7 +1485,7 @@ async def test_list_folders_flattened_error_async(): def test_list_folders_pager(transport_name: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1542,7 +1532,7 @@ def test_list_folders_pager(transport_name: str = "grpc"): def test_list_folders_pages(transport_name: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1584,7 +1574,7 @@ def test_list_folders_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_folders_async_pager(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1634,7 +1624,7 @@ async def test_list_folders_async_pager(): @pytest.mark.asyncio async def test_list_folders_async_pages(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1689,7 +1679,7 @@ async def test_list_folders_async_pages(): ) def test_search_folders(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1719,7 +1709,7 @@ def test_search_folders_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1736,7 +1726,7 @@ async def test_search_folders_async( transport: str = "grpc_asyncio", request_type=folders.SearchFoldersRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1771,7 +1761,7 @@ async def test_search_folders_async_from_dict(): def test_search_folders_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1795,7 +1785,7 @@ def test_search_folders_flattened(): def test_search_folders_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1810,7 +1800,7 @@ def test_search_folders_flattened_error(): @pytest.mark.asyncio async def test_search_folders_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1839,7 +1829,7 @@ async def test_search_folders_flattened_async(): @pytest.mark.asyncio async def test_search_folders_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1853,7 +1843,7 @@ async def test_search_folders_flattened_error_async(): def test_search_folders_pager(transport_name: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1900,7 +1890,7 @@ def test_search_folders_pager(transport_name: str = "grpc"): def test_search_folders_pages(transport_name: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1942,7 +1932,7 @@ def test_search_folders_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_folders_async_pager(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1992,7 +1982,7 @@ async def test_search_folders_async_pager(): @pytest.mark.asyncio async def test_search_folders_async_pages(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2047,7 +2037,7 @@ async def test_search_folders_async_pages(): ) def test_create_folder(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2074,7 +2064,7 @@ def test_create_folder_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2091,7 +2081,7 @@ async def test_create_folder_async( transport: str = "grpc_asyncio", request_type=folders.CreateFolderRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2123,7 +2113,7 @@ async def test_create_folder_async_from_dict(): def test_create_folder_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2147,7 +2137,7 @@ def test_create_folder_flattened(): def test_create_folder_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2162,7 +2152,7 @@ def test_create_folder_flattened_error(): @pytest.mark.asyncio async def test_create_folder_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2191,7 +2181,7 @@ async def test_create_folder_flattened_async(): @pytest.mark.asyncio async def test_create_folder_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2212,7 +2202,7 @@ async def test_create_folder_flattened_error_async(): ) def test_update_folder(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2239,7 +2229,7 @@ def test_update_folder_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2256,7 +2246,7 @@ async def test_update_folder_async( transport: str = "grpc_asyncio", request_type=folders.UpdateFolderRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2288,7 +2278,7 @@ async def test_update_folder_async_from_dict(): def test_update_folder_field_headers(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2318,7 +2308,7 @@ def test_update_folder_field_headers(): @pytest.mark.asyncio async def test_update_folder_field_headers_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2349,7 +2339,7 @@ async def test_update_folder_field_headers_async(): def test_update_folder_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2377,7 +2367,7 @@ def test_update_folder_flattened(): def test_update_folder_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2393,7 +2383,7 @@ def test_update_folder_flattened_error(): @pytest.mark.asyncio async def test_update_folder_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2426,7 +2416,7 @@ async def test_update_folder_flattened_async(): @pytest.mark.asyncio async def test_update_folder_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2448,7 +2438,7 @@ async def test_update_folder_flattened_error_async(): ) def test_move_folder(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2475,7 +2465,7 @@ def test_move_folder_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2492,7 +2482,7 @@ async def test_move_folder_async( transport: str = "grpc_asyncio", request_type=folders.MoveFolderRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2524,7 +2514,7 @@ async def test_move_folder_async_from_dict(): def test_move_folder_field_headers(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2554,7 +2544,7 @@ def test_move_folder_field_headers(): @pytest.mark.asyncio async def test_move_folder_field_headers_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2585,7 +2575,7 @@ async def test_move_folder_field_headers_async(): def test_move_folder_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2613,7 +2603,7 @@ def test_move_folder_flattened(): def test_move_folder_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2629,7 +2619,7 @@ def test_move_folder_flattened_error(): @pytest.mark.asyncio async def test_move_folder_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2662,7 +2652,7 @@ async def test_move_folder_flattened_async(): @pytest.mark.asyncio async def test_move_folder_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2684,7 +2674,7 @@ async def test_move_folder_flattened_error_async(): ) def test_delete_folder(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2711,7 +2701,7 @@ def test_delete_folder_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2728,7 +2718,7 @@ async def test_delete_folder_async( transport: str = "grpc_asyncio", request_type=folders.DeleteFolderRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2760,7 +2750,7 @@ async def test_delete_folder_async_from_dict(): def test_delete_folder_field_headers(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2790,7 +2780,7 @@ def test_delete_folder_field_headers(): @pytest.mark.asyncio async def test_delete_folder_field_headers_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2821,7 +2811,7 @@ async def test_delete_folder_field_headers_async(): def test_delete_folder_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2845,7 +2835,7 @@ def test_delete_folder_flattened(): def test_delete_folder_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2860,7 +2850,7 @@ def test_delete_folder_flattened_error(): @pytest.mark.asyncio async def test_delete_folder_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2889,7 +2879,7 @@ async def test_delete_folder_flattened_async(): @pytest.mark.asyncio async def test_delete_folder_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2910,7 +2900,7 @@ async def test_delete_folder_flattened_error_async(): ) def test_undelete_folder(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2937,7 +2927,7 @@ def test_undelete_folder_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2954,7 +2944,7 @@ async def test_undelete_folder_async( transport: str = "grpc_asyncio", request_type=folders.UndeleteFolderRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2986,7 +2976,7 @@ async def test_undelete_folder_async_from_dict(): def test_undelete_folder_field_headers(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3016,7 +3006,7 @@ def test_undelete_folder_field_headers(): @pytest.mark.asyncio async def test_undelete_folder_field_headers_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3047,7 +3037,7 @@ async def test_undelete_folder_field_headers_async(): def test_undelete_folder_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3071,7 +3061,7 @@ def test_undelete_folder_flattened(): def test_undelete_folder_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3086,7 +3076,7 @@ def test_undelete_folder_flattened_error(): @pytest.mark.asyncio async def test_undelete_folder_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3115,7 +3105,7 @@ async def test_undelete_folder_flattened_async(): @pytest.mark.asyncio async def test_undelete_folder_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3136,7 +3126,7 @@ async def test_undelete_folder_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3168,7 +3158,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3185,7 +3175,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3222,7 +3212,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3252,7 +3242,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3281,7 +3271,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -3298,7 +3288,7 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3322,7 +3312,7 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3337,7 +3327,7 @@ def test_get_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3364,7 +3354,7 @@ async def test_get_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3385,7 +3375,7 @@ async def test_get_iam_policy_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3417,7 +3407,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3434,7 +3424,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3471,7 +3461,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3501,7 +3491,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3530,7 +3520,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -3548,7 +3538,7 @@ def test_set_iam_policy_from_dict_foreign(): def test_set_iam_policy_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3572,7 +3562,7 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3587,7 +3577,7 @@ def test_set_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3614,7 +3604,7 @@ async def test_set_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3635,7 +3625,7 @@ async def test_set_iam_policy_flattened_error_async(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3667,7 +3657,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3687,7 +3677,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3724,7 +3714,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3756,7 +3746,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3789,7 +3779,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3808,7 +3798,7 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3838,7 +3828,7 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3854,7 +3844,7 @@ def test_test_iam_permissions_flattened_error(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3889,7 +3879,7 @@ async def test_test_iam_permissions_flattened_async(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_error_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3911,7 +3901,7 @@ async def test_test_iam_permissions_flattened_error_async(): ) def test_get_folder_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3968,7 +3958,7 @@ def test_get_folder_rest_required_fields(request_type=folders.GetFolderRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3977,7 +3967,7 @@ def test_get_folder_rest_required_fields(request_type=folders.GetFolderRequest): jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3986,7 +3976,7 @@ def test_get_folder_rest_required_fields(request_type=folders.GetFolderRequest): assert jsonified_request["name"] == "name_value" client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4028,7 +4018,7 @@ def test_get_folder_rest_required_fields(request_type=folders.GetFolderRequest): def test_get_folder_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_folder._get_unset_required_fields({}) @@ -4038,7 +4028,7 @@ def test_get_folder_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_folder_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -4090,7 +4080,7 @@ def test_get_folder_rest_bad_request( transport: str = "rest", request_type=folders.GetFolderRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4112,7 +4102,7 @@ def test_get_folder_rest_bad_request( def test_get_folder_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4152,7 +4142,7 @@ def test_get_folder_rest_flattened(): def test_get_folder_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4167,7 +4157,7 @@ def test_get_folder_rest_flattened_error(transport: str = "rest"): def test_get_folder_rest_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4180,7 +4170,7 @@ def test_get_folder_rest_error(): ) def test_list_folders_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4230,7 +4220,7 @@ def test_list_folders_rest_required_fields(request_type=folders.ListFoldersReque assert "parent" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_folders._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4241,7 +4231,7 @@ def test_list_folders_rest_required_fields(request_type=folders.ListFoldersReque jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_folders._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4259,7 +4249,7 @@ def test_list_folders_rest_required_fields(request_type=folders.ListFoldersReque assert jsonified_request["parent"] == "parent_value" client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4307,7 +4297,7 @@ def test_list_folders_rest_required_fields(request_type=folders.ListFoldersReque def test_list_folders_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_folders._get_unset_required_fields({}) @@ -4327,7 +4317,7 @@ def test_list_folders_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_folders_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -4381,7 +4371,7 @@ def test_list_folders_rest_bad_request( transport: str = "rest", request_type=folders.ListFoldersRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4403,7 +4393,7 @@ def test_list_folders_rest_bad_request( def test_list_folders_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4441,7 +4431,7 @@ def test_list_folders_rest_flattened(): def test_list_folders_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4456,7 +4446,7 @@ def test_list_folders_rest_flattened_error(transport: str = "rest"): def test_list_folders_rest_pager(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4524,7 +4514,7 @@ def test_list_folders_rest_pager(transport: str = "rest"): ) def test_search_folders_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4558,7 +4548,7 @@ def test_search_folders_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_search_folders_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -4612,7 +4602,7 @@ def test_search_folders_rest_bad_request( transport: str = "rest", request_type=folders.SearchFoldersRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4634,7 +4624,7 @@ def test_search_folders_rest_bad_request( def test_search_folders_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4674,7 +4664,7 @@ def test_search_folders_rest_flattened(): def test_search_folders_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4689,7 +4679,7 @@ def test_search_folders_rest_flattened_error(transport: str = "rest"): def test_search_folders_rest_pager(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4757,7 +4747,7 @@ def test_search_folders_rest_pager(transport: str = "rest"): ) def test_create_folder_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4877,21 +4867,21 @@ def test_create_folder_rest_required_fields(request_type=folders.CreateFolderReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4931,7 +4921,7 @@ def test_create_folder_rest_required_fields(request_type=folders.CreateFolderReq def test_create_folder_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_folder._get_unset_required_fields({}) @@ -4941,7 +4931,7 @@ def test_create_folder_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_folder_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -4997,7 +4987,7 @@ def test_create_folder_rest_bad_request( transport: str = "rest", request_type=folders.CreateFolderRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5019,7 +5009,7 @@ def test_create_folder_rest_bad_request( def test_create_folder_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5055,7 +5045,7 @@ def test_create_folder_rest_flattened(): def test_create_folder_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5070,7 +5060,7 @@ def test_create_folder_rest_flattened_error(transport: str = "rest"): def test_create_folder_rest_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5083,7 +5073,7 @@ def test_create_folder_rest_error(): ) def test_update_folder_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5203,14 +5193,14 @@ def test_update_folder_rest_required_fields(request_type=folders.UpdateFolderReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_folder._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5219,7 +5209,7 @@ def test_update_folder_rest_required_fields(request_type=folders.UpdateFolderReq # verify required fields with non-default values are left alone client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5259,7 +5249,7 @@ def test_update_folder_rest_required_fields(request_type=folders.UpdateFolderReq def test_update_folder_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_folder._get_unset_required_fields({}) @@ -5277,7 +5267,7 @@ def test_update_folder_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_folder_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -5333,7 +5323,7 @@ def test_update_folder_rest_bad_request( transport: str = "rest", request_type=folders.UpdateFolderRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5355,7 +5345,7 @@ def test_update_folder_rest_bad_request( def test_update_folder_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5394,7 +5384,7 @@ def test_update_folder_rest_flattened(): def test_update_folder_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5410,7 +5400,7 @@ def test_update_folder_rest_flattened_error(transport: str = "rest"): def test_update_folder_rest_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5423,7 +5413,7 @@ def test_update_folder_rest_error(): ) def test_move_folder_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5468,7 +5458,7 @@ def test_move_folder_rest_required_fields(request_type=folders.MoveFolderRequest # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).move_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5478,7 +5468,7 @@ def test_move_folder_rest_required_fields(request_type=folders.MoveFolderRequest jsonified_request["destinationParent"] = "destination_parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).move_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5489,7 +5479,7 @@ def test_move_folder_rest_required_fields(request_type=folders.MoveFolderRequest assert jsonified_request["destinationParent"] == "destination_parent_value" client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5529,7 +5519,7 @@ def test_move_folder_rest_required_fields(request_type=folders.MoveFolderRequest def test_move_folder_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.move_folder._get_unset_required_fields({}) @@ -5547,7 +5537,7 @@ def test_move_folder_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_move_folder_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -5603,7 +5593,7 @@ def test_move_folder_rest_bad_request( transport: str = "rest", request_type=folders.MoveFolderRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5625,7 +5615,7 @@ def test_move_folder_rest_bad_request( def test_move_folder_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5664,7 +5654,7 @@ def test_move_folder_rest_flattened(): def test_move_folder_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5680,7 +5670,7 @@ def test_move_folder_rest_flattened_error(transport: str = "rest"): def test_move_folder_rest_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5693,7 +5683,7 @@ def test_move_folder_rest_error(): ) def test_delete_folder_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5737,7 +5727,7 @@ def test_delete_folder_rest_required_fields(request_type=folders.DeleteFolderReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5746,7 +5736,7 @@ def test_delete_folder_rest_required_fields(request_type=folders.DeleteFolderReq jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5755,7 +5745,7 @@ def test_delete_folder_rest_required_fields(request_type=folders.DeleteFolderReq assert jsonified_request["name"] == "name_value" client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5794,7 +5784,7 @@ def test_delete_folder_rest_required_fields(request_type=folders.DeleteFolderReq def test_delete_folder_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_folder._get_unset_required_fields({}) @@ -5804,7 +5794,7 @@ def test_delete_folder_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_folder_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -5860,7 +5850,7 @@ def test_delete_folder_rest_bad_request( transport: str = "rest", request_type=folders.DeleteFolderRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5882,7 +5872,7 @@ def test_delete_folder_rest_bad_request( def test_delete_folder_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5920,7 +5910,7 @@ def test_delete_folder_rest_flattened(): def test_delete_folder_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5935,7 +5925,7 @@ def test_delete_folder_rest_flattened_error(transport: str = "rest"): def test_delete_folder_rest_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5948,7 +5938,7 @@ def test_delete_folder_rest_error(): ) def test_undelete_folder_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5994,7 +5984,7 @@ def test_undelete_folder_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6003,7 +5993,7 @@ def test_undelete_folder_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_folder._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6012,7 +6002,7 @@ def test_undelete_folder_rest_required_fields( assert jsonified_request["name"] == "name_value" client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6052,7 +6042,7 @@ def test_undelete_folder_rest_required_fields( def test_undelete_folder_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.undelete_folder._get_unset_required_fields({}) @@ -6062,7 +6052,7 @@ def test_undelete_folder_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_undelete_folder_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -6118,7 +6108,7 @@ def test_undelete_folder_rest_bad_request( transport: str = "rest", request_type=folders.UndeleteFolderRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6140,7 +6130,7 @@ def test_undelete_folder_rest_bad_request( def test_undelete_folder_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6178,7 +6168,7 @@ def test_undelete_folder_rest_flattened(): def test_undelete_folder_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6193,7 +6183,7 @@ def test_undelete_folder_rest_flattened_error(transport: str = "rest"): def test_undelete_folder_rest_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6206,7 +6196,7 @@ def test_undelete_folder_rest_error(): ) def test_get_iam_policy_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6257,7 +6247,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6266,7 +6256,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6275,7 +6265,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6316,7 +6306,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -6326,7 +6316,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -6378,7 +6368,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6400,7 +6390,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6438,7 +6428,7 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6453,7 +6443,7 @@ def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): def test_get_iam_policy_rest_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6466,7 +6456,7 @@ def test_get_iam_policy_rest_error(): ) def test_set_iam_policy_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6517,7 +6507,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6526,7 +6516,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6535,7 +6525,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6576,7 +6566,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -6594,7 +6584,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -6646,7 +6636,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6668,7 +6658,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6706,7 +6696,7 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6721,7 +6711,7 @@ def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): def test_set_iam_policy_rest_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6734,7 +6724,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6784,7 +6774,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6794,7 +6784,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6805,7 +6795,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6846,7 +6836,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -6864,7 +6854,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.FoldersRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.FoldersRestInterceptor(), ) client = FoldersClient(transport=transport) @@ -6918,7 +6908,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6940,7 +6930,7 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6980,7 +6970,7 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6996,24 +6986,24 @@ def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): def test_test_iam_permissions_rest_error(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.FoldersGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.FoldersGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = FoldersClient( @@ -7023,7 +7013,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.FoldersGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7038,13 +7028,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = FoldersClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.FoldersGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = FoldersClient( @@ -7056,7 +7045,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.FoldersGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = FoldersClient(transport=transport) assert client.transport is transport @@ -7065,13 +7054,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.FoldersGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.FoldersGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7088,7 +7077,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7102,7 +7091,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = FoldersClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7110,7 +7099,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7122,7 +7111,7 @@ def test_folders_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.FoldersTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7134,7 +7123,7 @@ def test_folders_base_transport(): ) as Transport: Transport.return_value = None transport = transports.FoldersTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7182,7 +7171,7 @@ def test_folders_base_transport_with_credentials_file(): "google.cloud.resourcemanager_v3.services.folders.transports.FoldersTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.FoldersTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7204,7 +7193,7 @@ def test_folders_base_transport_with_adc(): "google.cloud.resourcemanager_v3.services.folders.transports.FoldersTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.FoldersTransport() adc.assert_called_once() @@ -7212,7 +7201,7 @@ def test_folders_base_transport_with_adc(): def test_folders_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) FoldersClient() adc.assert_called_once_with( scopes=None, @@ -7235,7 +7224,7 @@ def test_folders_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7285,7 +7274,7 @@ def test_folders_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7313,7 +7302,7 @@ def test_folders_transport_create_channel(transport_class, grpc_helpers): [transports.FoldersGrpcTransport, transports.FoldersGrpcAsyncIOTransport], ) def test_folders_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7351,7 +7340,7 @@ def test_folders_grpc_transport_client_cert_source_for_mtls(transport_class): def test_folders_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7363,7 +7352,7 @@ def test_folders_http_transport_client_cert_source_for_mtls(): def test_folders_rest_lro_client(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -7388,7 +7377,7 @@ def test_folders_rest_lro_client(): ) def test_folders_host_no_port(transport_name): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com" ), @@ -7411,7 +7400,7 @@ def test_folders_host_no_port(transport_name): ) def test_folders_host_with_port(transport_name): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com:8000" ), @@ -7431,8 +7420,8 @@ def test_folders_host_with_port(transport_name): ], ) def test_folders_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = FoldersClient( credentials=creds1, transport=transport_name, @@ -7521,7 +7510,7 @@ def test_folders_transport_channel_mtls_with_client_cert_source(transport_class) mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -7596,7 +7585,7 @@ def test_folders_transport_channel_mtls_with_adc(transport_class): def test_folders_grpc_lro_client(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -7613,7 +7602,7 @@ def test_folders_grpc_lro_client(): def test_folders_grpc_lro_async_client(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -7758,7 +7747,7 @@ def test_client_with_default_client_info(): transports.FoldersTransport, "_prep_wrapped_messages" ) as prep: client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7768,7 +7757,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = FoldersClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7777,7 +7766,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -7792,7 +7781,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7820,7 +7809,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "operations/sample1"} @@ -7846,7 +7835,7 @@ def test_get_operation_rest(request_type): def test_get_operation(transport: str = "grpc"): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7871,7 +7860,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7897,7 +7886,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7926,7 +7915,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7955,7 +7944,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7973,7 +7962,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = FoldersAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7997,7 +7986,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8014,7 +8003,7 @@ def test_client_ctx(): ] for transport in transports: client = FoldersClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_organizations.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_organizations.py index c53c1ec4772f..4fd3871a2131 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_organizations.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_organizations.py @@ -84,18 +84,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -318,7 +306,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -345,42 +333,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -391,7 +386,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_organizations_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -443,7 +438,7 @@ def test_organizations_client_service_account_always_use_jwt( ], ) def test_organizations_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -506,9 +501,7 @@ def test_organizations_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(OrganizationsClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -907,20 +900,20 @@ def test_organizations_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -932,13 +925,11 @@ def test_organizations_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -954,8 +945,7 @@ def test_organizations_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1108,8 +1098,8 @@ def test_organizations_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1141,7 +1131,7 @@ def test_organizations_client_create_channel_credentials_file( ) def test_get_organization(request_type, transport: str = "grpc"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1178,7 +1168,7 @@ def test_get_organization_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1195,7 +1185,7 @@ async def test_get_organization_async( transport: str = "grpc_asyncio", request_type=organizations.GetOrganizationRequest ): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1236,7 +1226,7 @@ async def test_get_organization_async_from_dict(): def test_get_organization_field_headers(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1266,7 +1256,7 @@ def test_get_organization_field_headers(): @pytest.mark.asyncio async def test_get_organization_field_headers_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1297,7 +1287,7 @@ async def test_get_organization_field_headers_async(): def test_get_organization_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1321,7 +1311,7 @@ def test_get_organization_flattened(): def test_get_organization_flattened_error(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1336,7 +1326,7 @@ def test_get_organization_flattened_error(): @pytest.mark.asyncio async def test_get_organization_flattened_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1365,7 +1355,7 @@ async def test_get_organization_flattened_async(): @pytest.mark.asyncio async def test_get_organization_flattened_error_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1386,7 +1376,7 @@ async def test_get_organization_flattened_error_async(): ) def test_search_organizations(request_type, transport: str = "grpc"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1418,7 +1408,7 @@ def test_search_organizations_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1438,7 +1428,7 @@ async def test_search_organizations_async( request_type=organizations.SearchOrganizationsRequest, ): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1475,7 +1465,7 @@ async def test_search_organizations_async_from_dict(): def test_search_organizations_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1501,7 +1491,7 @@ def test_search_organizations_flattened(): def test_search_organizations_flattened_error(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1516,7 +1506,7 @@ def test_search_organizations_flattened_error(): @pytest.mark.asyncio async def test_search_organizations_flattened_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1547,7 +1537,7 @@ async def test_search_organizations_flattened_async(): @pytest.mark.asyncio async def test_search_organizations_flattened_error_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1561,7 +1551,7 @@ async def test_search_organizations_flattened_error_async(): def test_search_organizations_pager(transport_name: str = "grpc"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1610,7 +1600,7 @@ def test_search_organizations_pager(transport_name: str = "grpc"): def test_search_organizations_pages(transport_name: str = "grpc"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1654,7 +1644,7 @@ def test_search_organizations_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_organizations_async_pager(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1706,7 +1696,7 @@ async def test_search_organizations_async_pager(): @pytest.mark.asyncio async def test_search_organizations_async_pages(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1763,7 +1753,7 @@ async def test_search_organizations_async_pages(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1795,7 +1785,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1812,7 +1802,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1849,7 +1839,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1879,7 +1869,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1908,7 +1898,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -1925,7 +1915,7 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1949,7 +1939,7 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1964,7 +1954,7 @@ def test_get_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1991,7 +1981,7 @@ async def test_get_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_error_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2012,7 +2002,7 @@ async def test_get_iam_policy_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2044,7 +2034,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2061,7 +2051,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2098,7 +2088,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2128,7 +2118,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2157,7 +2147,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -2175,7 +2165,7 @@ def test_set_iam_policy_from_dict_foreign(): def test_set_iam_policy_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2199,7 +2189,7 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2214,7 +2204,7 @@ def test_set_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2241,7 +2231,7 @@ async def test_set_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_error_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2262,7 +2252,7 @@ async def test_set_iam_policy_flattened_error_async(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2294,7 +2284,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2314,7 +2304,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2351,7 +2341,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2383,7 +2373,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2416,7 +2406,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2435,7 +2425,7 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2465,7 +2455,7 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2481,7 +2471,7 @@ def test_test_iam_permissions_flattened_error(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2516,7 +2506,7 @@ async def test_test_iam_permissions_flattened_async(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_error_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2538,7 +2528,7 @@ async def test_test_iam_permissions_flattened_error_async(): ) def test_get_organization_rest(request_type): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2596,7 +2586,7 @@ def test_get_organization_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2605,7 +2595,7 @@ def test_get_organization_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2614,7 +2604,7 @@ def test_get_organization_rest_required_fields( assert jsonified_request["name"] == "name_value" client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2656,7 +2646,7 @@ def test_get_organization_rest_required_fields( def test_get_organization_rest_unset_required_fields(): transport = transports.OrganizationsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_organization._get_unset_required_fields({}) @@ -2666,7 +2656,7 @@ def test_get_organization_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_organization_rest_interceptors(null_interceptor): transport = transports.OrganizationsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.OrganizationsRestInterceptor(), @@ -2724,7 +2714,7 @@ def test_get_organization_rest_bad_request( transport: str = "rest", request_type=organizations.GetOrganizationRequest ): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2746,7 +2736,7 @@ def test_get_organization_rest_bad_request( def test_get_organization_rest_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2786,7 +2776,7 @@ def test_get_organization_rest_flattened(): def test_get_organization_rest_flattened_error(transport: str = "rest"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2801,7 +2791,7 @@ def test_get_organization_rest_flattened_error(transport: str = "rest"): def test_get_organization_rest_error(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2814,7 +2804,7 @@ def test_get_organization_rest_error(): ) def test_search_organizations_rest(request_type): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2848,7 +2838,7 @@ def test_search_organizations_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_search_organizations_rest_interceptors(null_interceptor): transport = transports.OrganizationsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.OrganizationsRestInterceptor(), @@ -2906,7 +2896,7 @@ def test_search_organizations_rest_bad_request( transport: str = "rest", request_type=organizations.SearchOrganizationsRequest ): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2928,7 +2918,7 @@ def test_search_organizations_rest_bad_request( def test_search_organizations_rest_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2968,7 +2958,7 @@ def test_search_organizations_rest_flattened(): def test_search_organizations_rest_flattened_error(transport: str = "rest"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2983,7 +2973,7 @@ def test_search_organizations_rest_flattened_error(transport: str = "rest"): def test_search_organizations_rest_pager(transport: str = "rest"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3053,7 +3043,7 @@ def test_search_organizations_rest_pager(transport: str = "rest"): ) def test_get_iam_policy_rest(request_type): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3104,7 +3094,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3113,7 +3103,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3122,7 +3112,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3163,7 +3153,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.OrganizationsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -3173,7 +3163,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.OrganizationsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.OrganizationsRestInterceptor(), @@ -3227,7 +3217,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3249,7 +3239,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3288,7 +3278,7 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3303,7 +3293,7 @@ def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): def test_get_iam_policy_rest_error(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3316,7 +3306,7 @@ def test_get_iam_policy_rest_error(): ) def test_set_iam_policy_rest(request_type): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3367,7 +3357,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3376,7 +3366,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3385,7 +3375,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3426,7 +3416,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.OrganizationsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -3444,7 +3434,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.OrganizationsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.OrganizationsRestInterceptor(), @@ -3498,7 +3488,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3520,7 +3510,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3559,7 +3549,7 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3574,7 +3564,7 @@ def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): def test_set_iam_policy_rest_error(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3587,7 +3577,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3637,7 +3627,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3647,7 +3637,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3658,7 +3648,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3699,7 +3689,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.OrganizationsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -3717,7 +3707,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.OrganizationsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.OrganizationsRestInterceptor(), @@ -3773,7 +3763,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3795,7 +3785,7 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3836,7 +3826,7 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3852,24 +3842,24 @@ def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): def test_test_iam_permissions_rest_error(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.OrganizationsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.OrganizationsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = OrganizationsClient( @@ -3879,7 +3869,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.OrganizationsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -3894,13 +3884,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = OrganizationsClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.OrganizationsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = OrganizationsClient( @@ -3912,7 +3901,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.OrganizationsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = OrganizationsClient(transport=transport) assert client.transport is transport @@ -3921,13 +3910,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.OrganizationsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.OrganizationsGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -3944,7 +3933,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3958,7 +3947,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = OrganizationsClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3966,7 +3955,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3978,7 +3967,7 @@ def test_organizations_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.OrganizationsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3990,7 +3979,7 @@ def test_organizations_base_transport(): ) as Transport: Transport.return_value = None transport = transports.OrganizationsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -4027,7 +4016,7 @@ def test_organizations_base_transport_with_credentials_file(): "google.cloud.resourcemanager_v3.services.organizations.transports.OrganizationsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.OrganizationsTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -4049,7 +4038,7 @@ def test_organizations_base_transport_with_adc(): "google.cloud.resourcemanager_v3.services.organizations.transports.OrganizationsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.OrganizationsTransport() adc.assert_called_once() @@ -4057,7 +4046,7 @@ def test_organizations_base_transport_with_adc(): def test_organizations_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) OrganizationsClient() adc.assert_called_once_with( scopes=None, @@ -4080,7 +4069,7 @@ def test_organizations_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -4130,7 +4119,7 @@ def test_organizations_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -4161,7 +4150,7 @@ def test_organizations_transport_create_channel(transport_class, grpc_helpers): ], ) def test_organizations_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -4199,7 +4188,7 @@ def test_organizations_grpc_transport_client_cert_source_for_mtls(transport_clas def test_organizations_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -4219,7 +4208,7 @@ def test_organizations_http_transport_client_cert_source_for_mtls(): ) def test_organizations_host_no_port(transport_name): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com" ), @@ -4242,7 +4231,7 @@ def test_organizations_host_no_port(transport_name): ) def test_organizations_host_with_port(transport_name): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com:8000" ), @@ -4262,8 +4251,8 @@ def test_organizations_host_with_port(transport_name): ], ) def test_organizations_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = OrganizationsClient( credentials=creds1, transport=transport_name, @@ -4337,7 +4326,7 @@ def test_organizations_transport_channel_mtls_with_client_cert_source(transport_ mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -4543,7 +4532,7 @@ def test_client_with_default_client_info(): transports.OrganizationsTransport, "_prep_wrapped_messages" ) as prep: client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4553,7 +4542,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = OrganizationsClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4562,7 +4551,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -4577,7 +4566,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4605,7 +4594,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "operations/sample1"} @@ -4631,7 +4620,7 @@ def test_get_operation_rest(request_type): def test_get_operation(transport: str = "grpc"): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4656,7 +4645,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4682,7 +4671,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4711,7 +4700,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4740,7 +4729,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4758,7 +4747,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = OrganizationsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4782,7 +4771,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -4799,7 +4788,7 @@ def test_client_ctx(): ] for transport in transports: client = OrganizationsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_projects.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_projects.py index 8098722fd14e..a1d26bdf00f0 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_projects.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_projects.py @@ -93,18 +93,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -303,7 +291,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -330,42 +318,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -376,7 +371,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_projects_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -428,7 +423,7 @@ def test_projects_client_service_account_always_use_jwt( ], ) def test_projects_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -485,9 +480,7 @@ def test_projects_client_get_transport_class(): def test_projects_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(ProjectsClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -880,20 +873,20 @@ def test_projects_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -905,13 +898,11 @@ def test_projects_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -927,8 +918,7 @@ def test_projects_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1065,8 +1055,8 @@ def test_projects_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1098,7 +1088,7 @@ def test_projects_client_create_channel_credentials_file( ) def test_get_project(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1138,7 +1128,7 @@ def test_get_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1155,7 +1145,7 @@ async def test_get_project_async( transport: str = "grpc_asyncio", request_type=projects.GetProjectRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1200,7 +1190,7 @@ async def test_get_project_async_from_dict(): def test_get_project_field_headers(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1230,7 +1220,7 @@ def test_get_project_field_headers(): @pytest.mark.asyncio async def test_get_project_field_headers_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1259,7 +1249,7 @@ async def test_get_project_field_headers_async(): def test_get_project_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1283,7 +1273,7 @@ def test_get_project_flattened(): def test_get_project_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1298,7 +1288,7 @@ def test_get_project_flattened_error(): @pytest.mark.asyncio async def test_get_project_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1325,7 +1315,7 @@ async def test_get_project_flattened_async(): @pytest.mark.asyncio async def test_get_project_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1346,7 +1336,7 @@ async def test_get_project_flattened_error_async(): ) def test_list_projects(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1376,7 +1366,7 @@ def test_list_projects_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1393,7 +1383,7 @@ async def test_list_projects_async( transport: str = "grpc_asyncio", request_type=projects.ListProjectsRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1428,7 +1418,7 @@ async def test_list_projects_async_from_dict(): def test_list_projects_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1452,7 +1442,7 @@ def test_list_projects_flattened(): def test_list_projects_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1467,7 +1457,7 @@ def test_list_projects_flattened_error(): @pytest.mark.asyncio async def test_list_projects_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1496,7 +1486,7 @@ async def test_list_projects_flattened_async(): @pytest.mark.asyncio async def test_list_projects_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1510,7 +1500,7 @@ async def test_list_projects_flattened_error_async(): def test_list_projects_pager(transport_name: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1557,7 +1547,7 @@ def test_list_projects_pager(transport_name: str = "grpc"): def test_list_projects_pages(transport_name: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1599,7 +1589,7 @@ def test_list_projects_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_projects_async_pager(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1649,7 +1639,7 @@ async def test_list_projects_async_pager(): @pytest.mark.asyncio async def test_list_projects_async_pages(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1704,7 +1694,7 @@ async def test_list_projects_async_pages(): ) def test_search_projects(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1734,7 +1724,7 @@ def test_search_projects_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1751,7 +1741,7 @@ async def test_search_projects_async( transport: str = "grpc_asyncio", request_type=projects.SearchProjectsRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1786,7 +1776,7 @@ async def test_search_projects_async_from_dict(): def test_search_projects_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1810,7 +1800,7 @@ def test_search_projects_flattened(): def test_search_projects_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1825,7 +1815,7 @@ def test_search_projects_flattened_error(): @pytest.mark.asyncio async def test_search_projects_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1854,7 +1844,7 @@ async def test_search_projects_flattened_async(): @pytest.mark.asyncio async def test_search_projects_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1868,7 +1858,7 @@ async def test_search_projects_flattened_error_async(): def test_search_projects_pager(transport_name: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1915,7 +1905,7 @@ def test_search_projects_pager(transport_name: str = "grpc"): def test_search_projects_pages(transport_name: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1957,7 +1947,7 @@ def test_search_projects_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_projects_async_pager(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2007,7 +1997,7 @@ async def test_search_projects_async_pager(): @pytest.mark.asyncio async def test_search_projects_async_pages(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2062,7 +2052,7 @@ async def test_search_projects_async_pages(): ) def test_create_project(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2089,7 +2079,7 @@ def test_create_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2106,7 +2096,7 @@ async def test_create_project_async( transport: str = "grpc_asyncio", request_type=projects.CreateProjectRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2138,7 +2128,7 @@ async def test_create_project_async_from_dict(): def test_create_project_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2162,7 +2152,7 @@ def test_create_project_flattened(): def test_create_project_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2177,7 +2167,7 @@ def test_create_project_flattened_error(): @pytest.mark.asyncio async def test_create_project_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2206,7 +2196,7 @@ async def test_create_project_flattened_async(): @pytest.mark.asyncio async def test_create_project_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2227,7 +2217,7 @@ async def test_create_project_flattened_error_async(): ) def test_update_project(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2254,7 +2244,7 @@ def test_update_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2271,7 +2261,7 @@ async def test_update_project_async( transport: str = "grpc_asyncio", request_type=projects.UpdateProjectRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2303,7 +2293,7 @@ async def test_update_project_async_from_dict(): def test_update_project_field_headers(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2333,7 +2323,7 @@ def test_update_project_field_headers(): @pytest.mark.asyncio async def test_update_project_field_headers_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2364,7 +2354,7 @@ async def test_update_project_field_headers_async(): def test_update_project_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2392,7 +2382,7 @@ def test_update_project_flattened(): def test_update_project_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2408,7 +2398,7 @@ def test_update_project_flattened_error(): @pytest.mark.asyncio async def test_update_project_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2441,7 +2431,7 @@ async def test_update_project_flattened_async(): @pytest.mark.asyncio async def test_update_project_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2463,7 +2453,7 @@ async def test_update_project_flattened_error_async(): ) def test_move_project(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2490,7 +2480,7 @@ def test_move_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2507,7 +2497,7 @@ async def test_move_project_async( transport: str = "grpc_asyncio", request_type=projects.MoveProjectRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2539,7 +2529,7 @@ async def test_move_project_async_from_dict(): def test_move_project_field_headers(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2569,7 +2559,7 @@ def test_move_project_field_headers(): @pytest.mark.asyncio async def test_move_project_field_headers_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2600,7 +2590,7 @@ async def test_move_project_field_headers_async(): def test_move_project_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2628,7 +2618,7 @@ def test_move_project_flattened(): def test_move_project_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2644,7 +2634,7 @@ def test_move_project_flattened_error(): @pytest.mark.asyncio async def test_move_project_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2677,7 +2667,7 @@ async def test_move_project_flattened_async(): @pytest.mark.asyncio async def test_move_project_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2699,7 +2689,7 @@ async def test_move_project_flattened_error_async(): ) def test_delete_project(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2726,7 +2716,7 @@ def test_delete_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2743,7 +2733,7 @@ async def test_delete_project_async( transport: str = "grpc_asyncio", request_type=projects.DeleteProjectRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2775,7 +2765,7 @@ async def test_delete_project_async_from_dict(): def test_delete_project_field_headers(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2805,7 +2795,7 @@ def test_delete_project_field_headers(): @pytest.mark.asyncio async def test_delete_project_field_headers_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2836,7 +2826,7 @@ async def test_delete_project_field_headers_async(): def test_delete_project_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2860,7 +2850,7 @@ def test_delete_project_flattened(): def test_delete_project_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2875,7 +2865,7 @@ def test_delete_project_flattened_error(): @pytest.mark.asyncio async def test_delete_project_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2904,7 +2894,7 @@ async def test_delete_project_flattened_async(): @pytest.mark.asyncio async def test_delete_project_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2925,7 +2915,7 @@ async def test_delete_project_flattened_error_async(): ) def test_undelete_project(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2952,7 +2942,7 @@ def test_undelete_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2969,7 +2959,7 @@ async def test_undelete_project_async( transport: str = "grpc_asyncio", request_type=projects.UndeleteProjectRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3001,7 +2991,7 @@ async def test_undelete_project_async_from_dict(): def test_undelete_project_field_headers(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3031,7 +3021,7 @@ def test_undelete_project_field_headers(): @pytest.mark.asyncio async def test_undelete_project_field_headers_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3062,7 +3052,7 @@ async def test_undelete_project_field_headers_async(): def test_undelete_project_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3086,7 +3076,7 @@ def test_undelete_project_flattened(): def test_undelete_project_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3101,7 +3091,7 @@ def test_undelete_project_flattened_error(): @pytest.mark.asyncio async def test_undelete_project_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3130,7 +3120,7 @@ async def test_undelete_project_flattened_async(): @pytest.mark.asyncio async def test_undelete_project_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3151,7 +3141,7 @@ async def test_undelete_project_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3183,7 +3173,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3200,7 +3190,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3237,7 +3227,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3267,7 +3257,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3296,7 +3286,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -3313,7 +3303,7 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3337,7 +3327,7 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3352,7 +3342,7 @@ def test_get_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3379,7 +3369,7 @@ async def test_get_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3400,7 +3390,7 @@ async def test_get_iam_policy_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3432,7 +3422,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3449,7 +3439,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3486,7 +3476,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3516,7 +3506,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3545,7 +3535,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -3563,7 +3553,7 @@ def test_set_iam_policy_from_dict_foreign(): def test_set_iam_policy_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3587,7 +3577,7 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3602,7 +3592,7 @@ def test_set_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3629,7 +3619,7 @@ async def test_set_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3650,7 +3640,7 @@ async def test_set_iam_policy_flattened_error_async(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3682,7 +3672,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3702,7 +3692,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3739,7 +3729,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3771,7 +3761,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3804,7 +3794,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3823,7 +3813,7 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3853,7 +3843,7 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3869,7 +3859,7 @@ def test_test_iam_permissions_flattened_error(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3904,7 +3894,7 @@ async def test_test_iam_permissions_flattened_async(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_error_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3926,7 +3916,7 @@ async def test_test_iam_permissions_flattened_error_async(): ) def test_get_project_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3985,7 +3975,7 @@ def test_get_project_rest_required_fields(request_type=projects.GetProjectReques # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3994,7 +3984,7 @@ def test_get_project_rest_required_fields(request_type=projects.GetProjectReques jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4003,7 +3993,7 @@ def test_get_project_rest_required_fields(request_type=projects.GetProjectReques assert jsonified_request["name"] == "name_value" client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4045,7 +4035,7 @@ def test_get_project_rest_required_fields(request_type=projects.GetProjectReques def test_get_project_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_project._get_unset_required_fields({}) @@ -4055,7 +4045,7 @@ def test_get_project_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_project_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -4107,7 +4097,7 @@ def test_get_project_rest_bad_request( transport: str = "rest", request_type=projects.GetProjectRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4129,7 +4119,7 @@ def test_get_project_rest_bad_request( def test_get_project_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4169,7 +4159,7 @@ def test_get_project_rest_flattened(): def test_get_project_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4184,7 +4174,7 @@ def test_get_project_rest_flattened_error(transport: str = "rest"): def test_get_project_rest_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4197,7 +4187,7 @@ def test_get_project_rest_error(): ) def test_list_projects_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4247,7 +4237,7 @@ def test_list_projects_rest_required_fields(request_type=projects.ListProjectsRe assert "parent" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_projects._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4258,7 +4248,7 @@ def test_list_projects_rest_required_fields(request_type=projects.ListProjectsRe jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_projects._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4276,7 +4266,7 @@ def test_list_projects_rest_required_fields(request_type=projects.ListProjectsRe assert jsonified_request["parent"] == "parent_value" client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4324,7 +4314,7 @@ def test_list_projects_rest_required_fields(request_type=projects.ListProjectsRe def test_list_projects_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_projects._get_unset_required_fields({}) @@ -4344,7 +4334,7 @@ def test_list_projects_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_projects_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -4398,7 +4388,7 @@ def test_list_projects_rest_bad_request( transport: str = "rest", request_type=projects.ListProjectsRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4420,7 +4410,7 @@ def test_list_projects_rest_bad_request( def test_list_projects_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4460,7 +4450,7 @@ def test_list_projects_rest_flattened(): def test_list_projects_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4475,7 +4465,7 @@ def test_list_projects_rest_flattened_error(transport: str = "rest"): def test_list_projects_rest_pager(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4543,7 +4533,7 @@ def test_list_projects_rest_pager(transport: str = "rest"): ) def test_search_projects_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4577,7 +4567,7 @@ def test_search_projects_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_search_projects_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -4631,7 +4621,7 @@ def test_search_projects_rest_bad_request( transport: str = "rest", request_type=projects.SearchProjectsRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4653,7 +4643,7 @@ def test_search_projects_rest_bad_request( def test_search_projects_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4693,7 +4683,7 @@ def test_search_projects_rest_flattened(): def test_search_projects_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4708,7 +4698,7 @@ def test_search_projects_rest_flattened_error(transport: str = "rest"): def test_search_projects_rest_pager(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4776,7 +4766,7 @@ def test_search_projects_rest_pager(transport: str = "rest"): ) def test_create_project_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4900,21 +4890,21 @@ def test_create_project_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4954,7 +4944,7 @@ def test_create_project_rest_required_fields( def test_create_project_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_project._get_unset_required_fields({}) @@ -4964,7 +4954,7 @@ def test_create_project_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_project_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -5020,7 +5010,7 @@ def test_create_project_rest_bad_request( transport: str = "rest", request_type=projects.CreateProjectRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5042,7 +5032,7 @@ def test_create_project_rest_bad_request( def test_create_project_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5080,7 +5070,7 @@ def test_create_project_rest_flattened(): def test_create_project_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5095,7 +5085,7 @@ def test_create_project_rest_flattened_error(transport: str = "rest"): def test_create_project_rest_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5108,7 +5098,7 @@ def test_create_project_rest_error(): ) def test_update_project_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5232,14 +5222,14 @@ def test_update_project_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_project._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5248,7 +5238,7 @@ def test_update_project_rest_required_fields( # verify required fields with non-default values are left alone client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5288,7 +5278,7 @@ def test_update_project_rest_required_fields( def test_update_project_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_project._get_unset_required_fields({}) @@ -5298,7 +5288,7 @@ def test_update_project_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_project_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -5354,7 +5344,7 @@ def test_update_project_rest_bad_request( transport: str = "rest", request_type=projects.UpdateProjectRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5376,7 +5366,7 @@ def test_update_project_rest_bad_request( def test_update_project_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5415,7 +5405,7 @@ def test_update_project_rest_flattened(): def test_update_project_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5431,7 +5421,7 @@ def test_update_project_rest_flattened_error(transport: str = "rest"): def test_update_project_rest_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5444,7 +5434,7 @@ def test_update_project_rest_error(): ) def test_move_project_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5489,7 +5479,7 @@ def test_move_project_rest_required_fields(request_type=projects.MoveProjectRequ # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).move_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5499,7 +5489,7 @@ def test_move_project_rest_required_fields(request_type=projects.MoveProjectRequ jsonified_request["destinationParent"] = "destination_parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).move_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5510,7 +5500,7 @@ def test_move_project_rest_required_fields(request_type=projects.MoveProjectRequ assert jsonified_request["destinationParent"] == "destination_parent_value" client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5550,7 +5540,7 @@ def test_move_project_rest_required_fields(request_type=projects.MoveProjectRequ def test_move_project_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.move_project._get_unset_required_fields({}) @@ -5568,7 +5558,7 @@ def test_move_project_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_move_project_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -5624,7 +5614,7 @@ def test_move_project_rest_bad_request( transport: str = "rest", request_type=projects.MoveProjectRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5646,7 +5636,7 @@ def test_move_project_rest_bad_request( def test_move_project_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5685,7 +5675,7 @@ def test_move_project_rest_flattened(): def test_move_project_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5701,7 +5691,7 @@ def test_move_project_rest_flattened_error(transport: str = "rest"): def test_move_project_rest_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5714,7 +5704,7 @@ def test_move_project_rest_error(): ) def test_delete_project_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5760,7 +5750,7 @@ def test_delete_project_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5769,7 +5759,7 @@ def test_delete_project_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5778,7 +5768,7 @@ def test_delete_project_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5817,7 +5807,7 @@ def test_delete_project_rest_required_fields( def test_delete_project_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_project._get_unset_required_fields({}) @@ -5827,7 +5817,7 @@ def test_delete_project_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_project_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -5883,7 +5873,7 @@ def test_delete_project_rest_bad_request( transport: str = "rest", request_type=projects.DeleteProjectRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5905,7 +5895,7 @@ def test_delete_project_rest_bad_request( def test_delete_project_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5943,7 +5933,7 @@ def test_delete_project_rest_flattened(): def test_delete_project_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5958,7 +5948,7 @@ def test_delete_project_rest_flattened_error(transport: str = "rest"): def test_delete_project_rest_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5971,7 +5961,7 @@ def test_delete_project_rest_error(): ) def test_undelete_project_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6017,7 +6007,7 @@ def test_undelete_project_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6026,7 +6016,7 @@ def test_undelete_project_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_project._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6035,7 +6025,7 @@ def test_undelete_project_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6075,7 +6065,7 @@ def test_undelete_project_rest_required_fields( def test_undelete_project_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.undelete_project._get_unset_required_fields({}) @@ -6085,7 +6075,7 @@ def test_undelete_project_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_undelete_project_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -6143,7 +6133,7 @@ def test_undelete_project_rest_bad_request( transport: str = "rest", request_type=projects.UndeleteProjectRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6165,7 +6155,7 @@ def test_undelete_project_rest_bad_request( def test_undelete_project_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6203,7 +6193,7 @@ def test_undelete_project_rest_flattened(): def test_undelete_project_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6218,7 +6208,7 @@ def test_undelete_project_rest_flattened_error(transport: str = "rest"): def test_undelete_project_rest_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6231,7 +6221,7 @@ def test_undelete_project_rest_error(): ) def test_get_iam_policy_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6282,7 +6272,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6291,7 +6281,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6300,7 +6290,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6341,7 +6331,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -6351,7 +6341,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -6403,7 +6393,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6425,7 +6415,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6463,7 +6453,7 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6478,7 +6468,7 @@ def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): def test_get_iam_policy_rest_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6491,7 +6481,7 @@ def test_get_iam_policy_rest_error(): ) def test_set_iam_policy_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6542,7 +6532,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6551,7 +6541,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6560,7 +6550,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6601,7 +6591,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -6619,7 +6609,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -6671,7 +6661,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6693,7 +6683,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6731,7 +6721,7 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6746,7 +6736,7 @@ def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): def test_set_iam_policy_rest_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6759,7 +6749,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6809,7 +6799,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6819,7 +6809,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6830,7 +6820,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6871,7 +6861,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -6889,7 +6879,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.ProjectsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProjectsRestInterceptor(), ) client = ProjectsClient(transport=transport) @@ -6943,7 +6933,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6965,7 +6955,7 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7005,7 +6995,7 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7021,24 +7011,24 @@ def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): def test_test_iam_permissions_rest_error(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ProjectsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ProjectsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProjectsClient( @@ -7048,7 +7038,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ProjectsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7063,13 +7053,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ProjectsClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ProjectsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProjectsClient( @@ -7081,7 +7070,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ProjectsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ProjectsClient(transport=transport) assert client.transport is transport @@ -7090,13 +7079,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ProjectsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ProjectsGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7113,7 +7102,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7127,7 +7116,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ProjectsClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7135,7 +7124,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7147,7 +7136,7 @@ def test_projects_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ProjectsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7159,7 +7148,7 @@ def test_projects_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ProjectsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7207,7 +7196,7 @@ def test_projects_base_transport_with_credentials_file(): "google.cloud.resourcemanager_v3.services.projects.transports.ProjectsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProjectsTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7229,7 +7218,7 @@ def test_projects_base_transport_with_adc(): "google.cloud.resourcemanager_v3.services.projects.transports.ProjectsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProjectsTransport() adc.assert_called_once() @@ -7237,7 +7226,7 @@ def test_projects_base_transport_with_adc(): def test_projects_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ProjectsClient() adc.assert_called_once_with( scopes=None, @@ -7260,7 +7249,7 @@ def test_projects_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7310,7 +7299,7 @@ def test_projects_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7338,7 +7327,7 @@ def test_projects_transport_create_channel(transport_class, grpc_helpers): [transports.ProjectsGrpcTransport, transports.ProjectsGrpcAsyncIOTransport], ) def test_projects_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7376,7 +7365,7 @@ def test_projects_grpc_transport_client_cert_source_for_mtls(transport_class): def test_projects_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7388,7 +7377,7 @@ def test_projects_http_transport_client_cert_source_for_mtls(): def test_projects_rest_lro_client(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -7413,7 +7402,7 @@ def test_projects_rest_lro_client(): ) def test_projects_host_no_port(transport_name): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com" ), @@ -7436,7 +7425,7 @@ def test_projects_host_no_port(transport_name): ) def test_projects_host_with_port(transport_name): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com:8000" ), @@ -7456,8 +7445,8 @@ def test_projects_host_with_port(transport_name): ], ) def test_projects_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ProjectsClient( credentials=creds1, transport=transport_name, @@ -7546,7 +7535,7 @@ def test_projects_transport_channel_mtls_with_client_cert_source(transport_class mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -7621,7 +7610,7 @@ def test_projects_transport_channel_mtls_with_adc(transport_class): def test_projects_grpc_lro_client(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -7638,7 +7627,7 @@ def test_projects_grpc_lro_client(): def test_projects_grpc_lro_async_client(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -7783,7 +7772,7 @@ def test_client_with_default_client_info(): transports.ProjectsTransport, "_prep_wrapped_messages" ) as prep: client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7793,7 +7782,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ProjectsClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7802,7 +7791,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -7817,7 +7806,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7845,7 +7834,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "operations/sample1"} @@ -7871,7 +7860,7 @@ def test_get_operation_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7896,7 +7885,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7922,7 +7911,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7951,7 +7940,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7980,7 +7969,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7998,7 +7987,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ProjectsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8022,7 +8011,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8039,7 +8028,7 @@ def test_client_ctx(): ] for transport in transports: client = ProjectsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_bindings.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_bindings.py index bfb47b84a557..e790dcf96bd1 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_bindings.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_bindings.py @@ -88,18 +88,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -307,7 +295,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -334,42 +322,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -380,7 +375,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_tag_bindings_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -432,7 +427,7 @@ def test_tag_bindings_client_service_account_always_use_jwt( ], ) def test_tag_bindings_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -495,9 +490,7 @@ def test_tag_bindings_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(TagBindingsClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -890,20 +883,20 @@ def test_tag_bindings_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -915,13 +908,11 @@ def test_tag_bindings_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -937,8 +928,7 @@ def test_tag_bindings_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1079,8 +1069,8 @@ def test_tag_bindings_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1112,7 +1102,7 @@ def test_tag_bindings_client_create_channel_credentials_file( ) def test_list_tag_bindings(request_type, transport: str = "grpc"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1144,7 +1134,7 @@ def test_list_tag_bindings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1163,7 +1153,7 @@ async def test_list_tag_bindings_async( transport: str = "grpc_asyncio", request_type=tag_bindings.ListTagBindingsRequest ): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1200,7 +1190,7 @@ async def test_list_tag_bindings_async_from_dict(): def test_list_tag_bindings_flattened(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1226,7 +1216,7 @@ def test_list_tag_bindings_flattened(): def test_list_tag_bindings_flattened_error(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1241,7 +1231,7 @@ def test_list_tag_bindings_flattened_error(): @pytest.mark.asyncio async def test_list_tag_bindings_flattened_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1272,7 +1262,7 @@ async def test_list_tag_bindings_flattened_async(): @pytest.mark.asyncio async def test_list_tag_bindings_flattened_error_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1286,7 +1276,7 @@ async def test_list_tag_bindings_flattened_error_async(): def test_list_tag_bindings_pager(transport_name: str = "grpc"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1335,7 +1325,7 @@ def test_list_tag_bindings_pager(transport_name: str = "grpc"): def test_list_tag_bindings_pages(transport_name: str = "grpc"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1379,7 +1369,7 @@ def test_list_tag_bindings_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_tag_bindings_async_pager(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1431,7 +1421,7 @@ async def test_list_tag_bindings_async_pager(): @pytest.mark.asyncio async def test_list_tag_bindings_async_pages(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1488,7 +1478,7 @@ async def test_list_tag_bindings_async_pages(): ) def test_create_tag_binding(request_type, transport: str = "grpc"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1517,7 +1507,7 @@ def test_create_tag_binding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1536,7 +1526,7 @@ async def test_create_tag_binding_async( transport: str = "grpc_asyncio", request_type=tag_bindings.CreateTagBindingRequest ): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1570,7 +1560,7 @@ async def test_create_tag_binding_async_from_dict(): def test_create_tag_binding_flattened(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1596,7 +1586,7 @@ def test_create_tag_binding_flattened(): def test_create_tag_binding_flattened_error(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1611,7 +1601,7 @@ def test_create_tag_binding_flattened_error(): @pytest.mark.asyncio async def test_create_tag_binding_flattened_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1642,7 +1632,7 @@ async def test_create_tag_binding_flattened_async(): @pytest.mark.asyncio async def test_create_tag_binding_flattened_error_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1663,7 +1653,7 @@ async def test_create_tag_binding_flattened_error_async(): ) def test_delete_tag_binding(request_type, transport: str = "grpc"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1692,7 +1682,7 @@ def test_delete_tag_binding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1711,7 +1701,7 @@ async def test_delete_tag_binding_async( transport: str = "grpc_asyncio", request_type=tag_bindings.DeleteTagBindingRequest ): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1745,7 +1735,7 @@ async def test_delete_tag_binding_async_from_dict(): def test_delete_tag_binding_field_headers(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1777,7 +1767,7 @@ def test_delete_tag_binding_field_headers(): @pytest.mark.asyncio async def test_delete_tag_binding_field_headers_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1810,7 +1800,7 @@ async def test_delete_tag_binding_field_headers_async(): def test_delete_tag_binding_flattened(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1836,7 +1826,7 @@ def test_delete_tag_binding_flattened(): def test_delete_tag_binding_flattened_error(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1851,7 +1841,7 @@ def test_delete_tag_binding_flattened_error(): @pytest.mark.asyncio async def test_delete_tag_binding_flattened_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1882,7 +1872,7 @@ async def test_delete_tag_binding_flattened_async(): @pytest.mark.asyncio async def test_delete_tag_binding_flattened_error_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1903,7 +1893,7 @@ async def test_delete_tag_binding_flattened_error_async(): ) def test_list_effective_tags(request_type, transport: str = "grpc"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1935,7 +1925,7 @@ def test_list_effective_tags_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1954,7 +1944,7 @@ async def test_list_effective_tags_async( transport: str = "grpc_asyncio", request_type=tag_bindings.ListEffectiveTagsRequest ): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1991,7 +1981,7 @@ async def test_list_effective_tags_async_from_dict(): def test_list_effective_tags_flattened(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2017,7 +2007,7 @@ def test_list_effective_tags_flattened(): def test_list_effective_tags_flattened_error(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2032,7 +2022,7 @@ def test_list_effective_tags_flattened_error(): @pytest.mark.asyncio async def test_list_effective_tags_flattened_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2063,7 +2053,7 @@ async def test_list_effective_tags_flattened_async(): @pytest.mark.asyncio async def test_list_effective_tags_flattened_error_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2077,7 +2067,7 @@ async def test_list_effective_tags_flattened_error_async(): def test_list_effective_tags_pager(transport_name: str = "grpc"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2126,7 +2116,7 @@ def test_list_effective_tags_pager(transport_name: str = "grpc"): def test_list_effective_tags_pages(transport_name: str = "grpc"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2170,7 +2160,7 @@ def test_list_effective_tags_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_effective_tags_async_pager(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2222,7 +2212,7 @@ async def test_list_effective_tags_async_pager(): @pytest.mark.asyncio async def test_list_effective_tags_async_pages(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2279,7 +2269,7 @@ async def test_list_effective_tags_async_pages(): ) def test_list_tag_bindings_rest(request_type): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2331,7 +2321,7 @@ def test_list_tag_bindings_rest_required_fields( assert "parent" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tag_bindings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2342,7 +2332,7 @@ def test_list_tag_bindings_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tag_bindings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2359,7 +2349,7 @@ def test_list_tag_bindings_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2407,7 +2397,7 @@ def test_list_tag_bindings_rest_required_fields( def test_list_tag_bindings_rest_unset_required_fields(): transport = transports.TagBindingsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_tag_bindings._get_unset_required_fields({}) @@ -2426,7 +2416,7 @@ def test_list_tag_bindings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_tag_bindings_rest_interceptors(null_interceptor): transport = transports.TagBindingsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagBindingsRestInterceptor(), @@ -2484,7 +2474,7 @@ def test_list_tag_bindings_rest_bad_request( transport: str = "rest", request_type=tag_bindings.ListTagBindingsRequest ): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2506,7 +2496,7 @@ def test_list_tag_bindings_rest_bad_request( def test_list_tag_bindings_rest_flattened(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2546,7 +2536,7 @@ def test_list_tag_bindings_rest_flattened(): def test_list_tag_bindings_rest_flattened_error(transport: str = "rest"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2561,7 +2551,7 @@ def test_list_tag_bindings_rest_flattened_error(transport: str = "rest"): def test_list_tag_bindings_rest_pager(transport: str = "rest"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2631,7 +2621,7 @@ def test_list_tag_bindings_rest_pager(transport: str = "rest"): ) def test_create_tag_binding_rest(request_type): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2749,14 +2739,14 @@ def test_create_tag_binding_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_tag_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_tag_binding._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("validate_only",)) @@ -2765,7 +2755,7 @@ def test_create_tag_binding_rest_required_fields( # verify required fields with non-default values are left alone client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2805,7 +2795,7 @@ def test_create_tag_binding_rest_required_fields( def test_create_tag_binding_rest_unset_required_fields(): transport = transports.TagBindingsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_tag_binding._get_unset_required_fields({}) @@ -2815,7 +2805,7 @@ def test_create_tag_binding_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_tag_binding_rest_interceptors(null_interceptor): transport = transports.TagBindingsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagBindingsRestInterceptor(), @@ -2875,7 +2865,7 @@ def test_create_tag_binding_rest_bad_request( transport: str = "rest", request_type=tag_bindings.CreateTagBindingRequest ): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2897,7 +2887,7 @@ def test_create_tag_binding_rest_bad_request( def test_create_tag_binding_rest_flattened(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2935,7 +2925,7 @@ def test_create_tag_binding_rest_flattened(): def test_create_tag_binding_rest_flattened_error(transport: str = "rest"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2950,7 +2940,7 @@ def test_create_tag_binding_rest_flattened_error(transport: str = "rest"): def test_create_tag_binding_rest_error(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2963,7 +2953,7 @@ def test_create_tag_binding_rest_error(): ) def test_delete_tag_binding_rest(request_type): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3009,7 +2999,7 @@ def test_delete_tag_binding_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_tag_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3018,7 +3008,7 @@ def test_delete_tag_binding_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_tag_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3027,7 +3017,7 @@ def test_delete_tag_binding_rest_required_fields( assert jsonified_request["name"] == "name_value" client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3066,7 +3056,7 @@ def test_delete_tag_binding_rest_required_fields( def test_delete_tag_binding_rest_unset_required_fields(): transport = transports.TagBindingsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_tag_binding._get_unset_required_fields({}) @@ -3076,7 +3066,7 @@ def test_delete_tag_binding_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_tag_binding_rest_interceptors(null_interceptor): transport = transports.TagBindingsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagBindingsRestInterceptor(), @@ -3136,7 +3126,7 @@ def test_delete_tag_binding_rest_bad_request( transport: str = "rest", request_type=tag_bindings.DeleteTagBindingRequest ): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3158,7 +3148,7 @@ def test_delete_tag_binding_rest_bad_request( def test_delete_tag_binding_rest_flattened(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3196,7 +3186,7 @@ def test_delete_tag_binding_rest_flattened(): def test_delete_tag_binding_rest_flattened_error(transport: str = "rest"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3211,7 +3201,7 @@ def test_delete_tag_binding_rest_flattened_error(transport: str = "rest"): def test_delete_tag_binding_rest_error(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3224,7 +3214,7 @@ def test_delete_tag_binding_rest_error(): ) def test_list_effective_tags_rest(request_type): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3276,7 +3266,7 @@ def test_list_effective_tags_rest_required_fields( assert "parent" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_effective_tags._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3287,7 +3277,7 @@ def test_list_effective_tags_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_effective_tags._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3304,7 +3294,7 @@ def test_list_effective_tags_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3352,7 +3342,7 @@ def test_list_effective_tags_rest_required_fields( def test_list_effective_tags_rest_unset_required_fields(): transport = transports.TagBindingsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_effective_tags._get_unset_required_fields({}) @@ -3371,7 +3361,7 @@ def test_list_effective_tags_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_effective_tags_rest_interceptors(null_interceptor): transport = transports.TagBindingsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagBindingsRestInterceptor(), @@ -3429,7 +3419,7 @@ def test_list_effective_tags_rest_bad_request( transport: str = "rest", request_type=tag_bindings.ListEffectiveTagsRequest ): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3451,7 +3441,7 @@ def test_list_effective_tags_rest_bad_request( def test_list_effective_tags_rest_flattened(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3491,7 +3481,7 @@ def test_list_effective_tags_rest_flattened(): def test_list_effective_tags_rest_flattened_error(transport: str = "rest"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3506,7 +3496,7 @@ def test_list_effective_tags_rest_flattened_error(transport: str = "rest"): def test_list_effective_tags_rest_pager(transport: str = "rest"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3570,17 +3560,17 @@ def test_list_effective_tags_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.TagBindingsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.TagBindingsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagBindingsClient( @@ -3590,7 +3580,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.TagBindingsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -3605,13 +3595,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = TagBindingsClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.TagBindingsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagBindingsClient( @@ -3623,7 +3612,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.TagBindingsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = TagBindingsClient(transport=transport) assert client.transport is transport @@ -3632,13 +3621,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.TagBindingsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.TagBindingsGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -3655,7 +3644,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3669,7 +3658,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = TagBindingsClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3677,7 +3666,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3689,7 +3678,7 @@ def test_tag_bindings_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.TagBindingsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3701,7 +3690,7 @@ def test_tag_bindings_base_transport(): ) as Transport: Transport.return_value = None transport = transports.TagBindingsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3742,7 +3731,7 @@ def test_tag_bindings_base_transport_with_credentials_file(): "google.cloud.resourcemanager_v3.services.tag_bindings.transports.TagBindingsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TagBindingsTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3764,7 +3753,7 @@ def test_tag_bindings_base_transport_with_adc(): "google.cloud.resourcemanager_v3.services.tag_bindings.transports.TagBindingsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TagBindingsTransport() adc.assert_called_once() @@ -3772,7 +3761,7 @@ def test_tag_bindings_base_transport_with_adc(): def test_tag_bindings_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) TagBindingsClient() adc.assert_called_once_with( scopes=None, @@ -3795,7 +3784,7 @@ def test_tag_bindings_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3845,7 +3834,7 @@ def test_tag_bindings_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3873,7 +3862,7 @@ def test_tag_bindings_transport_create_channel(transport_class, grpc_helpers): [transports.TagBindingsGrpcTransport, transports.TagBindingsGrpcAsyncIOTransport], ) def test_tag_bindings_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3911,7 +3900,7 @@ def test_tag_bindings_grpc_transport_client_cert_source_for_mtls(transport_class def test_tag_bindings_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3923,7 +3912,7 @@ def test_tag_bindings_http_transport_client_cert_source_for_mtls(): def test_tag_bindings_rest_lro_client(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3948,7 +3937,7 @@ def test_tag_bindings_rest_lro_client(): ) def test_tag_bindings_host_no_port(transport_name): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com" ), @@ -3971,7 +3960,7 @@ def test_tag_bindings_host_no_port(transport_name): ) def test_tag_bindings_host_with_port(transport_name): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com:8000" ), @@ -3991,8 +3980,8 @@ def test_tag_bindings_host_with_port(transport_name): ], ) def test_tag_bindings_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = TagBindingsClient( credentials=creds1, transport=transport_name, @@ -4060,7 +4049,7 @@ def test_tag_bindings_transport_channel_mtls_with_client_cert_source(transport_c mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -4135,7 +4124,7 @@ def test_tag_bindings_transport_channel_mtls_with_adc(transport_class): def test_tag_bindings_grpc_lro_client(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -4152,7 +4141,7 @@ def test_tag_bindings_grpc_lro_client(): def test_tag_bindings_grpc_lro_async_client(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -4337,7 +4326,7 @@ def test_client_with_default_client_info(): transports.TagBindingsTransport, "_prep_wrapped_messages" ) as prep: client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4347,7 +4336,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TagBindingsClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4356,7 +4345,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -4371,7 +4360,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4399,7 +4388,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "operations/sample1"} @@ -4425,7 +4414,7 @@ def test_get_operation_rest(request_type): def test_get_operation(transport: str = "grpc"): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4450,7 +4439,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4476,7 +4465,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4505,7 +4494,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4534,7 +4523,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4552,7 +4541,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = TagBindingsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4576,7 +4565,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -4593,7 +4582,7 @@ def test_client_ctx(): ] for transport in transports: client = TagBindingsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_holds.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_holds.py index 5992a58af556..458f69890aef 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_holds.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_holds.py @@ -89,18 +89,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -299,7 +287,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -326,42 +314,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -372,7 +367,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_tag_holds_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -424,7 +419,7 @@ def test_tag_holds_client_service_account_always_use_jwt( ], ) def test_tag_holds_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -481,9 +476,7 @@ def test_tag_holds_client_get_transport_class(): def test_tag_holds_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(TagHoldsClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -876,20 +869,20 @@ def test_tag_holds_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -901,13 +894,11 @@ def test_tag_holds_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -923,8 +914,7 @@ def test_tag_holds_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1061,8 +1051,8 @@ def test_tag_holds_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1094,7 +1084,7 @@ def test_tag_holds_client_create_channel_credentials_file( ) def test_create_tag_hold(request_type, transport: str = "grpc"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1121,7 +1111,7 @@ def test_create_tag_hold_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1138,7 +1128,7 @@ async def test_create_tag_hold_async( transport: str = "grpc_asyncio", request_type=tag_holds.CreateTagHoldRequest ): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1170,7 +1160,7 @@ async def test_create_tag_hold_async_from_dict(): def test_create_tag_hold_field_headers(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1200,7 +1190,7 @@ def test_create_tag_hold_field_headers(): @pytest.mark.asyncio async def test_create_tag_hold_field_headers_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1231,7 +1221,7 @@ async def test_create_tag_hold_field_headers_async(): def test_create_tag_hold_flattened(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1259,7 +1249,7 @@ def test_create_tag_hold_flattened(): def test_create_tag_hold_flattened_error(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1275,7 +1265,7 @@ def test_create_tag_hold_flattened_error(): @pytest.mark.asyncio async def test_create_tag_hold_flattened_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1308,7 +1298,7 @@ async def test_create_tag_hold_flattened_async(): @pytest.mark.asyncio async def test_create_tag_hold_flattened_error_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1330,7 +1320,7 @@ async def test_create_tag_hold_flattened_error_async(): ) def test_delete_tag_hold(request_type, transport: str = "grpc"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1357,7 +1347,7 @@ def test_delete_tag_hold_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1374,7 +1364,7 @@ async def test_delete_tag_hold_async( transport: str = "grpc_asyncio", request_type=tag_holds.DeleteTagHoldRequest ): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1406,7 +1396,7 @@ async def test_delete_tag_hold_async_from_dict(): def test_delete_tag_hold_field_headers(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1436,7 +1426,7 @@ def test_delete_tag_hold_field_headers(): @pytest.mark.asyncio async def test_delete_tag_hold_field_headers_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1467,7 +1457,7 @@ async def test_delete_tag_hold_field_headers_async(): def test_delete_tag_hold_flattened(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1491,7 +1481,7 @@ def test_delete_tag_hold_flattened(): def test_delete_tag_hold_flattened_error(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1506,7 +1496,7 @@ def test_delete_tag_hold_flattened_error(): @pytest.mark.asyncio async def test_delete_tag_hold_flattened_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1535,7 +1525,7 @@ async def test_delete_tag_hold_flattened_async(): @pytest.mark.asyncio async def test_delete_tag_hold_flattened_error_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1556,7 +1546,7 @@ async def test_delete_tag_hold_flattened_error_async(): ) def test_list_tag_holds(request_type, transport: str = "grpc"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1586,7 +1576,7 @@ def test_list_tag_holds_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1603,7 +1593,7 @@ async def test_list_tag_holds_async( transport: str = "grpc_asyncio", request_type=tag_holds.ListTagHoldsRequest ): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1638,7 +1628,7 @@ async def test_list_tag_holds_async_from_dict(): def test_list_tag_holds_field_headers(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1668,7 +1658,7 @@ def test_list_tag_holds_field_headers(): @pytest.mark.asyncio async def test_list_tag_holds_field_headers_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1699,7 +1689,7 @@ async def test_list_tag_holds_field_headers_async(): def test_list_tag_holds_flattened(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1723,7 +1713,7 @@ def test_list_tag_holds_flattened(): def test_list_tag_holds_flattened_error(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1738,7 +1728,7 @@ def test_list_tag_holds_flattened_error(): @pytest.mark.asyncio async def test_list_tag_holds_flattened_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1767,7 +1757,7 @@ async def test_list_tag_holds_flattened_async(): @pytest.mark.asyncio async def test_list_tag_holds_flattened_error_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1781,7 +1771,7 @@ async def test_list_tag_holds_flattened_error_async(): def test_list_tag_holds_pager(transport_name: str = "grpc"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1831,7 +1821,7 @@ def test_list_tag_holds_pager(transport_name: str = "grpc"): def test_list_tag_holds_pages(transport_name: str = "grpc"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1873,7 +1863,7 @@ def test_list_tag_holds_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_tag_holds_async_pager(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1923,7 +1913,7 @@ async def test_list_tag_holds_async_pager(): @pytest.mark.asyncio async def test_list_tag_holds_async_pages(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1978,7 +1968,7 @@ async def test_list_tag_holds_async_pages(): ) def test_create_tag_hold_rest(request_type): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2098,7 +2088,7 @@ def test_create_tag_hold_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_tag_hold._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2107,7 +2097,7 @@ def test_create_tag_hold_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_tag_hold._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("validate_only",)) @@ -2118,7 +2108,7 @@ def test_create_tag_hold_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2158,7 +2148,7 @@ def test_create_tag_hold_rest_required_fields( def test_create_tag_hold_rest_unset_required_fields(): transport = transports.TagHoldsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_tag_hold._get_unset_required_fields({}) @@ -2176,7 +2166,7 @@ def test_create_tag_hold_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_tag_hold_rest_interceptors(null_interceptor): transport = transports.TagHoldsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagHoldsRestInterceptor(), ) client = TagHoldsClient(transport=transport) @@ -2232,7 +2222,7 @@ def test_create_tag_hold_rest_bad_request( transport: str = "rest", request_type=tag_holds.CreateTagHoldRequest ): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2254,7 +2244,7 @@ def test_create_tag_hold_rest_bad_request( def test_create_tag_hold_rest_flattened(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2293,7 +2283,7 @@ def test_create_tag_hold_rest_flattened(): def test_create_tag_hold_rest_flattened_error(transport: str = "rest"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2309,7 +2299,7 @@ def test_create_tag_hold_rest_flattened_error(transport: str = "rest"): def test_create_tag_hold_rest_error(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2322,7 +2312,7 @@ def test_create_tag_hold_rest_error(): ) def test_delete_tag_hold_rest(request_type): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2368,7 +2358,7 @@ def test_delete_tag_hold_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_tag_hold._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2377,7 +2367,7 @@ def test_delete_tag_hold_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_tag_hold._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("validate_only",)) @@ -2388,7 +2378,7 @@ def test_delete_tag_hold_rest_required_fields( assert jsonified_request["name"] == "name_value" client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2427,7 +2417,7 @@ def test_delete_tag_hold_rest_required_fields( def test_delete_tag_hold_rest_unset_required_fields(): transport = transports.TagHoldsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_tag_hold._get_unset_required_fields({}) @@ -2437,7 +2427,7 @@ def test_delete_tag_hold_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_tag_hold_rest_interceptors(null_interceptor): transport = transports.TagHoldsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagHoldsRestInterceptor(), ) client = TagHoldsClient(transport=transport) @@ -2493,7 +2483,7 @@ def test_delete_tag_hold_rest_bad_request( transport: str = "rest", request_type=tag_holds.DeleteTagHoldRequest ): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2515,7 +2505,7 @@ def test_delete_tag_hold_rest_bad_request( def test_delete_tag_hold_rest_flattened(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2553,7 +2543,7 @@ def test_delete_tag_hold_rest_flattened(): def test_delete_tag_hold_rest_flattened_error(transport: str = "rest"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2568,7 +2558,7 @@ def test_delete_tag_hold_rest_flattened_error(transport: str = "rest"): def test_delete_tag_hold_rest_error(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2581,7 +2571,7 @@ def test_delete_tag_hold_rest_error(): ) def test_list_tag_holds_rest(request_type): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2632,7 +2622,7 @@ def test_list_tag_holds_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tag_holds._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2641,7 +2631,7 @@ def test_list_tag_holds_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tag_holds._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2658,7 +2648,7 @@ def test_list_tag_holds_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2700,7 +2690,7 @@ def test_list_tag_holds_rest_required_fields( def test_list_tag_holds_rest_unset_required_fields(): transport = transports.TagHoldsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_tag_holds._get_unset_required_fields({}) @@ -2719,7 +2709,7 @@ def test_list_tag_holds_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_tag_holds_rest_interceptors(null_interceptor): transport = transports.TagHoldsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagHoldsRestInterceptor(), ) client = TagHoldsClient(transport=transport) @@ -2773,7 +2763,7 @@ def test_list_tag_holds_rest_bad_request( transport: str = "rest", request_type=tag_holds.ListTagHoldsRequest ): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2795,7 +2785,7 @@ def test_list_tag_holds_rest_bad_request( def test_list_tag_holds_rest_flattened(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2835,7 +2825,7 @@ def test_list_tag_holds_rest_flattened(): def test_list_tag_holds_rest_flattened_error(transport: str = "rest"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2850,7 +2840,7 @@ def test_list_tag_holds_rest_flattened_error(transport: str = "rest"): def test_list_tag_holds_rest_pager(transport: str = "rest"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2912,17 +2902,17 @@ def test_list_tag_holds_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.TagHoldsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.TagHoldsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagHoldsClient( @@ -2932,7 +2922,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.TagHoldsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -2947,13 +2937,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = TagHoldsClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.TagHoldsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagHoldsClient( @@ -2965,7 +2954,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.TagHoldsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = TagHoldsClient(transport=transport) assert client.transport is transport @@ -2974,13 +2963,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.TagHoldsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.TagHoldsGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -2997,7 +2986,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3011,7 +3000,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = TagHoldsClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3019,7 +3008,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3031,7 +3020,7 @@ def test_tag_holds_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.TagHoldsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3043,7 +3032,7 @@ def test_tag_holds_base_transport(): ) as Transport: Transport.return_value = None transport = transports.TagHoldsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3083,7 +3072,7 @@ def test_tag_holds_base_transport_with_credentials_file(): "google.cloud.resourcemanager_v3.services.tag_holds.transports.TagHoldsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TagHoldsTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3105,7 +3094,7 @@ def test_tag_holds_base_transport_with_adc(): "google.cloud.resourcemanager_v3.services.tag_holds.transports.TagHoldsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TagHoldsTransport() adc.assert_called_once() @@ -3113,7 +3102,7 @@ def test_tag_holds_base_transport_with_adc(): def test_tag_holds_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) TagHoldsClient() adc.assert_called_once_with( scopes=None, @@ -3136,7 +3125,7 @@ def test_tag_holds_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3186,7 +3175,7 @@ def test_tag_holds_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3214,7 +3203,7 @@ def test_tag_holds_transport_create_channel(transport_class, grpc_helpers): [transports.TagHoldsGrpcTransport, transports.TagHoldsGrpcAsyncIOTransport], ) def test_tag_holds_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3252,7 +3241,7 @@ def test_tag_holds_grpc_transport_client_cert_source_for_mtls(transport_class): def test_tag_holds_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3264,7 +3253,7 @@ def test_tag_holds_http_transport_client_cert_source_for_mtls(): def test_tag_holds_rest_lro_client(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3289,7 +3278,7 @@ def test_tag_holds_rest_lro_client(): ) def test_tag_holds_host_no_port(transport_name): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com" ), @@ -3312,7 +3301,7 @@ def test_tag_holds_host_no_port(transport_name): ) def test_tag_holds_host_with_port(transport_name): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com:8000" ), @@ -3332,8 +3321,8 @@ def test_tag_holds_host_with_port(transport_name): ], ) def test_tag_holds_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = TagHoldsClient( credentials=creds1, transport=transport_name, @@ -3398,7 +3387,7 @@ def test_tag_holds_transport_channel_mtls_with_client_cert_source(transport_clas mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3473,7 +3462,7 @@ def test_tag_holds_transport_channel_mtls_with_adc(transport_class): def test_tag_holds_grpc_lro_client(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -3490,7 +3479,7 @@ def test_tag_holds_grpc_lro_client(): def test_tag_holds_grpc_lro_async_client(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -3638,7 +3627,7 @@ def test_client_with_default_client_info(): transports.TagHoldsTransport, "_prep_wrapped_messages" ) as prep: client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3648,7 +3637,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TagHoldsClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3657,7 +3646,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -3672,7 +3661,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3700,7 +3689,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "operations/sample1"} @@ -3726,7 +3715,7 @@ def test_get_operation_rest(request_type): def test_get_operation(transport: str = "grpc"): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3751,7 +3740,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3777,7 +3766,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3806,7 +3795,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3835,7 +3824,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -3853,7 +3842,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = TagHoldsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -3877,7 +3866,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3894,7 +3883,7 @@ def test_client_ctx(): ] for transport in transports: client = TagHoldsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_keys.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_keys.py index e0f1db888d99..9882dbb3d5a4 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_keys.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_keys.py @@ -93,18 +93,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -296,7 +284,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -323,42 +311,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -369,7 +364,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_tag_keys_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -421,7 +416,7 @@ def test_tag_keys_client_service_account_always_use_jwt( ], ) def test_tag_keys_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -478,9 +473,7 @@ def test_tag_keys_client_get_transport_class(): def test_tag_keys_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(TagKeysClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -871,20 +864,20 @@ def test_tag_keys_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -896,13 +889,11 @@ def test_tag_keys_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -918,8 +909,7 @@ def test_tag_keys_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1056,8 +1046,8 @@ def test_tag_keys_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1089,7 +1079,7 @@ def test_tag_keys_client_create_channel_credentials_file( ) def test_list_tag_keys(request_type, transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1119,7 +1109,7 @@ def test_list_tag_keys_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1136,7 +1126,7 @@ async def test_list_tag_keys_async( transport: str = "grpc_asyncio", request_type=tag_keys.ListTagKeysRequest ): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1171,7 +1161,7 @@ async def test_list_tag_keys_async_from_dict(): def test_list_tag_keys_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1195,7 +1185,7 @@ def test_list_tag_keys_flattened(): def test_list_tag_keys_flattened_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1210,7 +1200,7 @@ def test_list_tag_keys_flattened_error(): @pytest.mark.asyncio async def test_list_tag_keys_flattened_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1239,7 +1229,7 @@ async def test_list_tag_keys_flattened_async(): @pytest.mark.asyncio async def test_list_tag_keys_flattened_error_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1253,7 +1243,7 @@ async def test_list_tag_keys_flattened_error_async(): def test_list_tag_keys_pager(transport_name: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1300,7 +1290,7 @@ def test_list_tag_keys_pager(transport_name: str = "grpc"): def test_list_tag_keys_pages(transport_name: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1342,7 +1332,7 @@ def test_list_tag_keys_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_tag_keys_async_pager(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1392,7 +1382,7 @@ async def test_list_tag_keys_async_pager(): @pytest.mark.asyncio async def test_list_tag_keys_async_pages(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1447,7 +1437,7 @@ async def test_list_tag_keys_async_pages(): ) def test_get_tag_key(request_type, transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1489,7 +1479,7 @@ def test_get_tag_key_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1506,7 +1496,7 @@ async def test_get_tag_key_async( transport: str = "grpc_asyncio", request_type=tag_keys.GetTagKeyRequest ): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1553,7 +1543,7 @@ async def test_get_tag_key_async_from_dict(): def test_get_tag_key_field_headers(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1583,7 +1573,7 @@ def test_get_tag_key_field_headers(): @pytest.mark.asyncio async def test_get_tag_key_field_headers_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1612,7 +1602,7 @@ async def test_get_tag_key_field_headers_async(): def test_get_tag_key_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1636,7 +1626,7 @@ def test_get_tag_key_flattened(): def test_get_tag_key_flattened_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1651,7 +1641,7 @@ def test_get_tag_key_flattened_error(): @pytest.mark.asyncio async def test_get_tag_key_flattened_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1678,7 +1668,7 @@ async def test_get_tag_key_flattened_async(): @pytest.mark.asyncio async def test_get_tag_key_flattened_error_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1699,7 +1689,7 @@ async def test_get_tag_key_flattened_error_async(): ) def test_get_namespaced_tag_key(request_type, transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1743,7 +1733,7 @@ def test_get_namespaced_tag_key_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1762,7 +1752,7 @@ async def test_get_namespaced_tag_key_async( transport: str = "grpc_asyncio", request_type=tag_keys.GetNamespacedTagKeyRequest ): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1811,7 +1801,7 @@ async def test_get_namespaced_tag_key_async_from_dict(): def test_get_namespaced_tag_key_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1837,7 +1827,7 @@ def test_get_namespaced_tag_key_flattened(): def test_get_namespaced_tag_key_flattened_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1852,7 +1842,7 @@ def test_get_namespaced_tag_key_flattened_error(): @pytest.mark.asyncio async def test_get_namespaced_tag_key_flattened_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1881,7 +1871,7 @@ async def test_get_namespaced_tag_key_flattened_async(): @pytest.mark.asyncio async def test_get_namespaced_tag_key_flattened_error_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1902,7 +1892,7 @@ async def test_get_namespaced_tag_key_flattened_error_async(): ) def test_create_tag_key(request_type, transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1929,7 +1919,7 @@ def test_create_tag_key_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1946,7 +1936,7 @@ async def test_create_tag_key_async( transport: str = "grpc_asyncio", request_type=tag_keys.CreateTagKeyRequest ): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1978,7 +1968,7 @@ async def test_create_tag_key_async_from_dict(): def test_create_tag_key_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2002,7 +1992,7 @@ def test_create_tag_key_flattened(): def test_create_tag_key_flattened_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2017,7 +2007,7 @@ def test_create_tag_key_flattened_error(): @pytest.mark.asyncio async def test_create_tag_key_flattened_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2046,7 +2036,7 @@ async def test_create_tag_key_flattened_async(): @pytest.mark.asyncio async def test_create_tag_key_flattened_error_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2067,7 +2057,7 @@ async def test_create_tag_key_flattened_error_async(): ) def test_update_tag_key(request_type, transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2094,7 +2084,7 @@ def test_update_tag_key_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2111,7 +2101,7 @@ async def test_update_tag_key_async( transport: str = "grpc_asyncio", request_type=tag_keys.UpdateTagKeyRequest ): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2143,7 +2133,7 @@ async def test_update_tag_key_async_from_dict(): def test_update_tag_key_field_headers(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2173,7 +2163,7 @@ def test_update_tag_key_field_headers(): @pytest.mark.asyncio async def test_update_tag_key_field_headers_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2204,7 +2194,7 @@ async def test_update_tag_key_field_headers_async(): def test_update_tag_key_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2232,7 +2222,7 @@ def test_update_tag_key_flattened(): def test_update_tag_key_flattened_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2248,7 +2238,7 @@ def test_update_tag_key_flattened_error(): @pytest.mark.asyncio async def test_update_tag_key_flattened_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2281,7 +2271,7 @@ async def test_update_tag_key_flattened_async(): @pytest.mark.asyncio async def test_update_tag_key_flattened_error_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2303,7 +2293,7 @@ async def test_update_tag_key_flattened_error_async(): ) def test_delete_tag_key(request_type, transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2330,7 +2320,7 @@ def test_delete_tag_key_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2347,7 +2337,7 @@ async def test_delete_tag_key_async( transport: str = "grpc_asyncio", request_type=tag_keys.DeleteTagKeyRequest ): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2379,7 +2369,7 @@ async def test_delete_tag_key_async_from_dict(): def test_delete_tag_key_field_headers(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2409,7 +2399,7 @@ def test_delete_tag_key_field_headers(): @pytest.mark.asyncio async def test_delete_tag_key_field_headers_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2440,7 +2430,7 @@ async def test_delete_tag_key_field_headers_async(): def test_delete_tag_key_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2464,7 +2454,7 @@ def test_delete_tag_key_flattened(): def test_delete_tag_key_flattened_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2479,7 +2469,7 @@ def test_delete_tag_key_flattened_error(): @pytest.mark.asyncio async def test_delete_tag_key_flattened_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2508,7 +2498,7 @@ async def test_delete_tag_key_flattened_async(): @pytest.mark.asyncio async def test_delete_tag_key_flattened_error_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2529,7 +2519,7 @@ async def test_delete_tag_key_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2561,7 +2551,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2578,7 +2568,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2615,7 +2605,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2645,7 +2635,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2674,7 +2664,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2691,7 +2681,7 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2715,7 +2705,7 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2730,7 +2720,7 @@ def test_get_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2757,7 +2747,7 @@ async def test_get_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_error_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2778,7 +2768,7 @@ async def test_get_iam_policy_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2810,7 +2800,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2827,7 +2817,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2864,7 +2854,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2894,7 +2884,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2923,7 +2913,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -2941,7 +2931,7 @@ def test_set_iam_policy_from_dict_foreign(): def test_set_iam_policy_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2965,7 +2955,7 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2980,7 +2970,7 @@ def test_set_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3007,7 +2997,7 @@ async def test_set_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_error_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3028,7 +3018,7 @@ async def test_set_iam_policy_flattened_error_async(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3060,7 +3050,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3080,7 +3070,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3117,7 +3107,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3149,7 +3139,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3182,7 +3172,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3201,7 +3191,7 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3231,7 +3221,7 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3247,7 +3237,7 @@ def test_test_iam_permissions_flattened_error(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3282,7 +3272,7 @@ async def test_test_iam_permissions_flattened_async(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_error_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3304,7 +3294,7 @@ async def test_test_iam_permissions_flattened_error_async(): ) def test_list_tag_keys_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3354,7 +3344,7 @@ def test_list_tag_keys_rest_required_fields(request_type=tag_keys.ListTagKeysReq assert "parent" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tag_keys._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3365,7 +3355,7 @@ def test_list_tag_keys_rest_required_fields(request_type=tag_keys.ListTagKeysReq jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tag_keys._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3382,7 +3372,7 @@ def test_list_tag_keys_rest_required_fields(request_type=tag_keys.ListTagKeysReq assert jsonified_request["parent"] == "parent_value" client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3430,7 +3420,7 @@ def test_list_tag_keys_rest_required_fields(request_type=tag_keys.ListTagKeysReq def test_list_tag_keys_rest_unset_required_fields(): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_tag_keys._get_unset_required_fields({}) @@ -3449,7 +3439,7 @@ def test_list_tag_keys_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_tag_keys_rest_interceptors(null_interceptor): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagKeysRestInterceptor(), ) client = TagKeysClient(transport=transport) @@ -3503,7 +3493,7 @@ def test_list_tag_keys_rest_bad_request( transport: str = "rest", request_type=tag_keys.ListTagKeysRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3525,7 +3515,7 @@ def test_list_tag_keys_rest_bad_request( def test_list_tag_keys_rest_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3563,7 +3553,7 @@ def test_list_tag_keys_rest_flattened(): def test_list_tag_keys_rest_flattened_error(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3578,7 +3568,7 @@ def test_list_tag_keys_rest_flattened_error(transport: str = "rest"): def test_list_tag_keys_rest_pager(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3646,7 +3636,7 @@ def test_list_tag_keys_rest_pager(transport: str = "rest"): ) def test_get_tag_key_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3707,7 +3697,7 @@ def test_get_tag_key_rest_required_fields(request_type=tag_keys.GetTagKeyRequest # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_tag_key._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3716,7 +3706,7 @@ def test_get_tag_key_rest_required_fields(request_type=tag_keys.GetTagKeyRequest jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_tag_key._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3725,7 +3715,7 @@ def test_get_tag_key_rest_required_fields(request_type=tag_keys.GetTagKeyRequest assert jsonified_request["name"] == "name_value" client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3767,7 +3757,7 @@ def test_get_tag_key_rest_required_fields(request_type=tag_keys.GetTagKeyRequest def test_get_tag_key_rest_unset_required_fields(): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_tag_key._get_unset_required_fields({}) @@ -3777,7 +3767,7 @@ def test_get_tag_key_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_tag_key_rest_interceptors(null_interceptor): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagKeysRestInterceptor(), ) client = TagKeysClient(transport=transport) @@ -3829,7 +3819,7 @@ def test_get_tag_key_rest_bad_request( transport: str = "rest", request_type=tag_keys.GetTagKeyRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3851,7 +3841,7 @@ def test_get_tag_key_rest_bad_request( def test_get_tag_key_rest_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3891,7 +3881,7 @@ def test_get_tag_key_rest_flattened(): def test_get_tag_key_rest_flattened_error(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3906,7 +3896,7 @@ def test_get_tag_key_rest_flattened_error(transport: str = "rest"): def test_get_tag_key_rest_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3919,7 +3909,7 @@ def test_get_tag_key_rest_error(): ) def test_get_namespaced_tag_key_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3983,7 +3973,7 @@ def test_get_namespaced_tag_key_rest_required_fields( assert "name" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_namespaced_tag_key._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3994,7 +3984,7 @@ def test_get_namespaced_tag_key_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_namespaced_tag_key._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("name",)) @@ -4005,7 +3995,7 @@ def test_get_namespaced_tag_key_rest_required_fields( assert jsonified_request["name"] == "name_value" client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4053,7 +4043,7 @@ def test_get_namespaced_tag_key_rest_required_fields( def test_get_namespaced_tag_key_rest_unset_required_fields(): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_namespaced_tag_key._get_unset_required_fields({}) @@ -4063,7 +4053,7 @@ def test_get_namespaced_tag_key_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_namespaced_tag_key_rest_interceptors(null_interceptor): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagKeysRestInterceptor(), ) client = TagKeysClient(transport=transport) @@ -4117,7 +4107,7 @@ def test_get_namespaced_tag_key_rest_bad_request( transport: str = "rest", request_type=tag_keys.GetNamespacedTagKeyRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4139,7 +4129,7 @@ def test_get_namespaced_tag_key_rest_bad_request( def test_get_namespaced_tag_key_rest_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4179,7 +4169,7 @@ def test_get_namespaced_tag_key_rest_flattened(): def test_get_namespaced_tag_key_rest_flattened_error(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4194,7 +4184,7 @@ def test_get_namespaced_tag_key_rest_flattened_error(transport: str = "rest"): def test_get_namespaced_tag_key_rest_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4207,7 +4197,7 @@ def test_get_namespaced_tag_key_rest_error(): ) def test_create_tag_key_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4329,14 +4319,14 @@ def test_create_tag_key_rest_required_fields(request_type=tag_keys.CreateTagKeyR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_tag_key._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_tag_key._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("validate_only",)) @@ -4345,7 +4335,7 @@ def test_create_tag_key_rest_required_fields(request_type=tag_keys.CreateTagKeyR # verify required fields with non-default values are left alone client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4385,7 +4375,7 @@ def test_create_tag_key_rest_required_fields(request_type=tag_keys.CreateTagKeyR def test_create_tag_key_rest_unset_required_fields(): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_tag_key._get_unset_required_fields({}) @@ -4395,7 +4385,7 @@ def test_create_tag_key_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_tag_key_rest_interceptors(null_interceptor): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagKeysRestInterceptor(), ) client = TagKeysClient(transport=transport) @@ -4451,7 +4441,7 @@ def test_create_tag_key_rest_bad_request( transport: str = "rest", request_type=tag_keys.CreateTagKeyRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4473,7 +4463,7 @@ def test_create_tag_key_rest_bad_request( def test_create_tag_key_rest_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4509,7 +4499,7 @@ def test_create_tag_key_rest_flattened(): def test_create_tag_key_rest_flattened_error(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4524,7 +4514,7 @@ def test_create_tag_key_rest_flattened_error(transport: str = "rest"): def test_create_tag_key_rest_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4537,7 +4527,7 @@ def test_create_tag_key_rest_error(): ) def test_update_tag_key_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4659,14 +4649,14 @@ def test_update_tag_key_rest_required_fields(request_type=tag_keys.UpdateTagKeyR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_tag_key._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_tag_key._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4680,7 +4670,7 @@ def test_update_tag_key_rest_required_fields(request_type=tag_keys.UpdateTagKeyR # verify required fields with non-default values are left alone client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4720,7 +4710,7 @@ def test_update_tag_key_rest_required_fields(request_type=tag_keys.UpdateTagKeyR def test_update_tag_key_rest_unset_required_fields(): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_tag_key._get_unset_required_fields({}) @@ -4738,7 +4728,7 @@ def test_update_tag_key_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_tag_key_rest_interceptors(null_interceptor): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagKeysRestInterceptor(), ) client = TagKeysClient(transport=transport) @@ -4794,7 +4784,7 @@ def test_update_tag_key_rest_bad_request( transport: str = "rest", request_type=tag_keys.UpdateTagKeyRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4816,7 +4806,7 @@ def test_update_tag_key_rest_bad_request( def test_update_tag_key_rest_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4855,7 +4845,7 @@ def test_update_tag_key_rest_flattened(): def test_update_tag_key_rest_flattened_error(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4871,7 +4861,7 @@ def test_update_tag_key_rest_flattened_error(transport: str = "rest"): def test_update_tag_key_rest_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4884,7 +4874,7 @@ def test_update_tag_key_rest_error(): ) def test_delete_tag_key_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4928,7 +4918,7 @@ def test_delete_tag_key_rest_required_fields(request_type=tag_keys.DeleteTagKeyR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_tag_key._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4937,7 +4927,7 @@ def test_delete_tag_key_rest_required_fields(request_type=tag_keys.DeleteTagKeyR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_tag_key._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4953,7 +4943,7 @@ def test_delete_tag_key_rest_required_fields(request_type=tag_keys.DeleteTagKeyR assert jsonified_request["name"] == "name_value" client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4992,7 +4982,7 @@ def test_delete_tag_key_rest_required_fields(request_type=tag_keys.DeleteTagKeyR def test_delete_tag_key_rest_unset_required_fields(): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_tag_key._get_unset_required_fields({}) @@ -5010,7 +5000,7 @@ def test_delete_tag_key_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_tag_key_rest_interceptors(null_interceptor): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagKeysRestInterceptor(), ) client = TagKeysClient(transport=transport) @@ -5066,7 +5056,7 @@ def test_delete_tag_key_rest_bad_request( transport: str = "rest", request_type=tag_keys.DeleteTagKeyRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5088,7 +5078,7 @@ def test_delete_tag_key_rest_bad_request( def test_delete_tag_key_rest_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5126,7 +5116,7 @@ def test_delete_tag_key_rest_flattened(): def test_delete_tag_key_rest_flattened_error(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5141,7 +5131,7 @@ def test_delete_tag_key_rest_flattened_error(transport: str = "rest"): def test_delete_tag_key_rest_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5154,7 +5144,7 @@ def test_delete_tag_key_rest_error(): ) def test_get_iam_policy_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5205,7 +5195,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5214,7 +5204,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5223,7 +5213,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5264,7 +5254,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -5274,7 +5264,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagKeysRestInterceptor(), ) client = TagKeysClient(transport=transport) @@ -5326,7 +5316,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5348,7 +5338,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5386,7 +5376,7 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5401,7 +5391,7 @@ def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): def test_get_iam_policy_rest_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5414,7 +5404,7 @@ def test_get_iam_policy_rest_error(): ) def test_set_iam_policy_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5465,7 +5455,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5474,7 +5464,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5483,7 +5473,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5524,7 +5514,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -5542,7 +5532,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagKeysRestInterceptor(), ) client = TagKeysClient(transport=transport) @@ -5594,7 +5584,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5616,7 +5606,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5654,7 +5644,7 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5669,7 +5659,7 @@ def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): def test_set_iam_policy_rest_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5682,7 +5672,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5732,7 +5722,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5742,7 +5732,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5753,7 +5743,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5794,7 +5784,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -5812,7 +5802,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.TagKeysRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagKeysRestInterceptor(), ) client = TagKeysClient(transport=transport) @@ -5866,7 +5856,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5888,7 +5878,7 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5928,7 +5918,7 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5944,24 +5934,24 @@ def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): def test_test_iam_permissions_rest_error(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.TagKeysGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.TagKeysGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagKeysClient( @@ -5971,7 +5961,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.TagKeysGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5986,13 +5976,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = TagKeysClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.TagKeysGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagKeysClient( @@ -6004,7 +5993,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.TagKeysGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = TagKeysClient(transport=transport) assert client.transport is transport @@ -6013,13 +6002,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.TagKeysGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.TagKeysGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -6036,7 +6025,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -6050,7 +6039,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = TagKeysClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -6058,7 +6047,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -6070,7 +6059,7 @@ def test_tag_keys_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.TagKeysTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -6082,7 +6071,7 @@ def test_tag_keys_base_transport(): ) as Transport: Transport.return_value = None transport = transports.TagKeysTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -6128,7 +6117,7 @@ def test_tag_keys_base_transport_with_credentials_file(): "google.cloud.resourcemanager_v3.services.tag_keys.transports.TagKeysTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TagKeysTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -6150,7 +6139,7 @@ def test_tag_keys_base_transport_with_adc(): "google.cloud.resourcemanager_v3.services.tag_keys.transports.TagKeysTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TagKeysTransport() adc.assert_called_once() @@ -6158,7 +6147,7 @@ def test_tag_keys_base_transport_with_adc(): def test_tag_keys_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) TagKeysClient() adc.assert_called_once_with( scopes=None, @@ -6181,7 +6170,7 @@ def test_tag_keys_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6231,7 +6220,7 @@ def test_tag_keys_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6259,7 +6248,7 @@ def test_tag_keys_transport_create_channel(transport_class, grpc_helpers): [transports.TagKeysGrpcTransport, transports.TagKeysGrpcAsyncIOTransport], ) def test_tag_keys_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6297,7 +6286,7 @@ def test_tag_keys_grpc_transport_client_cert_source_for_mtls(transport_class): def test_tag_keys_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6309,7 +6298,7 @@ def test_tag_keys_http_transport_client_cert_source_for_mtls(): def test_tag_keys_rest_lro_client(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -6334,7 +6323,7 @@ def test_tag_keys_rest_lro_client(): ) def test_tag_keys_host_no_port(transport_name): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com" ), @@ -6357,7 +6346,7 @@ def test_tag_keys_host_no_port(transport_name): ) def test_tag_keys_host_with_port(transport_name): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com:8000" ), @@ -6377,8 +6366,8 @@ def test_tag_keys_host_with_port(transport_name): ], ) def test_tag_keys_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = TagKeysClient( credentials=creds1, transport=transport_name, @@ -6461,7 +6450,7 @@ def test_tag_keys_transport_channel_mtls_with_client_cert_source(transport_class mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6536,7 +6525,7 @@ def test_tag_keys_transport_channel_mtls_with_adc(transport_class): def test_tag_keys_grpc_lro_client(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -6553,7 +6542,7 @@ def test_tag_keys_grpc_lro_client(): def test_tag_keys_grpc_lro_async_client(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -6698,7 +6687,7 @@ def test_client_with_default_client_info(): transports.TagKeysTransport, "_prep_wrapped_messages" ) as prep: client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6708,7 +6697,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TagKeysClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6717,7 +6706,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6732,7 +6721,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6760,7 +6749,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "operations/sample1"} @@ -6786,7 +6775,7 @@ def test_get_operation_rest(request_type): def test_get_operation(transport: str = "grpc"): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6811,7 +6800,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6837,7 +6826,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6866,7 +6855,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6895,7 +6884,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6913,7 +6902,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = TagKeysAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6937,7 +6926,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -6954,7 +6943,7 @@ def test_client_ctx(): ] for transport in transports: client = TagKeysClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_values.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_values.py index 91684d417bc2..25cb5e4ddae1 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_values.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_values.py @@ -93,18 +93,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -306,7 +294,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -333,42 +321,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -379,7 +374,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_tag_values_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -431,7 +426,7 @@ def test_tag_values_client_service_account_always_use_jwt( ], ) def test_tag_values_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -494,9 +489,7 @@ def test_tag_values_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(TagValuesClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -889,20 +882,20 @@ def test_tag_values_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -914,13 +907,11 @@ def test_tag_values_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -936,8 +927,7 @@ def test_tag_values_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1078,8 +1068,8 @@ def test_tag_values_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1111,7 +1101,7 @@ def test_tag_values_client_create_channel_credentials_file( ) def test_list_tag_values(request_type, transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1141,7 +1131,7 @@ def test_list_tag_values_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1158,7 +1148,7 @@ async def test_list_tag_values_async( transport: str = "grpc_asyncio", request_type=tag_values.ListTagValuesRequest ): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1193,7 +1183,7 @@ async def test_list_tag_values_async_from_dict(): def test_list_tag_values_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1217,7 +1207,7 @@ def test_list_tag_values_flattened(): def test_list_tag_values_flattened_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1232,7 +1222,7 @@ def test_list_tag_values_flattened_error(): @pytest.mark.asyncio async def test_list_tag_values_flattened_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1261,7 +1251,7 @@ async def test_list_tag_values_flattened_async(): @pytest.mark.asyncio async def test_list_tag_values_flattened_error_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1275,7 +1265,7 @@ async def test_list_tag_values_flattened_error_async(): def test_list_tag_values_pager(transport_name: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1322,7 +1312,7 @@ def test_list_tag_values_pager(transport_name: str = "grpc"): def test_list_tag_values_pages(transport_name: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1364,7 +1354,7 @@ def test_list_tag_values_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_tag_values_async_pager(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1414,7 +1404,7 @@ async def test_list_tag_values_async_pager(): @pytest.mark.asyncio async def test_list_tag_values_async_pages(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1469,7 +1459,7 @@ async def test_list_tag_values_async_pages(): ) def test_get_tag_value(request_type, transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1509,7 +1499,7 @@ def test_get_tag_value_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1526,7 +1516,7 @@ async def test_get_tag_value_async( transport: str = "grpc_asyncio", request_type=tag_values.GetTagValueRequest ): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1571,7 +1561,7 @@ async def test_get_tag_value_async_from_dict(): def test_get_tag_value_field_headers(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1601,7 +1591,7 @@ def test_get_tag_value_field_headers(): @pytest.mark.asyncio async def test_get_tag_value_field_headers_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1630,7 +1620,7 @@ async def test_get_tag_value_field_headers_async(): def test_get_tag_value_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1654,7 +1644,7 @@ def test_get_tag_value_flattened(): def test_get_tag_value_flattened_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1669,7 +1659,7 @@ def test_get_tag_value_flattened_error(): @pytest.mark.asyncio async def test_get_tag_value_flattened_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1696,7 +1686,7 @@ async def test_get_tag_value_flattened_async(): @pytest.mark.asyncio async def test_get_tag_value_flattened_error_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1717,7 +1707,7 @@ async def test_get_tag_value_flattened_error_async(): ) def test_get_namespaced_tag_value(request_type, transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1759,7 +1749,7 @@ def test_get_namespaced_tag_value_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1779,7 +1769,7 @@ async def test_get_namespaced_tag_value_async( request_type=tag_values.GetNamespacedTagValueRequest, ): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1826,7 +1816,7 @@ async def test_get_namespaced_tag_value_async_from_dict(): def test_get_namespaced_tag_value_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1852,7 +1842,7 @@ def test_get_namespaced_tag_value_flattened(): def test_get_namespaced_tag_value_flattened_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1867,7 +1857,7 @@ def test_get_namespaced_tag_value_flattened_error(): @pytest.mark.asyncio async def test_get_namespaced_tag_value_flattened_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1896,7 +1886,7 @@ async def test_get_namespaced_tag_value_flattened_async(): @pytest.mark.asyncio async def test_get_namespaced_tag_value_flattened_error_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1917,7 +1907,7 @@ async def test_get_namespaced_tag_value_flattened_error_async(): ) def test_create_tag_value(request_type, transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1944,7 +1934,7 @@ def test_create_tag_value_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1961,7 +1951,7 @@ async def test_create_tag_value_async( transport: str = "grpc_asyncio", request_type=tag_values.CreateTagValueRequest ): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1993,7 +1983,7 @@ async def test_create_tag_value_async_from_dict(): def test_create_tag_value_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2017,7 +2007,7 @@ def test_create_tag_value_flattened(): def test_create_tag_value_flattened_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2032,7 +2022,7 @@ def test_create_tag_value_flattened_error(): @pytest.mark.asyncio async def test_create_tag_value_flattened_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2061,7 +2051,7 @@ async def test_create_tag_value_flattened_async(): @pytest.mark.asyncio async def test_create_tag_value_flattened_error_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2082,7 +2072,7 @@ async def test_create_tag_value_flattened_error_async(): ) def test_update_tag_value(request_type, transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2109,7 +2099,7 @@ def test_update_tag_value_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2126,7 +2116,7 @@ async def test_update_tag_value_async( transport: str = "grpc_asyncio", request_type=tag_values.UpdateTagValueRequest ): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2158,7 +2148,7 @@ async def test_update_tag_value_async_from_dict(): def test_update_tag_value_field_headers(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2188,7 +2178,7 @@ def test_update_tag_value_field_headers(): @pytest.mark.asyncio async def test_update_tag_value_field_headers_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2219,7 +2209,7 @@ async def test_update_tag_value_field_headers_async(): def test_update_tag_value_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2247,7 +2237,7 @@ def test_update_tag_value_flattened(): def test_update_tag_value_flattened_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2263,7 +2253,7 @@ def test_update_tag_value_flattened_error(): @pytest.mark.asyncio async def test_update_tag_value_flattened_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2296,7 +2286,7 @@ async def test_update_tag_value_flattened_async(): @pytest.mark.asyncio async def test_update_tag_value_flattened_error_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2318,7 +2308,7 @@ async def test_update_tag_value_flattened_error_async(): ) def test_delete_tag_value(request_type, transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2345,7 +2335,7 @@ def test_delete_tag_value_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2362,7 +2352,7 @@ async def test_delete_tag_value_async( transport: str = "grpc_asyncio", request_type=tag_values.DeleteTagValueRequest ): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2394,7 +2384,7 @@ async def test_delete_tag_value_async_from_dict(): def test_delete_tag_value_field_headers(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2424,7 +2414,7 @@ def test_delete_tag_value_field_headers(): @pytest.mark.asyncio async def test_delete_tag_value_field_headers_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2455,7 +2445,7 @@ async def test_delete_tag_value_field_headers_async(): def test_delete_tag_value_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2479,7 +2469,7 @@ def test_delete_tag_value_flattened(): def test_delete_tag_value_flattened_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2494,7 +2484,7 @@ def test_delete_tag_value_flattened_error(): @pytest.mark.asyncio async def test_delete_tag_value_flattened_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2523,7 +2513,7 @@ async def test_delete_tag_value_flattened_async(): @pytest.mark.asyncio async def test_delete_tag_value_flattened_error_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2544,7 +2534,7 @@ async def test_delete_tag_value_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2576,7 +2566,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2593,7 +2583,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2630,7 +2620,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2660,7 +2650,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2689,7 +2679,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2706,7 +2696,7 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2730,7 +2720,7 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2745,7 +2735,7 @@ def test_get_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2772,7 +2762,7 @@ async def test_get_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_error_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2793,7 +2783,7 @@ async def test_get_iam_policy_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2825,7 +2815,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2842,7 +2832,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2879,7 +2869,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2909,7 +2899,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2938,7 +2928,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -2956,7 +2946,7 @@ def test_set_iam_policy_from_dict_foreign(): def test_set_iam_policy_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2980,7 +2970,7 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2995,7 +2985,7 @@ def test_set_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3022,7 +3012,7 @@ async def test_set_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_error_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3043,7 +3033,7 @@ async def test_set_iam_policy_flattened_error_async(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3075,7 +3065,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3095,7 +3085,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3132,7 +3122,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3164,7 +3154,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3197,7 +3187,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3216,7 +3206,7 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3246,7 +3236,7 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3262,7 +3252,7 @@ def test_test_iam_permissions_flattened_error(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3297,7 +3287,7 @@ async def test_test_iam_permissions_flattened_async(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_error_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3319,7 +3309,7 @@ async def test_test_iam_permissions_flattened_error_async(): ) def test_list_tag_values_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3371,7 +3361,7 @@ def test_list_tag_values_rest_required_fields( assert "parent" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tag_values._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3382,7 +3372,7 @@ def test_list_tag_values_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tag_values._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3399,7 +3389,7 @@ def test_list_tag_values_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3447,7 +3437,7 @@ def test_list_tag_values_rest_required_fields( def test_list_tag_values_rest_unset_required_fields(): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_tag_values._get_unset_required_fields({}) @@ -3466,7 +3456,7 @@ def test_list_tag_values_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_tag_values_rest_interceptors(null_interceptor): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagValuesRestInterceptor(), ) client = TagValuesClient(transport=transport) @@ -3522,7 +3512,7 @@ def test_list_tag_values_rest_bad_request( transport: str = "rest", request_type=tag_values.ListTagValuesRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3544,7 +3534,7 @@ def test_list_tag_values_rest_bad_request( def test_list_tag_values_rest_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3584,7 +3574,7 @@ def test_list_tag_values_rest_flattened(): def test_list_tag_values_rest_flattened_error(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3599,7 +3589,7 @@ def test_list_tag_values_rest_flattened_error(transport: str = "rest"): def test_list_tag_values_rest_pager(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3667,7 +3657,7 @@ def test_list_tag_values_rest_pager(transport: str = "rest"): ) def test_get_tag_value_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3726,7 +3716,7 @@ def test_get_tag_value_rest_required_fields(request_type=tag_values.GetTagValueR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_tag_value._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3735,7 +3725,7 @@ def test_get_tag_value_rest_required_fields(request_type=tag_values.GetTagValueR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_tag_value._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3744,7 +3734,7 @@ def test_get_tag_value_rest_required_fields(request_type=tag_values.GetTagValueR assert jsonified_request["name"] == "name_value" client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3786,7 +3776,7 @@ def test_get_tag_value_rest_required_fields(request_type=tag_values.GetTagValueR def test_get_tag_value_rest_unset_required_fields(): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_tag_value._get_unset_required_fields({}) @@ -3796,7 +3786,7 @@ def test_get_tag_value_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_tag_value_rest_interceptors(null_interceptor): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagValuesRestInterceptor(), ) client = TagValuesClient(transport=transport) @@ -3848,7 +3838,7 @@ def test_get_tag_value_rest_bad_request( transport: str = "rest", request_type=tag_values.GetTagValueRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3870,7 +3860,7 @@ def test_get_tag_value_rest_bad_request( def test_get_tag_value_rest_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3910,7 +3900,7 @@ def test_get_tag_value_rest_flattened(): def test_get_tag_value_rest_flattened_error(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3925,7 +3915,7 @@ def test_get_tag_value_rest_flattened_error(transport: str = "rest"): def test_get_tag_value_rest_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3938,7 +3928,7 @@ def test_get_tag_value_rest_error(): ) def test_get_namespaced_tag_value_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4000,7 +3990,7 @@ def test_get_namespaced_tag_value_rest_required_fields( assert "name" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_namespaced_tag_value._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4011,7 +4001,7 @@ def test_get_namespaced_tag_value_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_namespaced_tag_value._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("name",)) @@ -4022,7 +4012,7 @@ def test_get_namespaced_tag_value_rest_required_fields( assert jsonified_request["name"] == "name_value" client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4070,7 +4060,7 @@ def test_get_namespaced_tag_value_rest_required_fields( def test_get_namespaced_tag_value_rest_unset_required_fields(): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_namespaced_tag_value._get_unset_required_fields({}) @@ -4080,7 +4070,7 @@ def test_get_namespaced_tag_value_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_namespaced_tag_value_rest_interceptors(null_interceptor): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagValuesRestInterceptor(), ) client = TagValuesClient(transport=transport) @@ -4134,7 +4124,7 @@ def test_get_namespaced_tag_value_rest_bad_request( transport: str = "rest", request_type=tag_values.GetNamespacedTagValueRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4156,7 +4146,7 @@ def test_get_namespaced_tag_value_rest_bad_request( def test_get_namespaced_tag_value_rest_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4196,7 +4186,7 @@ def test_get_namespaced_tag_value_rest_flattened(): def test_get_namespaced_tag_value_rest_flattened_error(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4211,7 +4201,7 @@ def test_get_namespaced_tag_value_rest_flattened_error(transport: str = "rest"): def test_get_namespaced_tag_value_rest_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4224,7 +4214,7 @@ def test_get_namespaced_tag_value_rest_error(): ) def test_create_tag_value_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4346,14 +4336,14 @@ def test_create_tag_value_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_tag_value._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_tag_value._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("validate_only",)) @@ -4362,7 +4352,7 @@ def test_create_tag_value_rest_required_fields( # verify required fields with non-default values are left alone client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4402,7 +4392,7 @@ def test_create_tag_value_rest_required_fields( def test_create_tag_value_rest_unset_required_fields(): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_tag_value._get_unset_required_fields({}) @@ -4412,7 +4402,7 @@ def test_create_tag_value_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_tag_value_rest_interceptors(null_interceptor): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagValuesRestInterceptor(), ) client = TagValuesClient(transport=transport) @@ -4470,7 +4460,7 @@ def test_create_tag_value_rest_bad_request( transport: str = "rest", request_type=tag_values.CreateTagValueRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4492,7 +4482,7 @@ def test_create_tag_value_rest_bad_request( def test_create_tag_value_rest_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4530,7 +4520,7 @@ def test_create_tag_value_rest_flattened(): def test_create_tag_value_rest_flattened_error(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4545,7 +4535,7 @@ def test_create_tag_value_rest_flattened_error(transport: str = "rest"): def test_create_tag_value_rest_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4558,7 +4548,7 @@ def test_create_tag_value_rest_error(): ) def test_update_tag_value_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4680,14 +4670,14 @@ def test_update_tag_value_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_tag_value._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_tag_value._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4701,7 +4691,7 @@ def test_update_tag_value_rest_required_fields( # verify required fields with non-default values are left alone client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4741,7 +4731,7 @@ def test_update_tag_value_rest_required_fields( def test_update_tag_value_rest_unset_required_fields(): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_tag_value._get_unset_required_fields({}) @@ -4759,7 +4749,7 @@ def test_update_tag_value_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_tag_value_rest_interceptors(null_interceptor): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagValuesRestInterceptor(), ) client = TagValuesClient(transport=transport) @@ -4817,7 +4807,7 @@ def test_update_tag_value_rest_bad_request( transport: str = "rest", request_type=tag_values.UpdateTagValueRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4839,7 +4829,7 @@ def test_update_tag_value_rest_bad_request( def test_update_tag_value_rest_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4878,7 +4868,7 @@ def test_update_tag_value_rest_flattened(): def test_update_tag_value_rest_flattened_error(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4894,7 +4884,7 @@ def test_update_tag_value_rest_flattened_error(transport: str = "rest"): def test_update_tag_value_rest_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4907,7 +4897,7 @@ def test_update_tag_value_rest_error(): ) def test_delete_tag_value_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4953,7 +4943,7 @@ def test_delete_tag_value_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_tag_value._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4962,7 +4952,7 @@ def test_delete_tag_value_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_tag_value._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4978,7 +4968,7 @@ def test_delete_tag_value_rest_required_fields( assert jsonified_request["name"] == "name_value" client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5017,7 +5007,7 @@ def test_delete_tag_value_rest_required_fields( def test_delete_tag_value_rest_unset_required_fields(): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_tag_value._get_unset_required_fields({}) @@ -5035,7 +5025,7 @@ def test_delete_tag_value_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_tag_value_rest_interceptors(null_interceptor): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagValuesRestInterceptor(), ) client = TagValuesClient(transport=transport) @@ -5093,7 +5083,7 @@ def test_delete_tag_value_rest_bad_request( transport: str = "rest", request_type=tag_values.DeleteTagValueRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5115,7 +5105,7 @@ def test_delete_tag_value_rest_bad_request( def test_delete_tag_value_rest_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5153,7 +5143,7 @@ def test_delete_tag_value_rest_flattened(): def test_delete_tag_value_rest_flattened_error(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5168,7 +5158,7 @@ def test_delete_tag_value_rest_flattened_error(transport: str = "rest"): def test_delete_tag_value_rest_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5181,7 +5171,7 @@ def test_delete_tag_value_rest_error(): ) def test_get_iam_policy_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5232,7 +5222,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5241,7 +5231,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5250,7 +5240,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5291,7 +5281,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -5301,7 +5291,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagValuesRestInterceptor(), ) client = TagValuesClient(transport=transport) @@ -5353,7 +5343,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5375,7 +5365,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5414,7 +5404,7 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5429,7 +5419,7 @@ def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): def test_get_iam_policy_rest_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5442,7 +5432,7 @@ def test_get_iam_policy_rest_error(): ) def test_set_iam_policy_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5493,7 +5483,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5502,7 +5492,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5511,7 +5501,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5552,7 +5542,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -5570,7 +5560,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagValuesRestInterceptor(), ) client = TagValuesClient(transport=transport) @@ -5622,7 +5612,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5644,7 +5634,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5683,7 +5673,7 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5698,7 +5688,7 @@ def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): def test_set_iam_policy_rest_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5711,7 +5701,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5761,7 +5751,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5771,7 +5761,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5782,7 +5772,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5823,7 +5813,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -5841,7 +5831,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.TagValuesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TagValuesRestInterceptor(), ) client = TagValuesClient(transport=transport) @@ -5895,7 +5885,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5917,7 +5907,7 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5957,7 +5947,7 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5973,24 +5963,24 @@ def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): def test_test_iam_permissions_rest_error(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.TagValuesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.TagValuesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagValuesClient( @@ -6000,7 +5990,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.TagValuesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -6015,13 +6005,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = TagValuesClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.TagValuesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TagValuesClient( @@ -6033,7 +6022,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.TagValuesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = TagValuesClient(transport=transport) assert client.transport is transport @@ -6042,13 +6031,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.TagValuesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.TagValuesGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -6065,7 +6054,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -6079,7 +6068,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = TagValuesClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -6087,7 +6076,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -6099,7 +6088,7 @@ def test_tag_values_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.TagValuesTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -6111,7 +6100,7 @@ def test_tag_values_base_transport(): ) as Transport: Transport.return_value = None transport = transports.TagValuesTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -6157,7 +6146,7 @@ def test_tag_values_base_transport_with_credentials_file(): "google.cloud.resourcemanager_v3.services.tag_values.transports.TagValuesTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TagValuesTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -6179,7 +6168,7 @@ def test_tag_values_base_transport_with_adc(): "google.cloud.resourcemanager_v3.services.tag_values.transports.TagValuesTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TagValuesTransport() adc.assert_called_once() @@ -6187,7 +6176,7 @@ def test_tag_values_base_transport_with_adc(): def test_tag_values_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) TagValuesClient() adc.assert_called_once_with( scopes=None, @@ -6210,7 +6199,7 @@ def test_tag_values_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6260,7 +6249,7 @@ def test_tag_values_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6288,7 +6277,7 @@ def test_tag_values_transport_create_channel(transport_class, grpc_helpers): [transports.TagValuesGrpcTransport, transports.TagValuesGrpcAsyncIOTransport], ) def test_tag_values_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6326,7 +6315,7 @@ def test_tag_values_grpc_transport_client_cert_source_for_mtls(transport_class): def test_tag_values_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6338,7 +6327,7 @@ def test_tag_values_http_transport_client_cert_source_for_mtls(): def test_tag_values_rest_lro_client(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -6363,7 +6352,7 @@ def test_tag_values_rest_lro_client(): ) def test_tag_values_host_no_port(transport_name): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com" ), @@ -6386,7 +6375,7 @@ def test_tag_values_host_no_port(transport_name): ) def test_tag_values_host_with_port(transport_name): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudresourcemanager.googleapis.com:8000" ), @@ -6406,8 +6395,8 @@ def test_tag_values_host_with_port(transport_name): ], ) def test_tag_values_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = TagValuesClient( credentials=creds1, transport=transport_name, @@ -6490,7 +6479,7 @@ def test_tag_values_transport_channel_mtls_with_client_cert_source(transport_cla mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6565,7 +6554,7 @@ def test_tag_values_transport_channel_mtls_with_adc(transport_class): def test_tag_values_grpc_lro_client(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -6582,7 +6571,7 @@ def test_tag_values_grpc_lro_client(): def test_tag_values_grpc_lro_async_client(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -6727,7 +6716,7 @@ def test_client_with_default_client_info(): transports.TagValuesTransport, "_prep_wrapped_messages" ) as prep: client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6737,7 +6726,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TagValuesClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6746,7 +6735,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6761,7 +6750,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6789,7 +6778,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "operations/sample1"} @@ -6815,7 +6804,7 @@ def test_get_operation_rest(request_type): def test_get_operation(transport: str = "grpc"): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6840,7 +6829,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6866,7 +6855,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6895,7 +6884,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6924,7 +6913,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6942,7 +6931,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = TagValuesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6966,7 +6955,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -6983,7 +6972,7 @@ def test_client_ctx(): ] for transport in transports: client = TagValuesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-resource-settings/google/cloud/resourcesettings/gapic_version.py b/packages/google-cloud-resource-settings/google/cloud/resourcesettings/gapic_version.py index b7ebf472ead3..360a0d13ebdd 100644 --- a/packages/google-cloud-resource-settings/google/cloud/resourcesettings/gapic_version.py +++ b/packages/google-cloud-resource-settings/google/cloud/resourcesettings/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-resource-settings/google/cloud/resourcesettings_v1/gapic_version.py b/packages/google-cloud-resource-settings/google/cloud/resourcesettings_v1/gapic_version.py index b7ebf472ead3..360a0d13ebdd 100644 --- a/packages/google-cloud-resource-settings/google/cloud/resourcesettings_v1/gapic_version.py +++ b/packages/google-cloud-resource-settings/google/cloud/resourcesettings_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-resource-settings/google/cloud/resourcesettings_v1/services/resource_settings_service/client.py b/packages/google-cloud-resource-settings/google/cloud/resourcesettings_v1/services/resource_settings_service/client.py index a7b3bb5c05df..4a06b80ddca0 100644 --- a/packages/google-cloud-resource-settings/google/cloud/resourcesettings_v1/services/resource_settings_service/client.py +++ b/packages/google-cloud-resource-settings/google/cloud/resourcesettings_v1/services/resource_settings_service/client.py @@ -392,6 +392,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -410,6 +411,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -486,17 +488,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ResourceSettingsServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ResourceSettingsServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-resource-settings/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json b/packages/google-cloud-resource-settings/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json index b661ddf55f3f..3465a96568ae 100644 --- a/packages/google-cloud-resource-settings/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json +++ b/packages/google-cloud-resource-settings/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-resource-settings", - "version": "1.9.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-resource-settings/setup.py b/packages/google-cloud-resource-settings/setup.py index b3c860ffb51d..46bf6eaa13b5 100644 --- a/packages/google-cloud-resource-settings/setup.py +++ b/packages/google-cloud-resource-settings/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-resource-settings/testing/constraints-3.7.txt b/packages/google-cloud-resource-settings/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-resource-settings/testing/constraints-3.7.txt +++ b/packages/google-cloud-resource-settings/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-resource-settings/tests/unit/gapic/resourcesettings_v1/test_resource_settings_service.py b/packages/google-cloud-resource-settings/tests/unit/gapic/resourcesettings_v1/test_resource_settings_service.py index 2d16ef607bde..04317c4b25fe 100644 --- a/packages/google-cloud-resource-settings/tests/unit/gapic/resourcesettings_v1/test_resource_settings_service.py +++ b/packages/google-cloud-resource-settings/tests/unit/gapic/resourcesettings_v1/test_resource_settings_service.py @@ -77,18 +77,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -340,7 +328,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -367,42 +355,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -415,7 +410,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_resource_settings_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -469,7 +464,7 @@ def test_resource_settings_service_client_service_account_always_use_jwt( def test_resource_settings_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -540,9 +535,7 @@ def test_resource_settings_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ResourceSettingsServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -963,20 +956,20 @@ def test_resource_settings_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -988,13 +981,11 @@ def test_resource_settings_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1010,8 +1001,7 @@ def test_resource_settings_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1177,8 +1167,8 @@ def test_resource_settings_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1207,7 +1197,7 @@ def test_resource_settings_service_client_create_channel_credentials_file( ) def test_list_settings(request_type, transport: str = "grpc"): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1237,7 +1227,7 @@ def test_list_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1254,7 +1244,7 @@ async def test_list_settings_async( transport: str = "grpc_asyncio", request_type=resource_settings.ListSettingsRequest ): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1289,7 +1279,7 @@ async def test_list_settings_async_from_dict(): def test_list_settings_field_headers(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1319,7 +1309,7 @@ def test_list_settings_field_headers(): @pytest.mark.asyncio async def test_list_settings_field_headers_async(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1350,7 +1340,7 @@ async def test_list_settings_field_headers_async(): def test_list_settings_flattened(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1374,7 +1364,7 @@ def test_list_settings_flattened(): def test_list_settings_flattened_error(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1389,7 +1379,7 @@ def test_list_settings_flattened_error(): @pytest.mark.asyncio async def test_list_settings_flattened_async(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1418,7 +1408,7 @@ async def test_list_settings_flattened_async(): @pytest.mark.asyncio async def test_list_settings_flattened_error_async(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1432,7 +1422,7 @@ async def test_list_settings_flattened_error_async(): def test_list_settings_pager(transport_name: str = "grpc"): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1482,7 +1472,7 @@ def test_list_settings_pager(transport_name: str = "grpc"): def test_list_settings_pages(transport_name: str = "grpc"): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1524,7 +1514,7 @@ def test_list_settings_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_settings_async_pager(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1574,7 +1564,7 @@ async def test_list_settings_async_pager(): @pytest.mark.asyncio async def test_list_settings_async_pages(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1629,7 +1619,7 @@ async def test_list_settings_async_pages(): ) def test_get_setting(request_type, transport: str = "grpc"): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1661,7 +1651,7 @@ def test_get_setting_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1678,7 +1668,7 @@ async def test_get_setting_async( transport: str = "grpc_asyncio", request_type=resource_settings.GetSettingRequest ): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1715,7 +1705,7 @@ async def test_get_setting_async_from_dict(): def test_get_setting_field_headers(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1745,7 +1735,7 @@ def test_get_setting_field_headers(): @pytest.mark.asyncio async def test_get_setting_field_headers_async(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1776,7 +1766,7 @@ async def test_get_setting_field_headers_async(): def test_get_setting_flattened(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1800,7 +1790,7 @@ def test_get_setting_flattened(): def test_get_setting_flattened_error(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1815,7 +1805,7 @@ def test_get_setting_flattened_error(): @pytest.mark.asyncio async def test_get_setting_flattened_async(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1844,7 +1834,7 @@ async def test_get_setting_flattened_async(): @pytest.mark.asyncio async def test_get_setting_flattened_error_async(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1865,7 +1855,7 @@ async def test_get_setting_flattened_error_async(): ) def test_update_setting(request_type, transport: str = "grpc"): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1897,7 +1887,7 @@ def test_update_setting_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1914,7 +1904,7 @@ async def test_update_setting_async( transport: str = "grpc_asyncio", request_type=resource_settings.UpdateSettingRequest ): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1951,7 +1941,7 @@ async def test_update_setting_async_from_dict(): def test_update_setting_field_headers(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1981,7 +1971,7 @@ def test_update_setting_field_headers(): @pytest.mark.asyncio async def test_update_setting_field_headers_async(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2019,7 +2009,7 @@ async def test_update_setting_field_headers_async(): ) def test_list_settings_rest(request_type): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2070,7 +2060,7 @@ def test_list_settings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2079,7 +2069,7 @@ def test_list_settings_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_settings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2096,7 +2086,7 @@ def test_list_settings_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2138,7 +2128,7 @@ def test_list_settings_rest_required_fields( def test_list_settings_rest_unset_required_fields(): transport = transports.ResourceSettingsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_settings._get_unset_required_fields({}) @@ -2157,7 +2147,7 @@ def test_list_settings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_settings_rest_interceptors(null_interceptor): transport = transports.ResourceSettingsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ResourceSettingsServiceRestInterceptor(), @@ -2215,7 +2205,7 @@ def test_list_settings_rest_bad_request( transport: str = "rest", request_type=resource_settings.ListSettingsRequest ): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2237,7 +2227,7 @@ def test_list_settings_rest_bad_request( def test_list_settings_rest_flattened(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2277,7 +2267,7 @@ def test_list_settings_rest_flattened(): def test_list_settings_rest_flattened_error(transport: str = "rest"): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2292,7 +2282,7 @@ def test_list_settings_rest_flattened_error(transport: str = "rest"): def test_list_settings_rest_pager(transport: str = "rest"): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2362,7 +2352,7 @@ def test_list_settings_rest_pager(transport: str = "rest"): ) def test_get_setting_rest(request_type): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2415,7 +2405,7 @@ def test_get_setting_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_setting._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2424,7 +2414,7 @@ def test_get_setting_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_setting._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("view",)) @@ -2435,7 +2425,7 @@ def test_get_setting_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2477,7 +2467,7 @@ def test_get_setting_rest_required_fields( def test_get_setting_rest_unset_required_fields(): transport = transports.ResourceSettingsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_setting._get_unset_required_fields({}) @@ -2487,7 +2477,7 @@ def test_get_setting_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_setting_rest_interceptors(null_interceptor): transport = transports.ResourceSettingsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ResourceSettingsServiceRestInterceptor(), @@ -2545,7 +2535,7 @@ def test_get_setting_rest_bad_request( transport: str = "rest", request_type=resource_settings.GetSettingRequest ): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2567,7 +2557,7 @@ def test_get_setting_rest_bad_request( def test_get_setting_rest_flattened(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2607,7 +2597,7 @@ def test_get_setting_rest_flattened(): def test_get_setting_rest_flattened_error(transport: str = "rest"): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2622,7 +2612,7 @@ def test_get_setting_rest_flattened_error(transport: str = "rest"): def test_get_setting_rest_error(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2635,7 +2625,7 @@ def test_get_setting_rest_error(): ) def test_update_setting_rest(request_type): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2772,21 +2762,21 @@ def test_update_setting_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_setting._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_setting._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2829,7 +2819,7 @@ def test_update_setting_rest_required_fields( def test_update_setting_rest_unset_required_fields(): transport = transports.ResourceSettingsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_setting._get_unset_required_fields({}) @@ -2839,7 +2829,7 @@ def test_update_setting_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_setting_rest_interceptors(null_interceptor): transport = transports.ResourceSettingsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ResourceSettingsServiceRestInterceptor(), @@ -2897,7 +2887,7 @@ def test_update_setting_rest_bad_request( transport: str = "rest", request_type=resource_settings.UpdateSettingRequest ): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2919,24 +2909,24 @@ def test_update_setting_rest_bad_request( def test_update_setting_rest_error(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ResourceSettingsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ResourceSettingsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ResourceSettingsServiceClient( @@ -2946,7 +2936,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ResourceSettingsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -2961,13 +2951,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ResourceSettingsServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ResourceSettingsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ResourceSettingsServiceClient( @@ -2979,7 +2968,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ResourceSettingsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ResourceSettingsServiceClient(transport=transport) assert client.transport is transport @@ -2988,13 +2977,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ResourceSettingsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ResourceSettingsServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -3011,7 +3000,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3025,7 +3014,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ResourceSettingsServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3033,7 +3022,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3045,7 +3034,7 @@ def test_resource_settings_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ResourceSettingsServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3057,7 +3046,7 @@ def test_resource_settings_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ResourceSettingsServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3091,7 +3080,7 @@ def test_resource_settings_service_base_transport_with_credentials_file(): "google.cloud.resourcesettings_v1.services.resource_settings_service.transports.ResourceSettingsServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ResourceSettingsServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3110,7 +3099,7 @@ def test_resource_settings_service_base_transport_with_adc(): "google.cloud.resourcesettings_v1.services.resource_settings_service.transports.ResourceSettingsServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ResourceSettingsServiceTransport() adc.assert_called_once() @@ -3118,7 +3107,7 @@ def test_resource_settings_service_base_transport_with_adc(): def test_resource_settings_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ResourceSettingsServiceClient() adc.assert_called_once_with( scopes=None, @@ -3138,7 +3127,7 @@ def test_resource_settings_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3187,7 +3176,7 @@ def test_resource_settings_service_transport_create_channel( ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3217,7 +3206,7 @@ def test_resource_settings_service_transport_create_channel( def test_resource_settings_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3255,7 +3244,7 @@ def test_resource_settings_service_grpc_transport_client_cert_source_for_mtls( def test_resource_settings_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3275,7 +3264,7 @@ def test_resource_settings_service_http_transport_client_cert_source_for_mtls(): ) def test_resource_settings_service_host_no_port(transport_name): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="resourcesettings.googleapis.com" ), @@ -3298,7 +3287,7 @@ def test_resource_settings_service_host_no_port(transport_name): ) def test_resource_settings_service_host_with_port(transport_name): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="resourcesettings.googleapis.com:8000" ), @@ -3318,8 +3307,8 @@ def test_resource_settings_service_host_with_port(transport_name): ], ) def test_resource_settings_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ResourceSettingsServiceClient( credentials=creds1, transport=transport_name, @@ -3389,7 +3378,7 @@ def test_resource_settings_service_transport_channel_mtls_with_client_cert_sourc mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3598,7 +3587,7 @@ def test_client_with_default_client_info(): transports.ResourceSettingsServiceTransport, "_prep_wrapped_messages" ) as prep: client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3608,7 +3597,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ResourceSettingsServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3617,7 +3606,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ResourceSettingsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -3636,7 +3625,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3653,7 +3642,7 @@ def test_client_ctx(): ] for transport in transports: client = ResourceSettingsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/google/cloud/retail/gapic_version.py b/packages/google-cloud-retail/google/cloud/retail/gapic_version.py index b115d6df2139..360a0d13ebdd 100644 --- a/packages/google-cloud-retail/google/cloud/retail/gapic_version.py +++ b/packages/google-cloud-retail/google/cloud/retail/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.19.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/gapic_version.py b/packages/google-cloud-retail/google/cloud/retail_v2/gapic_version.py index b115d6df2139..360a0d13ebdd 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/gapic_version.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.19.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/services/catalog_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2/services/catalog_service/client.py index 5e4538e3a486..2dbb692314a1 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/services/catalog_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/services/catalog_service/client.py @@ -457,6 +457,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -475,6 +476,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -549,17 +551,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CatalogServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CatalogServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/services/completion_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2/services/completion_service/client.py index 1d48757557f8..b13cea81602c 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/services/completion_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/services/completion_service/client.py @@ -391,6 +391,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -409,6 +410,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -483,17 +485,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CompletionServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CompletionServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/services/control_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2/services/control_service/client.py index d1d06e266803..5a7402929b3b 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/services/control_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/services/control_service/client.py @@ -413,6 +413,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -431,6 +432,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -505,17 +507,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ControlServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ControlServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/services/model_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2/services/model_service/client.py index 45011785028c..8e725315da8b 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/services/model_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/services/model_service/client.py @@ -426,6 +426,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -444,6 +445,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -518,17 +520,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ModelServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ModelServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/services/prediction_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2/services/prediction_service/client.py index 40a3ca1bdc70..aeee7b052c5a 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/services/prediction_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/services/prediction_service/client.py @@ -388,6 +388,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -406,6 +407,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -480,17 +482,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = PredictionServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = PredictionServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/services/product_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2/services/product_service/client.py index 253d04b406ca..696bffc3fcb6 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/services/product_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/services/product_service/client.py @@ -424,6 +424,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -442,6 +443,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -516,17 +518,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ProductServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ProductServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/services/search_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2/services/search_service/client.py index 154837c86efb..27c2e4c34724 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/services/search_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/services/search_service/client.py @@ -464,6 +464,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -482,6 +483,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -556,17 +558,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SearchServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SearchServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/services/serving_config_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2/services/serving_config_service/client.py index 766c05c6cfa1..b0245506a794 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/services/serving_config_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/services/serving_config_service/client.py @@ -413,6 +413,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -431,6 +432,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -505,17 +507,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ServingConfigServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ServingConfigServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/services/user_event_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2/services/user_event_service/client.py index a4da52b276dd..87eb63240f51 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/services/user_event_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/services/user_event_service/client.py @@ -423,6 +423,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -441,6 +442,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -515,17 +517,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = UserEventServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = UserEventServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/gapic_version.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/gapic_version.py index b115d6df2139..360a0d13ebdd 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/gapic_version.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.19.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/analytics_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/analytics_service/client.py index a5ca8df8e383..575b6bb74af4 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/analytics_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/analytics_service/client.py @@ -367,6 +367,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -385,6 +386,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -459,17 +461,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = AnalyticsServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = AnalyticsServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/catalog_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/catalog_service/client.py index ef57c6f9e911..bef6329f0997 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/catalog_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/catalog_service/client.py @@ -457,6 +457,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -475,6 +476,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -549,17 +551,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CatalogServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CatalogServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/completion_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/completion_service/client.py index 778eb8b9a3e6..a0493022c885 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/completion_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/completion_service/client.py @@ -391,6 +391,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -409,6 +410,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -483,17 +485,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CompletionServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CompletionServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/control_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/control_service/client.py index 8cd3f7d7735f..7e54e960a5a8 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/control_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/control_service/client.py @@ -413,6 +413,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -431,6 +432,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -505,17 +507,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ControlServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ControlServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/client.py index e706d7167c77..c07848853cd8 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/merchant_center_account_link_service/client.py @@ -425,6 +425,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -443,6 +444,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -517,19 +519,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ( - MerchantCenterAccountLinkServiceClient._DEFAULT_UNIVERSE - ) - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = MerchantCenterAccountLinkServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/model_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/model_service/client.py index 5ce6ab6b2e89..145fb188079f 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/model_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/model_service/client.py @@ -426,6 +426,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -444,6 +445,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -518,17 +520,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ModelServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ModelServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/prediction_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/prediction_service/client.py index 164a15d6506e..16630e4e01c0 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/prediction_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/prediction_service/client.py @@ -388,6 +388,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -406,6 +407,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -480,17 +482,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = PredictionServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = PredictionServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/product_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/product_service/client.py index 5c069f20a235..e59da15d5e08 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/product_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/product_service/client.py @@ -424,6 +424,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -442,6 +443,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -516,17 +518,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ProductServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ProductServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/search_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/search_service/client.py index 80f785db1622..c4817a1472ea 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/search_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/search_service/client.py @@ -464,6 +464,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -482,6 +483,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -556,17 +558,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SearchServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SearchServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/serving_config_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/serving_config_service/client.py index 572d889b1b53..dd1118990f58 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/serving_config_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/serving_config_service/client.py @@ -413,6 +413,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -431,6 +432,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -505,17 +507,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ServingConfigServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ServingConfigServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/user_event_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/user_event_service/client.py index e274b94a26f6..b0aad7c3aaa7 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/user_event_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2alpha/services/user_event_service/client.py @@ -423,6 +423,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -441,6 +442,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -515,17 +517,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = UserEventServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = UserEventServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/gapic_version.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/gapic_version.py index b115d6df2139..360a0d13ebdd 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/gapic_version.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.19.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/analytics_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/analytics_service/client.py index 6021f808b19f..2fe597c5f2bd 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/analytics_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/analytics_service/client.py @@ -367,6 +367,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -385,6 +386,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -459,17 +461,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = AnalyticsServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = AnalyticsServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/catalog_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/catalog_service/client.py index 946914aeb9d6..554b33cf52c7 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/catalog_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/catalog_service/client.py @@ -457,6 +457,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -475,6 +476,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -549,17 +551,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CatalogServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CatalogServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/completion_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/completion_service/client.py index 9183f0cf8c8c..db3a2c04e230 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/completion_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/completion_service/client.py @@ -391,6 +391,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -409,6 +410,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -483,17 +485,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CompletionServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CompletionServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/control_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/control_service/client.py index ff9bcdc83e55..5364a79b1b94 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/control_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/control_service/client.py @@ -413,6 +413,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -431,6 +432,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -505,17 +507,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ControlServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ControlServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/model_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/model_service/client.py index e20b4fe08d25..cacf7dbe417b 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/model_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/model_service/client.py @@ -426,6 +426,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -444,6 +445,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -518,17 +520,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ModelServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ModelServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/prediction_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/prediction_service/client.py index 333d3935e1c5..c1933ceaf81e 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/prediction_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/prediction_service/client.py @@ -388,6 +388,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -406,6 +407,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -480,17 +482,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = PredictionServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = PredictionServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/product_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/product_service/client.py index 9916a3a334d7..cd436f598d53 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/product_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/product_service/client.py @@ -424,6 +424,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -442,6 +443,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -516,17 +518,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ProductServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ProductServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/search_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/search_service/client.py index 94035e69279b..774d27244325 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/search_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/search_service/client.py @@ -464,6 +464,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -482,6 +483,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -556,17 +558,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SearchServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SearchServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/serving_config_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/serving_config_service/client.py index d23eae185534..1d6c8c1b24a8 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/serving_config_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/serving_config_service/client.py @@ -413,6 +413,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -431,6 +432,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -505,17 +507,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ServingConfigServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ServingConfigServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/user_event_service/client.py b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/user_event_service/client.py index 2b773aafaa55..9266b62149ca 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2beta/services/user_event_service/client.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2beta/services/user_event_service/client.py @@ -423,6 +423,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -441,6 +442,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -515,17 +517,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = UserEventServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = UserEventServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2.json index fc0389472559..1a31fd9b8913 100644 --- a/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-retail", - "version": "1.19.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2alpha.json index 938e67212736..aa123bb5763d 100644 --- a/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2alpha.json +++ b/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2alpha.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-retail", - "version": "1.19.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2beta.json index 341393b1a0aa..ef74a8c47298 100644 --- a/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated_samples/snippet_metadata_google.cloud.retail.v2beta.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-retail", - "version": "1.19.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-retail/setup.py b/packages/google-cloud-retail/setup.py index 20dba0281003..f953803bcc03 100644 --- a/packages/google-cloud-retail/setup.py +++ b/packages/google-cloud-retail/setup.py @@ -40,6 +40,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-retail/testing/constraints-3.7.txt b/packages/google-cloud-retail/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-retail/testing/constraints-3.7.txt +++ b/packages/google-cloud-retail/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_catalog_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_catalog_service.py index 0aaf3eeff077..0c99794e880f 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_catalog_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_catalog_service.py @@ -84,18 +84,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -322,7 +310,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -349,42 +337,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -395,7 +390,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_catalog_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -447,7 +442,7 @@ def test_catalog_service_client_service_account_always_use_jwt( ], ) def test_catalog_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -510,9 +505,7 @@ def test_catalog_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CatalogServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -911,20 +904,20 @@ def test_catalog_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -936,13 +929,11 @@ def test_catalog_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -958,8 +949,7 @@ def test_catalog_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1112,8 +1102,8 @@ def test_catalog_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1142,7 +1132,7 @@ def test_catalog_service_client_create_channel_credentials_file( ) def test_list_catalogs(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1172,7 +1162,7 @@ def test_list_catalogs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1189,7 +1179,7 @@ async def test_list_catalogs_async( transport: str = "grpc_asyncio", request_type=catalog_service.ListCatalogsRequest ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1224,7 +1214,7 @@ async def test_list_catalogs_async_from_dict(): def test_list_catalogs_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1254,7 +1244,7 @@ def test_list_catalogs_field_headers(): @pytest.mark.asyncio async def test_list_catalogs_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1285,7 +1275,7 @@ async def test_list_catalogs_field_headers_async(): def test_list_catalogs_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1309,7 +1299,7 @@ def test_list_catalogs_flattened(): def test_list_catalogs_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1324,7 +1314,7 @@ def test_list_catalogs_flattened_error(): @pytest.mark.asyncio async def test_list_catalogs_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1353,7 +1343,7 @@ async def test_list_catalogs_flattened_async(): @pytest.mark.asyncio async def test_list_catalogs_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1367,7 +1357,7 @@ async def test_list_catalogs_flattened_error_async(): def test_list_catalogs_pager(transport_name: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1417,7 +1407,7 @@ def test_list_catalogs_pager(transport_name: str = "grpc"): def test_list_catalogs_pages(transport_name: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1459,7 +1449,7 @@ def test_list_catalogs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_catalogs_async_pager(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1509,7 +1499,7 @@ async def test_list_catalogs_async_pager(): @pytest.mark.asyncio async def test_list_catalogs_async_pages(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1564,7 +1554,7 @@ async def test_list_catalogs_async_pages(): ) def test_update_catalog(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1596,7 +1586,7 @@ def test_update_catalog_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1613,7 +1603,7 @@ async def test_update_catalog_async( transport: str = "grpc_asyncio", request_type=catalog_service.UpdateCatalogRequest ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1650,7 +1640,7 @@ async def test_update_catalog_async_from_dict(): def test_update_catalog_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1680,7 +1670,7 @@ def test_update_catalog_field_headers(): @pytest.mark.asyncio async def test_update_catalog_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1709,7 +1699,7 @@ async def test_update_catalog_field_headers_async(): def test_update_catalog_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1737,7 +1727,7 @@ def test_update_catalog_flattened(): def test_update_catalog_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1753,7 +1743,7 @@ def test_update_catalog_flattened_error(): @pytest.mark.asyncio async def test_update_catalog_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1784,7 +1774,7 @@ async def test_update_catalog_flattened_async(): @pytest.mark.asyncio async def test_update_catalog_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1806,7 +1796,7 @@ async def test_update_catalog_flattened_error_async(): ) def test_set_default_branch(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1835,7 +1825,7 @@ def test_set_default_branch_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1855,7 +1845,7 @@ async def test_set_default_branch_async( request_type=catalog_service.SetDefaultBranchRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1887,7 +1877,7 @@ async def test_set_default_branch_async_from_dict(): def test_set_default_branch_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1919,7 +1909,7 @@ def test_set_default_branch_field_headers(): @pytest.mark.asyncio async def test_set_default_branch_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1950,7 +1940,7 @@ async def test_set_default_branch_field_headers_async(): def test_set_default_branch_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1976,7 +1966,7 @@ def test_set_default_branch_flattened(): def test_set_default_branch_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1991,7 +1981,7 @@ def test_set_default_branch_flattened_error(): @pytest.mark.asyncio async def test_set_default_branch_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2020,7 +2010,7 @@ async def test_set_default_branch_flattened_async(): @pytest.mark.asyncio async def test_set_default_branch_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2041,7 +2031,7 @@ async def test_set_default_branch_flattened_error_async(): ) def test_get_default_branch(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2075,7 +2065,7 @@ def test_get_default_branch_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2095,7 +2085,7 @@ async def test_get_default_branch_async( request_type=catalog_service.GetDefaultBranchRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2134,7 +2124,7 @@ async def test_get_default_branch_async_from_dict(): def test_get_default_branch_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2166,7 +2156,7 @@ def test_get_default_branch_field_headers(): @pytest.mark.asyncio async def test_get_default_branch_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2199,7 +2189,7 @@ async def test_get_default_branch_field_headers_async(): def test_get_default_branch_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2225,7 +2215,7 @@ def test_get_default_branch_flattened(): def test_get_default_branch_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2240,7 +2230,7 @@ def test_get_default_branch_flattened_error(): @pytest.mark.asyncio async def test_get_default_branch_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2271,7 +2261,7 @@ async def test_get_default_branch_flattened_async(): @pytest.mark.asyncio async def test_get_default_branch_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2292,7 +2282,7 @@ async def test_get_default_branch_flattened_error_async(): ) def test_get_completion_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2347,7 +2337,7 @@ def test_get_completion_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2367,7 +2357,7 @@ async def test_get_completion_config_async( request_type=catalog_service.GetCompletionConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2427,7 +2417,7 @@ async def test_get_completion_config_async_from_dict(): def test_get_completion_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2459,7 +2449,7 @@ def test_get_completion_config_field_headers(): @pytest.mark.asyncio async def test_get_completion_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2492,7 +2482,7 @@ async def test_get_completion_config_field_headers_async(): def test_get_completion_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2518,7 +2508,7 @@ def test_get_completion_config_flattened(): def test_get_completion_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2533,7 +2523,7 @@ def test_get_completion_config_flattened_error(): @pytest.mark.asyncio async def test_get_completion_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2564,7 +2554,7 @@ async def test_get_completion_config_flattened_async(): @pytest.mark.asyncio async def test_get_completion_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2585,7 +2575,7 @@ async def test_get_completion_config_flattened_error_async(): ) def test_update_completion_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2640,7 +2630,7 @@ def test_update_completion_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2660,7 +2650,7 @@ async def test_update_completion_config_async( request_type=catalog_service.UpdateCompletionConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2720,7 +2710,7 @@ async def test_update_completion_config_async_from_dict(): def test_update_completion_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2752,7 +2742,7 @@ def test_update_completion_config_field_headers(): @pytest.mark.asyncio async def test_update_completion_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2785,7 +2775,7 @@ async def test_update_completion_config_field_headers_async(): def test_update_completion_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2815,7 +2805,7 @@ def test_update_completion_config_flattened(): def test_update_completion_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2831,7 +2821,7 @@ def test_update_completion_config_flattened_error(): @pytest.mark.asyncio async def test_update_completion_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2866,7 +2856,7 @@ async def test_update_completion_config_flattened_async(): @pytest.mark.asyncio async def test_update_completion_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2888,7 +2878,7 @@ async def test_update_completion_config_flattened_error_async(): ) def test_get_attributes_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2925,7 +2915,7 @@ def test_get_attributes_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2945,7 +2935,7 @@ async def test_get_attributes_config_async( request_type=catalog_service.GetAttributesConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2987,7 +2977,7 @@ async def test_get_attributes_config_async_from_dict(): def test_get_attributes_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3019,7 +3009,7 @@ def test_get_attributes_config_field_headers(): @pytest.mark.asyncio async def test_get_attributes_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3052,7 +3042,7 @@ async def test_get_attributes_config_field_headers_async(): def test_get_attributes_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3078,7 +3068,7 @@ def test_get_attributes_config_flattened(): def test_get_attributes_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3093,7 +3083,7 @@ def test_get_attributes_config_flattened_error(): @pytest.mark.asyncio async def test_get_attributes_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3124,7 +3114,7 @@ async def test_get_attributes_config_flattened_async(): @pytest.mark.asyncio async def test_get_attributes_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3145,7 +3135,7 @@ async def test_get_attributes_config_flattened_error_async(): ) def test_update_attributes_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3182,7 +3172,7 @@ def test_update_attributes_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3202,7 +3192,7 @@ async def test_update_attributes_config_async( request_type=catalog_service.UpdateAttributesConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3244,7 +3234,7 @@ async def test_update_attributes_config_async_from_dict(): def test_update_attributes_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3276,7 +3266,7 @@ def test_update_attributes_config_field_headers(): @pytest.mark.asyncio async def test_update_attributes_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3309,7 +3299,7 @@ async def test_update_attributes_config_field_headers_async(): def test_update_attributes_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3339,7 +3329,7 @@ def test_update_attributes_config_flattened(): def test_update_attributes_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3355,7 +3345,7 @@ def test_update_attributes_config_flattened_error(): @pytest.mark.asyncio async def test_update_attributes_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3390,7 +3380,7 @@ async def test_update_attributes_config_flattened_async(): @pytest.mark.asyncio async def test_update_attributes_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3412,7 +3402,7 @@ async def test_update_attributes_config_flattened_error_async(): ) def test_add_catalog_attribute(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3449,7 +3439,7 @@ def test_add_catalog_attribute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3469,7 +3459,7 @@ async def test_add_catalog_attribute_async( request_type=catalog_service.AddCatalogAttributeRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3511,7 +3501,7 @@ async def test_add_catalog_attribute_async_from_dict(): def test_add_catalog_attribute_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3543,7 +3533,7 @@ def test_add_catalog_attribute_field_headers(): @pytest.mark.asyncio async def test_add_catalog_attribute_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3583,7 +3573,7 @@ async def test_add_catalog_attribute_field_headers_async(): ) def test_remove_catalog_attribute(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3620,7 +3610,7 @@ def test_remove_catalog_attribute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3640,7 +3630,7 @@ async def test_remove_catalog_attribute_async( request_type=catalog_service.RemoveCatalogAttributeRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3682,7 +3672,7 @@ async def test_remove_catalog_attribute_async_from_dict(): def test_remove_catalog_attribute_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3714,7 +3704,7 @@ def test_remove_catalog_attribute_field_headers(): @pytest.mark.asyncio async def test_remove_catalog_attribute_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3754,7 +3744,7 @@ async def test_remove_catalog_attribute_field_headers_async(): ) def test_replace_catalog_attribute(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3791,7 +3781,7 @@ def test_replace_catalog_attribute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3811,7 +3801,7 @@ async def test_replace_catalog_attribute_async( request_type=catalog_service.ReplaceCatalogAttributeRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3853,7 +3843,7 @@ async def test_replace_catalog_attribute_async_from_dict(): def test_replace_catalog_attribute_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3885,7 +3875,7 @@ def test_replace_catalog_attribute_field_headers(): @pytest.mark.asyncio async def test_replace_catalog_attribute_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3925,7 +3915,7 @@ async def test_replace_catalog_attribute_field_headers_async(): ) def test_list_catalogs_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3976,7 +3966,7 @@ def test_list_catalogs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_catalogs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3985,7 +3975,7 @@ def test_list_catalogs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_catalogs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4001,7 +3991,7 @@ def test_list_catalogs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4043,7 +4033,7 @@ def test_list_catalogs_rest_required_fields( def test_list_catalogs_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_catalogs._get_unset_required_fields({}) @@ -4061,7 +4051,7 @@ def test_list_catalogs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_catalogs_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4119,7 +4109,7 @@ def test_list_catalogs_rest_bad_request( transport: str = "rest", request_type=catalog_service.ListCatalogsRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4141,7 +4131,7 @@ def test_list_catalogs_rest_bad_request( def test_list_catalogs_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4182,7 +4172,7 @@ def test_list_catalogs_rest_flattened(): def test_list_catalogs_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4197,7 +4187,7 @@ def test_list_catalogs_rest_flattened_error(transport: str = "rest"): def test_list_catalogs_rest_pager(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4267,7 +4257,7 @@ def test_list_catalogs_rest_pager(transport: str = "rest"): ) def test_update_catalog_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4396,14 +4386,14 @@ def test_update_catalog_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_catalog._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_catalog._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -4412,7 +4402,7 @@ def test_update_catalog_rest_required_fields( # verify required fields with non-default values are left alone client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4455,7 +4445,7 @@ def test_update_catalog_rest_required_fields( def test_update_catalog_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_catalog._get_unset_required_fields({}) @@ -4465,7 +4455,7 @@ def test_update_catalog_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_catalog_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4521,7 +4511,7 @@ def test_update_catalog_rest_bad_request( transport: str = "rest", request_type=catalog_service.UpdateCatalogRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4545,7 +4535,7 @@ def test_update_catalog_rest_bad_request( def test_update_catalog_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4590,7 +4580,7 @@ def test_update_catalog_rest_flattened(): def test_update_catalog_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4606,7 +4596,7 @@ def test_update_catalog_rest_flattened_error(transport: str = "rest"): def test_update_catalog_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4619,7 +4609,7 @@ def test_update_catalog_rest_error(): ) def test_set_default_branch_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4648,7 +4638,7 @@ def test_set_default_branch_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_default_branch_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4698,7 +4688,7 @@ def test_set_default_branch_rest_bad_request( transport: str = "rest", request_type=catalog_service.SetDefaultBranchRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4720,7 +4710,7 @@ def test_set_default_branch_rest_bad_request( def test_set_default_branch_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4762,7 +4752,7 @@ def test_set_default_branch_rest_flattened(): def test_set_default_branch_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4777,7 +4767,7 @@ def test_set_default_branch_rest_flattened_error(transport: str = "rest"): def test_set_default_branch_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4790,7 +4780,7 @@ def test_set_default_branch_rest_error(): ) def test_get_default_branch_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4826,7 +4816,7 @@ def test_get_default_branch_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_default_branch_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4884,7 +4874,7 @@ def test_get_default_branch_rest_bad_request( transport: str = "rest", request_type=catalog_service.GetDefaultBranchRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4906,7 +4896,7 @@ def test_get_default_branch_rest_bad_request( def test_get_default_branch_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4950,7 +4940,7 @@ def test_get_default_branch_rest_flattened(): def test_get_default_branch_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4965,7 +4955,7 @@ def test_get_default_branch_rest_flattened_error(transport: str = "rest"): def test_get_default_branch_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4978,7 +4968,7 @@ def test_get_default_branch_rest_error(): ) def test_get_completion_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5054,7 +5044,7 @@ def test_get_completion_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_completion_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5063,7 +5053,7 @@ def test_get_completion_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_completion_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5072,7 +5062,7 @@ def test_get_completion_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5114,7 +5104,7 @@ def test_get_completion_config_rest_required_fields( def test_get_completion_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_completion_config._get_unset_required_fields({}) @@ -5124,7 +5114,7 @@ def test_get_completion_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_completion_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -5182,7 +5172,7 @@ def test_get_completion_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.GetCompletionConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5206,7 +5196,7 @@ def test_get_completion_config_rest_bad_request( def test_get_completion_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5250,7 +5240,7 @@ def test_get_completion_config_rest_flattened(): def test_get_completion_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5265,7 +5255,7 @@ def test_get_completion_config_rest_flattened_error(transport: str = "rest"): def test_get_completion_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5278,7 +5268,7 @@ def test_get_completion_config_rest_error(): ) def test_update_completion_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5446,14 +5436,14 @@ def test_update_completion_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_completion_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_completion_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5462,7 +5452,7 @@ def test_update_completion_config_rest_required_fields( # verify required fields with non-default values are left alone client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5505,7 +5495,7 @@ def test_update_completion_config_rest_required_fields( def test_update_completion_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_completion_config._get_unset_required_fields({}) @@ -5515,7 +5505,7 @@ def test_update_completion_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_completion_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -5573,7 +5563,7 @@ def test_update_completion_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.UpdateCompletionConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5599,7 +5589,7 @@ def test_update_completion_config_rest_bad_request( def test_update_completion_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5646,7 +5636,7 @@ def test_update_completion_config_rest_flattened(): def test_update_completion_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5662,7 +5652,7 @@ def test_update_completion_config_rest_flattened_error(transport: str = "rest"): def test_update_completion_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5675,7 +5665,7 @@ def test_update_completion_config_rest_error(): ) def test_get_attributes_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5733,7 +5723,7 @@ def test_get_attributes_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_attributes_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5742,7 +5732,7 @@ def test_get_attributes_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_attributes_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5751,7 +5741,7 @@ def test_get_attributes_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5793,7 +5783,7 @@ def test_get_attributes_config_rest_required_fields( def test_get_attributes_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_attributes_config._get_unset_required_fields({}) @@ -5803,7 +5793,7 @@ def test_get_attributes_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_attributes_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -5861,7 +5851,7 @@ def test_get_attributes_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.GetAttributesConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5885,7 +5875,7 @@ def test_get_attributes_config_rest_bad_request( def test_get_attributes_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5929,7 +5919,7 @@ def test_get_attributes_config_rest_flattened(): def test_get_attributes_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5944,7 +5934,7 @@ def test_get_attributes_config_rest_flattened_error(transport: str = "rest"): def test_get_attributes_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5957,7 +5947,7 @@ def test_get_attributes_config_rest_error(): ) def test_update_attributes_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6090,14 +6080,14 @@ def test_update_attributes_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_attributes_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_attributes_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -6106,7 +6096,7 @@ def test_update_attributes_config_rest_required_fields( # verify required fields with non-default values are left alone client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6149,7 +6139,7 @@ def test_update_attributes_config_rest_required_fields( def test_update_attributes_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_attributes_config._get_unset_required_fields({}) @@ -6159,7 +6149,7 @@ def test_update_attributes_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_attributes_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6217,7 +6207,7 @@ def test_update_attributes_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.UpdateAttributesConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6243,7 +6233,7 @@ def test_update_attributes_config_rest_bad_request( def test_update_attributes_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6290,7 +6280,7 @@ def test_update_attributes_config_rest_flattened(): def test_update_attributes_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6306,7 +6296,7 @@ def test_update_attributes_config_rest_flattened_error(transport: str = "rest"): def test_update_attributes_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6319,7 +6309,7 @@ def test_update_attributes_config_rest_error(): ) def test_add_catalog_attribute_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6377,7 +6367,7 @@ def test_add_catalog_attribute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6386,7 +6376,7 @@ def test_add_catalog_attribute_rest_required_fields( jsonified_request["attributesConfig"] = "attributes_config_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6395,7 +6385,7 @@ def test_add_catalog_attribute_rest_required_fields( assert jsonified_request["attributesConfig"] == "attributes_config_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6438,7 +6428,7 @@ def test_add_catalog_attribute_rest_required_fields( def test_add_catalog_attribute_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_catalog_attribute._get_unset_required_fields({}) @@ -6456,7 +6446,7 @@ def test_add_catalog_attribute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_catalog_attribute_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6514,7 +6504,7 @@ def test_add_catalog_attribute_rest_bad_request( transport: str = "rest", request_type=catalog_service.AddCatalogAttributeRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6538,7 +6528,7 @@ def test_add_catalog_attribute_rest_bad_request( def test_add_catalog_attribute_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6551,7 +6541,7 @@ def test_add_catalog_attribute_rest_error(): ) def test_remove_catalog_attribute_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6610,7 +6600,7 @@ def test_remove_catalog_attribute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6620,7 +6610,7 @@ def test_remove_catalog_attribute_rest_required_fields( jsonified_request["key"] = "key_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6631,7 +6621,7 @@ def test_remove_catalog_attribute_rest_required_fields( assert jsonified_request["key"] == "key_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6674,7 +6664,7 @@ def test_remove_catalog_attribute_rest_required_fields( def test_remove_catalog_attribute_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_catalog_attribute._get_unset_required_fields({}) @@ -6692,7 +6682,7 @@ def test_remove_catalog_attribute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_catalog_attribute_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6750,7 +6740,7 @@ def test_remove_catalog_attribute_rest_bad_request( transport: str = "rest", request_type=catalog_service.RemoveCatalogAttributeRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6774,7 +6764,7 @@ def test_remove_catalog_attribute_rest_bad_request( def test_remove_catalog_attribute_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6787,7 +6777,7 @@ def test_remove_catalog_attribute_rest_error(): ) def test_replace_catalog_attribute_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6845,7 +6835,7 @@ def test_replace_catalog_attribute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).replace_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6854,7 +6844,7 @@ def test_replace_catalog_attribute_rest_required_fields( jsonified_request["attributesConfig"] = "attributes_config_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).replace_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6863,7 +6853,7 @@ def test_replace_catalog_attribute_rest_required_fields( assert jsonified_request["attributesConfig"] == "attributes_config_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6906,7 +6896,7 @@ def test_replace_catalog_attribute_rest_required_fields( def test_replace_catalog_attribute_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.replace_catalog_attribute._get_unset_required_fields({}) @@ -6924,7 +6914,7 @@ def test_replace_catalog_attribute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_replace_catalog_attribute_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6982,7 +6972,7 @@ def test_replace_catalog_attribute_rest_bad_request( transport: str = "rest", request_type=catalog_service.ReplaceCatalogAttributeRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7006,24 +6996,24 @@ def test_replace_catalog_attribute_rest_bad_request( def test_replace_catalog_attribute_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CatalogServiceClient( @@ -7033,7 +7023,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7048,13 +7038,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CatalogServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CatalogServiceClient( @@ -7066,7 +7055,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CatalogServiceClient(transport=transport) assert client.transport is transport @@ -7075,13 +7064,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CatalogServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7098,7 +7087,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7112,7 +7101,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CatalogServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7120,7 +7109,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7132,7 +7121,7 @@ def test_catalog_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CatalogServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7144,7 +7133,7 @@ def test_catalog_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CatalogServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7188,7 +7177,7 @@ def test_catalog_service_base_transport_with_credentials_file(): "google.cloud.retail_v2.services.catalog_service.transports.CatalogServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CatalogServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7207,7 +7196,7 @@ def test_catalog_service_base_transport_with_adc(): "google.cloud.retail_v2.services.catalog_service.transports.CatalogServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CatalogServiceTransport() adc.assert_called_once() @@ -7215,7 +7204,7 @@ def test_catalog_service_base_transport_with_adc(): def test_catalog_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CatalogServiceClient() adc.assert_called_once_with( scopes=None, @@ -7235,7 +7224,7 @@ def test_catalog_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7282,7 +7271,7 @@ def test_catalog_service_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7310,7 +7299,7 @@ def test_catalog_service_transport_create_channel(transport_class, grpc_helpers) ], ) def test_catalog_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7348,7 +7337,7 @@ def test_catalog_service_grpc_transport_client_cert_source_for_mtls(transport_cl def test_catalog_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7368,7 +7357,7 @@ def test_catalog_service_http_transport_client_cert_source_for_mtls(): ) def test_catalog_service_host_no_port(transport_name): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -7391,7 +7380,7 @@ def test_catalog_service_host_no_port(transport_name): ) def test_catalog_service_host_with_port(transport_name): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -7411,8 +7400,8 @@ def test_catalog_service_host_with_port(transport_name): ], ) def test_catalog_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CatalogServiceClient( credentials=creds1, transport=transport_name, @@ -7506,7 +7495,7 @@ def test_catalog_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -7799,7 +7788,7 @@ def test_client_with_default_client_info(): transports.CatalogServiceTransport, "_prep_wrapped_messages" ) as prep: client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7809,7 +7798,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CatalogServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7818,7 +7807,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -7833,7 +7822,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7863,7 +7852,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -7891,7 +7880,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7921,7 +7910,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -7947,7 +7936,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7972,7 +7961,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7998,7 +7987,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8027,7 +8016,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8056,7 +8045,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8074,7 +8063,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8092,7 +8081,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8117,7 +8106,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8143,7 +8132,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8172,7 +8161,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8201,7 +8190,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8219,7 +8208,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8243,7 +8232,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8260,7 +8249,7 @@ def test_client_ctx(): ] for transport in transports: client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_completion_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_completion_service.py index 9b48a85c0374..1514e844849c 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_completion_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_completion_service.py @@ -88,18 +88,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -335,7 +323,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -362,42 +350,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -410,7 +405,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_completion_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -464,7 +459,7 @@ def test_completion_service_client_service_account_always_use_jwt( def test_completion_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -527,9 +522,7 @@ def test_completion_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CompletionServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -948,20 +941,20 @@ def test_completion_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -973,13 +966,11 @@ def test_completion_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -995,8 +986,7 @@ def test_completion_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1154,8 +1144,8 @@ def test_completion_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1184,7 +1174,7 @@ def test_completion_service_client_create_channel_credentials_file( ) def test_complete_query(request_type, transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1214,7 +1204,7 @@ def test_complete_query_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1232,7 +1222,7 @@ async def test_complete_query_async( request_type=completion_service.CompleteQueryRequest, ): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1267,7 +1257,7 @@ async def test_complete_query_async_from_dict(): def test_complete_query_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1297,7 +1287,7 @@ def test_complete_query_field_headers(): @pytest.mark.asyncio async def test_complete_query_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1335,7 +1325,7 @@ async def test_complete_query_field_headers_async(): ) def test_import_completion_data(request_type, transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1364,7 +1354,7 @@ def test_import_completion_data_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1384,7 +1374,7 @@ async def test_import_completion_data_async( request_type=import_config.ImportCompletionDataRequest, ): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1418,7 +1408,7 @@ async def test_import_completion_data_async_from_dict(): def test_import_completion_data_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1450,7 +1440,7 @@ def test_import_completion_data_field_headers(): @pytest.mark.asyncio async def test_import_completion_data_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1490,7 +1480,7 @@ async def test_import_completion_data_field_headers_async(): ) def test_complete_query_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1543,7 +1533,7 @@ def test_complete_query_rest_required_fields( assert "query" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).complete_query._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1555,7 +1545,7 @@ def test_complete_query_rest_required_fields( jsonified_request["query"] = "query_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).complete_query._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -1578,7 +1568,7 @@ def test_complete_query_rest_required_fields( assert jsonified_request["query"] == "query_value" client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1626,7 +1616,7 @@ def test_complete_query_rest_required_fields( def test_complete_query_rest_unset_required_fields(): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.complete_query._get_unset_required_fields({}) @@ -1654,7 +1644,7 @@ def test_complete_query_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_complete_query_rest_interceptors(null_interceptor): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CompletionServiceRestInterceptor(), @@ -1712,7 +1702,7 @@ def test_complete_query_rest_bad_request( transport: str = "rest", request_type=completion_service.CompleteQueryRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1734,7 +1724,7 @@ def test_complete_query_rest_bad_request( def test_complete_query_rest_error(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -1747,7 +1737,7 @@ def test_complete_query_rest_error(): ) def test_import_completion_data_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1793,7 +1783,7 @@ def test_import_completion_data_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_completion_data._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1802,7 +1792,7 @@ def test_import_completion_data_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_completion_data._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1811,7 +1801,7 @@ def test_import_completion_data_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1851,7 +1841,7 @@ def test_import_completion_data_rest_required_fields( def test_import_completion_data_rest_unset_required_fields(): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_completion_data._get_unset_required_fields({}) @@ -1869,7 +1859,7 @@ def test_import_completion_data_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_completion_data_rest_interceptors(null_interceptor): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CompletionServiceRestInterceptor(), @@ -1929,7 +1919,7 @@ def test_import_completion_data_rest_bad_request( transport: str = "rest", request_type=import_config.ImportCompletionDataRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1951,24 +1941,24 @@ def test_import_completion_data_rest_bad_request( def test_import_completion_data_rest_error(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CompletionServiceClient( @@ -1978,7 +1968,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1993,13 +1983,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CompletionServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CompletionServiceClient( @@ -2011,7 +2000,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CompletionServiceClient(transport=transport) assert client.transport is transport @@ -2020,13 +2009,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CompletionServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -2043,7 +2032,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -2057,7 +2046,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CompletionServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -2065,7 +2054,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -2077,7 +2066,7 @@ def test_completion_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CompletionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -2089,7 +2078,7 @@ def test_completion_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CompletionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -2129,7 +2118,7 @@ def test_completion_service_base_transport_with_credentials_file(): "google.cloud.retail_v2.services.completion_service.transports.CompletionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CompletionServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -2148,7 +2137,7 @@ def test_completion_service_base_transport_with_adc(): "google.cloud.retail_v2.services.completion_service.transports.CompletionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CompletionServiceTransport() adc.assert_called_once() @@ -2156,7 +2145,7 @@ def test_completion_service_base_transport_with_adc(): def test_completion_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CompletionServiceClient() adc.assert_called_once_with( scopes=None, @@ -2176,7 +2165,7 @@ def test_completion_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2223,7 +2212,7 @@ def test_completion_service_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2251,7 +2240,7 @@ def test_completion_service_transport_create_channel(transport_class, grpc_helpe ], ) def test_completion_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2289,7 +2278,7 @@ def test_completion_service_grpc_transport_client_cert_source_for_mtls(transport def test_completion_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2301,7 +2290,7 @@ def test_completion_service_http_transport_client_cert_source_for_mtls(): def test_completion_service_rest_lro_client(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -2326,7 +2315,7 @@ def test_completion_service_rest_lro_client(): ) def test_completion_service_host_no_port(transport_name): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -2349,7 +2338,7 @@ def test_completion_service_host_no_port(transport_name): ) def test_completion_service_host_with_port(transport_name): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -2369,8 +2358,8 @@ def test_completion_service_host_with_port(transport_name): ], ) def test_completion_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CompletionServiceClient( credentials=creds1, transport=transport_name, @@ -2437,7 +2426,7 @@ def test_completion_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2515,7 +2504,7 @@ def test_completion_service_transport_channel_mtls_with_adc(transport_class): def test_completion_service_grpc_lro_client(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -2532,7 +2521,7 @@ def test_completion_service_grpc_lro_client(): def test_completion_service_grpc_lro_async_client(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -2683,7 +2672,7 @@ def test_client_with_default_client_info(): transports.CompletionServiceTransport, "_prep_wrapped_messages" ) as prep: client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2693,7 +2682,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CompletionServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2702,7 +2691,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2717,7 +2706,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2747,7 +2736,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -2775,7 +2764,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2805,7 +2794,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -2831,7 +2820,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2856,7 +2845,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2882,7 +2871,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2911,7 +2900,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2940,7 +2929,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2958,7 +2947,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2976,7 +2965,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3001,7 +2990,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3027,7 +3016,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3056,7 +3045,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3085,7 +3074,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3103,7 +3092,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3127,7 +3116,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3144,7 +3133,7 @@ def test_client_ctx(): ] for transport in transports: client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_control_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_control_service.py index 65b1f6e78372..f822f0ecf0ab 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_control_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_control_service.py @@ -84,18 +84,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -322,7 +310,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -349,42 +337,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -395,7 +390,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_control_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -447,7 +442,7 @@ def test_control_service_client_service_account_always_use_jwt( ], ) def test_control_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -510,9 +505,7 @@ def test_control_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ControlServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -911,20 +904,20 @@ def test_control_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -936,13 +929,11 @@ def test_control_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -958,8 +949,7 @@ def test_control_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1112,8 +1102,8 @@ def test_control_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1142,7 +1132,7 @@ def test_control_service_client_create_channel_credentials_file( ) def test_create_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1186,7 +1176,7 @@ def test_create_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1203,7 +1193,7 @@ async def test_create_control_async( transport: str = "grpc_asyncio", request_type=control_service.CreateControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1252,7 +1242,7 @@ async def test_create_control_async_from_dict(): def test_create_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1282,7 +1272,7 @@ def test_create_control_field_headers(): @pytest.mark.asyncio async def test_create_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1311,7 +1301,7 @@ async def test_create_control_field_headers_async(): def test_create_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1347,7 +1337,7 @@ def test_create_control_flattened(): def test_create_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1366,7 +1356,7 @@ def test_create_control_flattened_error(): @pytest.mark.asyncio async def test_create_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1405,7 +1395,7 @@ async def test_create_control_flattened_async(): @pytest.mark.asyncio async def test_create_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1430,7 +1420,7 @@ async def test_create_control_flattened_error_async(): ) def test_delete_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1457,7 +1447,7 @@ def test_delete_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1474,7 +1464,7 @@ async def test_delete_control_async( transport: str = "grpc_asyncio", request_type=control_service.DeleteControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1504,7 +1494,7 @@ async def test_delete_control_async_from_dict(): def test_delete_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1534,7 +1524,7 @@ def test_delete_control_field_headers(): @pytest.mark.asyncio async def test_delete_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1563,7 +1553,7 @@ async def test_delete_control_field_headers_async(): def test_delete_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1587,7 +1577,7 @@ def test_delete_control_flattened(): def test_delete_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1602,7 +1592,7 @@ def test_delete_control_flattened_error(): @pytest.mark.asyncio async def test_delete_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1629,7 +1619,7 @@ async def test_delete_control_flattened_async(): @pytest.mark.asyncio async def test_delete_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1650,7 +1640,7 @@ async def test_delete_control_flattened_error_async(): ) def test_update_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1694,7 +1684,7 @@ def test_update_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1711,7 +1701,7 @@ async def test_update_control_async( transport: str = "grpc_asyncio", request_type=control_service.UpdateControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1760,7 +1750,7 @@ async def test_update_control_async_from_dict(): def test_update_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1790,7 +1780,7 @@ def test_update_control_field_headers(): @pytest.mark.asyncio async def test_update_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1819,7 +1809,7 @@ async def test_update_control_field_headers_async(): def test_update_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1851,7 +1841,7 @@ def test_update_control_flattened(): def test_update_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1869,7 +1859,7 @@ def test_update_control_flattened_error(): @pytest.mark.asyncio async def test_update_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1904,7 +1894,7 @@ async def test_update_control_flattened_async(): @pytest.mark.asyncio async def test_update_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1928,7 +1918,7 @@ async def test_update_control_flattened_error_async(): ) def test_get_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1972,7 +1962,7 @@ def test_get_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1989,7 +1979,7 @@ async def test_get_control_async( transport: str = "grpc_asyncio", request_type=control_service.GetControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2038,7 +2028,7 @@ async def test_get_control_async_from_dict(): def test_get_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2068,7 +2058,7 @@ def test_get_control_field_headers(): @pytest.mark.asyncio async def test_get_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2097,7 +2087,7 @@ async def test_get_control_field_headers_async(): def test_get_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2121,7 +2111,7 @@ def test_get_control_flattened(): def test_get_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2136,7 +2126,7 @@ def test_get_control_flattened_error(): @pytest.mark.asyncio async def test_get_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2163,7 +2153,7 @@ async def test_get_control_flattened_async(): @pytest.mark.asyncio async def test_get_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2184,7 +2174,7 @@ async def test_get_control_flattened_error_async(): ) def test_list_controls(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2214,7 +2204,7 @@ def test_list_controls_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2231,7 +2221,7 @@ async def test_list_controls_async( transport: str = "grpc_asyncio", request_type=control_service.ListControlsRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2266,7 +2256,7 @@ async def test_list_controls_async_from_dict(): def test_list_controls_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2296,7 +2286,7 @@ def test_list_controls_field_headers(): @pytest.mark.asyncio async def test_list_controls_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2327,7 +2317,7 @@ async def test_list_controls_field_headers_async(): def test_list_controls_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2351,7 +2341,7 @@ def test_list_controls_flattened(): def test_list_controls_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2366,7 +2356,7 @@ def test_list_controls_flattened_error(): @pytest.mark.asyncio async def test_list_controls_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2395,7 +2385,7 @@ async def test_list_controls_flattened_async(): @pytest.mark.asyncio async def test_list_controls_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2409,7 +2399,7 @@ async def test_list_controls_flattened_error_async(): def test_list_controls_pager(transport_name: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2459,7 +2449,7 @@ def test_list_controls_pager(transport_name: str = "grpc"): def test_list_controls_pages(transport_name: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2501,7 +2491,7 @@ def test_list_controls_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_controls_async_pager(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2551,7 +2541,7 @@ async def test_list_controls_async_pager(): @pytest.mark.asyncio async def test_list_controls_async_pages(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2606,7 +2596,7 @@ async def test_list_controls_async_pages(): ) def test_create_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2788,7 +2778,7 @@ def test_create_control_rest_required_fields( assert "controlId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2800,7 +2790,7 @@ def test_create_control_rest_required_fields( jsonified_request["controlId"] = "control_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_control._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("control_id",)) @@ -2813,7 +2803,7 @@ def test_create_control_rest_required_fields( assert jsonified_request["controlId"] == "control_id_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2862,7 +2852,7 @@ def test_create_control_rest_required_fields( def test_create_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_control._get_unset_required_fields({}) @@ -2881,7 +2871,7 @@ def test_create_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -2937,7 +2927,7 @@ def test_create_control_rest_bad_request( transport: str = "rest", request_type=control_service.CreateControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2959,7 +2949,7 @@ def test_create_control_rest_bad_request( def test_create_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3007,7 +2997,7 @@ def test_create_control_rest_flattened(): def test_create_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3026,7 +3016,7 @@ def test_create_control_rest_flattened_error(transport: str = "rest"): def test_create_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3039,7 +3029,7 @@ def test_create_control_rest_error(): ) def test_delete_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3087,7 +3077,7 @@ def test_delete_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3096,7 +3086,7 @@ def test_delete_control_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3105,7 +3095,7 @@ def test_delete_control_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3144,7 +3134,7 @@ def test_delete_control_rest_required_fields( def test_delete_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_control._get_unset_required_fields({}) @@ -3154,7 +3144,7 @@ def test_delete_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -3204,7 +3194,7 @@ def test_delete_control_rest_bad_request( transport: str = "rest", request_type=control_service.DeleteControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3228,7 +3218,7 @@ def test_delete_control_rest_bad_request( def test_delete_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3270,7 +3260,7 @@ def test_delete_control_rest_flattened(): def test_delete_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3285,7 +3275,7 @@ def test_delete_control_rest_flattened_error(transport: str = "rest"): def test_delete_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3298,7 +3288,7 @@ def test_delete_control_rest_error(): ) def test_update_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3481,14 +3471,14 @@ def test_update_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_control._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -3497,7 +3487,7 @@ def test_update_control_rest_required_fields( # verify required fields with non-default values are left alone client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3540,7 +3530,7 @@ def test_update_control_rest_required_fields( def test_update_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_control._get_unset_required_fields({}) @@ -3550,7 +3540,7 @@ def test_update_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -3606,7 +3596,7 @@ def test_update_control_rest_bad_request( transport: str = "rest", request_type=control_service.UpdateControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3632,7 +3622,7 @@ def test_update_control_rest_bad_request( def test_update_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3681,7 +3671,7 @@ def test_update_control_rest_flattened(): def test_update_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3699,7 +3689,7 @@ def test_update_control_rest_flattened_error(transport: str = "rest"): def test_update_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3712,7 +3702,7 @@ def test_update_control_rest_error(): ) def test_get_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3779,7 +3769,7 @@ def test_get_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3788,7 +3778,7 @@ def test_get_control_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3797,7 +3787,7 @@ def test_get_control_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3839,7 +3829,7 @@ def test_get_control_rest_required_fields( def test_get_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_control._get_unset_required_fields({}) @@ -3849,7 +3839,7 @@ def test_get_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -3905,7 +3895,7 @@ def test_get_control_rest_bad_request( transport: str = "rest", request_type=control_service.GetControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3929,7 +3919,7 @@ def test_get_control_rest_bad_request( def test_get_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3973,7 +3963,7 @@ def test_get_control_rest_flattened(): def test_get_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3988,7 +3978,7 @@ def test_get_control_rest_flattened_error(transport: str = "rest"): def test_get_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4001,7 +3991,7 @@ def test_get_control_rest_error(): ) def test_list_controls_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4052,7 +4042,7 @@ def test_list_controls_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_controls._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4061,7 +4051,7 @@ def test_list_controls_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_controls._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4078,7 +4068,7 @@ def test_list_controls_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4120,7 +4110,7 @@ def test_list_controls_rest_required_fields( def test_list_controls_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_controls._get_unset_required_fields({}) @@ -4139,7 +4129,7 @@ def test_list_controls_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_controls_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -4197,7 +4187,7 @@ def test_list_controls_rest_bad_request( transport: str = "rest", request_type=control_service.ListControlsRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4219,7 +4209,7 @@ def test_list_controls_rest_bad_request( def test_list_controls_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4263,7 +4253,7 @@ def test_list_controls_rest_flattened(): def test_list_controls_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4278,7 +4268,7 @@ def test_list_controls_rest_flattened_error(transport: str = "rest"): def test_list_controls_rest_pager(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4344,17 +4334,17 @@ def test_list_controls_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ControlServiceClient( @@ -4364,7 +4354,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -4379,13 +4369,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ControlServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ControlServiceClient( @@ -4397,7 +4386,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ControlServiceClient(transport=transport) assert client.transport is transport @@ -4406,13 +4395,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ControlServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -4429,7 +4418,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -4443,7 +4432,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ControlServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -4451,7 +4440,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -4463,7 +4452,7 @@ def test_control_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ControlServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -4475,7 +4464,7 @@ def test_control_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ControlServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -4513,7 +4502,7 @@ def test_control_service_base_transport_with_credentials_file(): "google.cloud.retail_v2.services.control_service.transports.ControlServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ControlServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -4532,7 +4521,7 @@ def test_control_service_base_transport_with_adc(): "google.cloud.retail_v2.services.control_service.transports.ControlServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ControlServiceTransport() adc.assert_called_once() @@ -4540,7 +4529,7 @@ def test_control_service_base_transport_with_adc(): def test_control_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ControlServiceClient() adc.assert_called_once_with( scopes=None, @@ -4560,7 +4549,7 @@ def test_control_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -4607,7 +4596,7 @@ def test_control_service_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -4635,7 +4624,7 @@ def test_control_service_transport_create_channel(transport_class, grpc_helpers) ], ) def test_control_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -4673,7 +4662,7 @@ def test_control_service_grpc_transport_client_cert_source_for_mtls(transport_cl def test_control_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -4693,7 +4682,7 @@ def test_control_service_http_transport_client_cert_source_for_mtls(): ) def test_control_service_host_no_port(transport_name): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -4716,7 +4705,7 @@ def test_control_service_host_no_port(transport_name): ) def test_control_service_host_with_port(transport_name): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -4736,8 +4725,8 @@ def test_control_service_host_with_port(transport_name): ], ) def test_control_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ControlServiceClient( credentials=creds1, transport=transport_name, @@ -4813,7 +4802,7 @@ def test_control_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -5054,7 +5043,7 @@ def test_client_with_default_client_info(): transports.ControlServiceTransport, "_prep_wrapped_messages" ) as prep: client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5064,7 +5053,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ControlServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5073,7 +5062,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -5088,7 +5077,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5118,7 +5107,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -5146,7 +5135,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5176,7 +5165,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -5202,7 +5191,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5227,7 +5216,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5253,7 +5242,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5282,7 +5271,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5311,7 +5300,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -5329,7 +5318,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -5347,7 +5336,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5372,7 +5361,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5398,7 +5387,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5427,7 +5416,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5456,7 +5445,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -5474,7 +5463,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -5498,7 +5487,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -5515,7 +5504,7 @@ def test_client_ctx(): ] for transport in transports: client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_model_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_model_service.py index 1e272a3d0b30..659b50b58df5 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_model_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_model_service.py @@ -93,18 +93,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -316,7 +304,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -343,42 +331,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -389,7 +384,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_model_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -441,7 +436,7 @@ def test_model_service_client_service_account_always_use_jwt( ], ) def test_model_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -504,9 +499,7 @@ def test_model_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ModelServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -899,20 +892,20 @@ def test_model_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -924,13 +917,11 @@ def test_model_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -946,8 +937,7 @@ def test_model_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1098,8 +1088,8 @@ def test_model_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1128,7 +1118,7 @@ def test_model_service_client_create_channel_credentials_file( ) def test_create_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1155,7 +1145,7 @@ def test_create_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1172,7 +1162,7 @@ async def test_create_model_async( transport: str = "grpc_asyncio", request_type=model_service.CreateModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1204,7 +1194,7 @@ async def test_create_model_async_from_dict(): def test_create_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1234,7 +1224,7 @@ def test_create_model_field_headers(): @pytest.mark.asyncio async def test_create_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1265,7 +1255,7 @@ async def test_create_model_field_headers_async(): def test_create_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1293,7 +1283,7 @@ def test_create_model_flattened(): def test_create_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1309,7 +1299,7 @@ def test_create_model_flattened_error(): @pytest.mark.asyncio async def test_create_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1342,7 +1332,7 @@ async def test_create_model_flattened_async(): @pytest.mark.asyncio async def test_create_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1364,7 +1354,7 @@ async def test_create_model_flattened_error_async(): ) def test_get_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1418,7 +1408,7 @@ def test_get_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1435,7 +1425,7 @@ async def test_get_model_async( transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1494,7 +1484,7 @@ async def test_get_model_async_from_dict(): def test_get_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1524,7 +1514,7 @@ def test_get_model_field_headers(): @pytest.mark.asyncio async def test_get_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1553,7 +1543,7 @@ async def test_get_model_field_headers_async(): def test_get_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1577,7 +1567,7 @@ def test_get_model_flattened(): def test_get_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1592,7 +1582,7 @@ def test_get_model_flattened_error(): @pytest.mark.asyncio async def test_get_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1619,7 +1609,7 @@ async def test_get_model_flattened_async(): @pytest.mark.asyncio async def test_get_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1640,7 +1630,7 @@ async def test_get_model_flattened_error_async(): ) def test_pause_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1694,7 +1684,7 @@ def test_pause_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1711,7 +1701,7 @@ async def test_pause_model_async( transport: str = "grpc_asyncio", request_type=model_service.PauseModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1770,7 +1760,7 @@ async def test_pause_model_async_from_dict(): def test_pause_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1800,7 +1790,7 @@ def test_pause_model_field_headers(): @pytest.mark.asyncio async def test_pause_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1829,7 +1819,7 @@ async def test_pause_model_field_headers_async(): def test_pause_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1853,7 +1843,7 @@ def test_pause_model_flattened(): def test_pause_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1868,7 +1858,7 @@ def test_pause_model_flattened_error(): @pytest.mark.asyncio async def test_pause_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1895,7 +1885,7 @@ async def test_pause_model_flattened_async(): @pytest.mark.asyncio async def test_pause_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1916,7 +1906,7 @@ async def test_pause_model_flattened_error_async(): ) def test_resume_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1970,7 +1960,7 @@ def test_resume_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1987,7 +1977,7 @@ async def test_resume_model_async( transport: str = "grpc_asyncio", request_type=model_service.ResumeModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2046,7 +2036,7 @@ async def test_resume_model_async_from_dict(): def test_resume_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2076,7 +2066,7 @@ def test_resume_model_field_headers(): @pytest.mark.asyncio async def test_resume_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2105,7 +2095,7 @@ async def test_resume_model_field_headers_async(): def test_resume_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2129,7 +2119,7 @@ def test_resume_model_flattened(): def test_resume_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2144,7 +2134,7 @@ def test_resume_model_flattened_error(): @pytest.mark.asyncio async def test_resume_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2171,7 +2161,7 @@ async def test_resume_model_flattened_async(): @pytest.mark.asyncio async def test_resume_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2192,7 +2182,7 @@ async def test_resume_model_flattened_error_async(): ) def test_delete_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2219,7 +2209,7 @@ def test_delete_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2236,7 +2226,7 @@ async def test_delete_model_async( transport: str = "grpc_asyncio", request_type=model_service.DeleteModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2266,7 +2256,7 @@ async def test_delete_model_async_from_dict(): def test_delete_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2296,7 +2286,7 @@ def test_delete_model_field_headers(): @pytest.mark.asyncio async def test_delete_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2325,7 +2315,7 @@ async def test_delete_model_field_headers_async(): def test_delete_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2349,7 +2339,7 @@ def test_delete_model_flattened(): def test_delete_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2364,7 +2354,7 @@ def test_delete_model_flattened_error(): @pytest.mark.asyncio async def test_delete_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2391,7 +2381,7 @@ async def test_delete_model_flattened_async(): @pytest.mark.asyncio async def test_delete_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2412,7 +2402,7 @@ async def test_delete_model_flattened_error_async(): ) def test_list_models(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2442,7 +2432,7 @@ def test_list_models_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2459,7 +2449,7 @@ async def test_list_models_async( transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2494,7 +2484,7 @@ async def test_list_models_async_from_dict(): def test_list_models_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2524,7 +2514,7 @@ def test_list_models_field_headers(): @pytest.mark.asyncio async def test_list_models_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2555,7 +2545,7 @@ async def test_list_models_field_headers_async(): def test_list_models_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2579,7 +2569,7 @@ def test_list_models_flattened(): def test_list_models_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2594,7 +2584,7 @@ def test_list_models_flattened_error(): @pytest.mark.asyncio async def test_list_models_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2623,7 +2613,7 @@ async def test_list_models_flattened_async(): @pytest.mark.asyncio async def test_list_models_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2637,7 +2627,7 @@ async def test_list_models_flattened_error_async(): def test_list_models_pager(transport_name: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2687,7 +2677,7 @@ def test_list_models_pager(transport_name: str = "grpc"): def test_list_models_pages(transport_name: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2729,7 +2719,7 @@ def test_list_models_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_models_async_pager(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2779,7 +2769,7 @@ async def test_list_models_async_pager(): @pytest.mark.asyncio async def test_list_models_async_pages(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2834,7 +2824,7 @@ async def test_list_models_async_pages(): ) def test_update_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2888,7 +2878,7 @@ def test_update_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2905,7 +2895,7 @@ async def test_update_model_async( transport: str = "grpc_asyncio", request_type=model_service.UpdateModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2964,7 +2954,7 @@ async def test_update_model_async_from_dict(): def test_update_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2994,7 +2984,7 @@ def test_update_model_field_headers(): @pytest.mark.asyncio async def test_update_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3023,7 +3013,7 @@ async def test_update_model_field_headers_async(): def test_update_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3051,7 +3041,7 @@ def test_update_model_flattened(): def test_update_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3067,7 +3057,7 @@ def test_update_model_flattened_error(): @pytest.mark.asyncio async def test_update_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3098,7 +3088,7 @@ async def test_update_model_flattened_async(): @pytest.mark.asyncio async def test_update_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3120,7 +3110,7 @@ async def test_update_model_flattened_error_async(): ) def test_tune_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3147,7 +3137,7 @@ def test_tune_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3164,7 +3154,7 @@ async def test_tune_model_async( transport: str = "grpc_asyncio", request_type=model_service.TuneModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3196,7 +3186,7 @@ async def test_tune_model_async_from_dict(): def test_tune_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3226,7 +3216,7 @@ def test_tune_model_field_headers(): @pytest.mark.asyncio async def test_tune_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3257,7 +3247,7 @@ async def test_tune_model_field_headers_async(): def test_tune_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3281,7 +3271,7 @@ def test_tune_model_flattened(): def test_tune_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3296,7 +3286,7 @@ def test_tune_model_flattened_error(): @pytest.mark.asyncio async def test_tune_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3325,7 +3315,7 @@ async def test_tune_model_flattened_async(): @pytest.mark.asyncio async def test_tune_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3346,7 +3336,7 @@ async def test_tune_model_flattened_error_async(): ) def test_create_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3482,7 +3472,7 @@ def test_create_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3491,7 +3481,7 @@ def test_create_model_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_model._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("dry_run",)) @@ -3502,7 +3492,7 @@ def test_create_model_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3542,7 +3532,7 @@ def test_create_model_rest_required_fields( def test_create_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_model._get_unset_required_fields({}) @@ -3560,7 +3550,7 @@ def test_create_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -3620,7 +3610,7 @@ def test_create_model_rest_bad_request( transport: str = "rest", request_type=model_service.CreateModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3642,7 +3632,7 @@ def test_create_model_rest_bad_request( def test_create_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3685,7 +3675,7 @@ def test_create_model_rest_flattened(): def test_create_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3701,7 +3691,7 @@ def test_create_model_rest_flattened_error(transport: str = "rest"): def test_create_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3714,7 +3704,7 @@ def test_create_model_rest_error(): ) def test_get_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3789,7 +3779,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3798,7 +3788,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3807,7 +3797,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3849,7 +3839,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque def test_get_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_model._get_unset_required_fields({}) @@ -3859,7 +3849,7 @@ def test_get_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -3913,7 +3903,7 @@ def test_get_model_rest_bad_request( transport: str = "rest", request_type=model_service.GetModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3937,7 +3927,7 @@ def test_get_model_rest_bad_request( def test_get_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3981,7 +3971,7 @@ def test_get_model_rest_flattened(): def test_get_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3996,7 +3986,7 @@ def test_get_model_rest_flattened_error(transport: str = "rest"): def test_get_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4009,7 +3999,7 @@ def test_get_model_rest_error(): ) def test_pause_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4084,7 +4074,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4093,7 +4083,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4102,7 +4092,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4145,7 +4135,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR def test_pause_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.pause_model._get_unset_required_fields({}) @@ -4155,7 +4145,7 @@ def test_pause_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_pause_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -4211,7 +4201,7 @@ def test_pause_model_rest_bad_request( transport: str = "rest", request_type=model_service.PauseModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4235,7 +4225,7 @@ def test_pause_model_rest_bad_request( def test_pause_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4279,7 +4269,7 @@ def test_pause_model_rest_flattened(): def test_pause_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4294,7 +4284,7 @@ def test_pause_model_rest_flattened_error(transport: str = "rest"): def test_pause_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4307,7 +4297,7 @@ def test_pause_model_rest_error(): ) def test_resume_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4384,7 +4374,7 @@ def test_resume_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4393,7 +4383,7 @@ def test_resume_model_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4402,7 +4392,7 @@ def test_resume_model_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4445,7 +4435,7 @@ def test_resume_model_rest_required_fields( def test_resume_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.resume_model._get_unset_required_fields({}) @@ -4455,7 +4445,7 @@ def test_resume_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_resume_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -4511,7 +4501,7 @@ def test_resume_model_rest_bad_request( transport: str = "rest", request_type=model_service.ResumeModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4535,7 +4525,7 @@ def test_resume_model_rest_bad_request( def test_resume_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4579,7 +4569,7 @@ def test_resume_model_rest_flattened(): def test_resume_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4594,7 +4584,7 @@ def test_resume_model_rest_flattened_error(transport: str = "rest"): def test_resume_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4607,7 +4597,7 @@ def test_resume_model_rest_error(): ) def test_delete_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4655,7 +4645,7 @@ def test_delete_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4664,7 +4654,7 @@ def test_delete_model_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4673,7 +4663,7 @@ def test_delete_model_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4712,7 +4702,7 @@ def test_delete_model_rest_required_fields( def test_delete_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_model._get_unset_required_fields({}) @@ -4722,7 +4712,7 @@ def test_delete_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -4772,7 +4762,7 @@ def test_delete_model_rest_bad_request( transport: str = "rest", request_type=model_service.DeleteModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4796,7 +4786,7 @@ def test_delete_model_rest_bad_request( def test_delete_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4838,7 +4828,7 @@ def test_delete_model_rest_flattened(): def test_delete_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4853,7 +4843,7 @@ def test_delete_model_rest_flattened_error(transport: str = "rest"): def test_delete_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4866,7 +4856,7 @@ def test_delete_model_rest_error(): ) def test_list_models_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4915,7 +4905,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_models._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4924,7 +4914,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_models._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4940,7 +4930,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR assert jsonified_request["parent"] == "parent_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4982,7 +4972,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR def test_list_models_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_models._get_unset_required_fields({}) @@ -5000,7 +4990,7 @@ def test_list_models_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_models_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -5058,7 +5048,7 @@ def test_list_models_rest_bad_request( transport: str = "rest", request_type=model_service.ListModelsRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5080,7 +5070,7 @@ def test_list_models_rest_bad_request( def test_list_models_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5124,7 +5114,7 @@ def test_list_models_rest_flattened(): def test_list_models_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5139,7 +5129,7 @@ def test_list_models_rest_flattened_error(transport: str = "rest"): def test_list_models_rest_pager(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5209,7 +5199,7 @@ def test_list_models_rest_pager(transport: str = "rest"): ) def test_update_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5377,14 +5367,14 @@ def test_update_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_model._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5393,7 +5383,7 @@ def test_update_model_rest_required_fields( # verify required fields with non-default values are left alone client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5436,7 +5426,7 @@ def test_update_model_rest_required_fields( def test_update_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_model._get_unset_required_fields({}) @@ -5446,7 +5436,7 @@ def test_update_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -5502,7 +5492,7 @@ def test_update_model_rest_bad_request( transport: str = "rest", request_type=model_service.UpdateModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5528,7 +5518,7 @@ def test_update_model_rest_bad_request( def test_update_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5575,7 +5565,7 @@ def test_update_model_rest_flattened(): def test_update_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5591,7 +5581,7 @@ def test_update_model_rest_flattened_error(transport: str = "rest"): def test_update_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5604,7 +5594,7 @@ def test_update_model_rest_error(): ) def test_tune_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5650,7 +5640,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).tune_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5659,7 +5649,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).tune_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5668,7 +5658,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5708,7 +5698,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq def test_tune_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.tune_model._get_unset_required_fields({}) @@ -5718,7 +5708,7 @@ def test_tune_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_tune_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -5776,7 +5766,7 @@ def test_tune_model_rest_bad_request( transport: str = "rest", request_type=model_service.TuneModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5800,7 +5790,7 @@ def test_tune_model_rest_bad_request( def test_tune_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5842,7 +5832,7 @@ def test_tune_model_rest_flattened(): def test_tune_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5857,24 +5847,24 @@ def test_tune_model_rest_flattened_error(transport: str = "rest"): def test_tune_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ModelServiceClient( @@ -5884,7 +5874,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5899,13 +5889,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ModelServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ModelServiceClient( @@ -5917,7 +5906,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ModelServiceClient(transport=transport) assert client.transport is transport @@ -5926,13 +5915,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ModelServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -5949,7 +5938,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -5963,7 +5952,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ModelServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -5971,7 +5960,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -5983,7 +5972,7 @@ def test_model_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ModelServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -5995,7 +5984,7 @@ def test_model_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ModelServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -6041,7 +6030,7 @@ def test_model_service_base_transport_with_credentials_file(): "google.cloud.retail_v2.services.model_service.transports.ModelServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ModelServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -6060,7 +6049,7 @@ def test_model_service_base_transport_with_adc(): "google.cloud.retail_v2.services.model_service.transports.ModelServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ModelServiceTransport() adc.assert_called_once() @@ -6068,7 +6057,7 @@ def test_model_service_base_transport_with_adc(): def test_model_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ModelServiceClient() adc.assert_called_once_with( scopes=None, @@ -6088,7 +6077,7 @@ def test_model_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6135,7 +6124,7 @@ def test_model_service_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6160,7 +6149,7 @@ def test_model_service_transport_create_channel(transport_class, grpc_helpers): [transports.ModelServiceGrpcTransport, transports.ModelServiceGrpcAsyncIOTransport], ) def test_model_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6198,7 +6187,7 @@ def test_model_service_grpc_transport_client_cert_source_for_mtls(transport_clas def test_model_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6210,7 +6199,7 @@ def test_model_service_http_transport_client_cert_source_for_mtls(): def test_model_service_rest_lro_client(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -6235,7 +6224,7 @@ def test_model_service_rest_lro_client(): ) def test_model_service_host_no_port(transport_name): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -6258,7 +6247,7 @@ def test_model_service_host_no_port(transport_name): ) def test_model_service_host_with_port(transport_name): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -6278,8 +6267,8 @@ def test_model_service_host_with_port(transport_name): ], ) def test_model_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ModelServiceClient( credentials=creds1, transport=transport_name, @@ -6359,7 +6348,7 @@ def test_model_service_transport_channel_mtls_with_client_cert_source(transport_ mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6434,7 +6423,7 @@ def test_model_service_transport_channel_mtls_with_adc(transport_class): def test_model_service_grpc_lro_client(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -6451,7 +6440,7 @@ def test_model_service_grpc_lro_client(): def test_model_service_grpc_lro_async_client(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -6631,7 +6620,7 @@ def test_client_with_default_client_info(): transports.ModelServiceTransport, "_prep_wrapped_messages" ) as prep: client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6641,7 +6630,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ModelServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6650,7 +6639,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6665,7 +6654,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6695,7 +6684,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6723,7 +6712,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6753,7 +6742,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -6779,7 +6768,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6804,7 +6793,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6830,7 +6819,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6859,7 +6848,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6888,7 +6877,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6906,7 +6895,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6924,7 +6913,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6949,7 +6938,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6975,7 +6964,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7004,7 +6993,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7033,7 +7022,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7051,7 +7040,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7075,7 +7064,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -7092,7 +7081,7 @@ def test_client_ctx(): ] for transport in transports: client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_prediction_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_prediction_service.py index 375d1748b34b..232642ebbb7a 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_prediction_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_prediction_service.py @@ -89,18 +89,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -336,7 +324,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -363,42 +351,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -411,7 +406,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_prediction_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -465,7 +460,7 @@ def test_prediction_service_client_service_account_always_use_jwt( def test_prediction_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -528,9 +523,7 @@ def test_prediction_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(PredictionServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -949,20 +942,20 @@ def test_prediction_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -974,13 +967,11 @@ def test_prediction_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -996,8 +987,7 @@ def test_prediction_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1155,8 +1145,8 @@ def test_prediction_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1185,7 +1175,7 @@ def test_prediction_service_client_create_channel_credentials_file( ) def test_predict(request_type, transport: str = "grpc"): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1219,7 +1209,7 @@ def test_predict_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1236,7 +1226,7 @@ async def test_predict_async( transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest ): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1275,7 +1265,7 @@ async def test_predict_async_from_dict(): def test_predict_field_headers(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1305,7 +1295,7 @@ def test_predict_field_headers(): @pytest.mark.asyncio async def test_predict_field_headers_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1343,7 +1333,7 @@ async def test_predict_field_headers_async(): ) def test_predict_rest(request_type): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1398,7 +1388,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).predict._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1407,7 +1397,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq jsonified_request["placement"] = "placement_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).predict._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1416,7 +1406,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq assert jsonified_request["placement"] == "placement_value" client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1459,7 +1449,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq def test_predict_rest_unset_required_fields(): transport = transports.PredictionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.predict._get_unset_required_fields({}) @@ -1477,7 +1467,7 @@ def test_predict_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_predict_rest_interceptors(null_interceptor): transport = transports.PredictionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.PredictionServiceRestInterceptor(), @@ -1535,7 +1525,7 @@ def test_predict_rest_bad_request( transport: str = "rest", request_type=prediction_service.PredictRequest ): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1559,24 +1549,24 @@ def test_predict_rest_bad_request( def test_predict_rest_error(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = PredictionServiceClient( @@ -1586,7 +1576,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1601,13 +1591,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = PredictionServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = PredictionServiceClient( @@ -1619,7 +1608,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = PredictionServiceClient(transport=transport) assert client.transport is transport @@ -1628,13 +1617,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.PredictionServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1651,7 +1640,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1665,7 +1654,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = PredictionServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1673,7 +1662,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1685,7 +1674,7 @@ def test_prediction_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.PredictionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1697,7 +1686,7 @@ def test_prediction_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.PredictionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1731,7 +1720,7 @@ def test_prediction_service_base_transport_with_credentials_file(): "google.cloud.retail_v2.services.prediction_service.transports.PredictionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PredictionServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1750,7 +1739,7 @@ def test_prediction_service_base_transport_with_adc(): "google.cloud.retail_v2.services.prediction_service.transports.PredictionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PredictionServiceTransport() adc.assert_called_once() @@ -1758,7 +1747,7 @@ def test_prediction_service_base_transport_with_adc(): def test_prediction_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) PredictionServiceClient() adc.assert_called_once_with( scopes=None, @@ -1778,7 +1767,7 @@ def test_prediction_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -1825,7 +1814,7 @@ def test_prediction_service_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -1853,7 +1842,7 @@ def test_prediction_service_transport_create_channel(transport_class, grpc_helpe ], ) def test_prediction_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1891,7 +1880,7 @@ def test_prediction_service_grpc_transport_client_cert_source_for_mtls(transport def test_prediction_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -1911,7 +1900,7 @@ def test_prediction_service_http_transport_client_cert_source_for_mtls(): ) def test_prediction_service_host_no_port(transport_name): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -1934,7 +1923,7 @@ def test_prediction_service_host_no_port(transport_name): ) def test_prediction_service_host_with_port(transport_name): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -1954,8 +1943,8 @@ def test_prediction_service_host_with_port(transport_name): ], ) def test_prediction_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = PredictionServiceClient( credentials=creds1, transport=transport_name, @@ -2019,7 +2008,7 @@ def test_prediction_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2239,7 +2228,7 @@ def test_client_with_default_client_info(): transports.PredictionServiceTransport, "_prep_wrapped_messages" ) as prep: client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2249,7 +2238,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = PredictionServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2258,7 +2247,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2273,7 +2262,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2303,7 +2292,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -2331,7 +2320,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2361,7 +2350,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -2387,7 +2376,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2412,7 +2401,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2438,7 +2427,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2467,7 +2456,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2496,7 +2485,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2514,7 +2503,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2532,7 +2521,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2557,7 +2546,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2583,7 +2572,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2612,7 +2601,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2641,7 +2630,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2659,7 +2648,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2683,7 +2672,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2700,7 +2689,7 @@ def test_client_ctx(): ] for transport in transports: client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_product_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_product_service.py index 52b8c12981ae..e288e6f739a0 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_product_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_product_service.py @@ -96,18 +96,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -334,7 +322,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -361,42 +349,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -407,7 +402,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_product_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -459,7 +454,7 @@ def test_product_service_client_service_account_always_use_jwt( ], ) def test_product_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -522,9 +517,7 @@ def test_product_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ProductServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -923,20 +916,20 @@ def test_product_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -948,13 +941,11 @@ def test_product_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -970,8 +961,7 @@ def test_product_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1124,8 +1114,8 @@ def test_product_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1154,7 +1144,7 @@ def test_product_service_client_create_channel_credentials_file( ) def test_create_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1218,7 +1208,7 @@ def test_create_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1235,7 +1225,7 @@ async def test_create_product_async( transport: str = "grpc_asyncio", request_type=product_service.CreateProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1304,7 +1294,7 @@ async def test_create_product_async_from_dict(): def test_create_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1334,7 +1324,7 @@ def test_create_product_field_headers(): @pytest.mark.asyncio async def test_create_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1363,7 +1353,7 @@ async def test_create_product_field_headers_async(): def test_create_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1397,7 +1387,7 @@ def test_create_product_flattened(): def test_create_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1416,7 +1406,7 @@ def test_create_product_flattened_error(): @pytest.mark.asyncio async def test_create_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1453,7 +1443,7 @@ async def test_create_product_flattened_async(): @pytest.mark.asyncio async def test_create_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1478,7 +1468,7 @@ async def test_create_product_flattened_error_async(): ) def test_get_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1542,7 +1532,7 @@ def test_get_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1559,7 +1549,7 @@ async def test_get_product_async( transport: str = "grpc_asyncio", request_type=product_service.GetProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1628,7 +1618,7 @@ async def test_get_product_async_from_dict(): def test_get_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1658,7 +1648,7 @@ def test_get_product_field_headers(): @pytest.mark.asyncio async def test_get_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1687,7 +1677,7 @@ async def test_get_product_field_headers_async(): def test_get_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1711,7 +1701,7 @@ def test_get_product_flattened(): def test_get_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1726,7 +1716,7 @@ def test_get_product_flattened_error(): @pytest.mark.asyncio async def test_get_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1753,7 +1743,7 @@ async def test_get_product_flattened_async(): @pytest.mark.asyncio async def test_get_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1774,7 +1764,7 @@ async def test_get_product_flattened_error_async(): ) def test_list_products(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1804,7 +1794,7 @@ def test_list_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1821,7 +1811,7 @@ async def test_list_products_async( transport: str = "grpc_asyncio", request_type=product_service.ListProductsRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1856,7 +1846,7 @@ async def test_list_products_async_from_dict(): def test_list_products_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1886,7 +1876,7 @@ def test_list_products_field_headers(): @pytest.mark.asyncio async def test_list_products_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1917,7 +1907,7 @@ async def test_list_products_field_headers_async(): def test_list_products_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1941,7 +1931,7 @@ def test_list_products_flattened(): def test_list_products_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1956,7 +1946,7 @@ def test_list_products_flattened_error(): @pytest.mark.asyncio async def test_list_products_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1985,7 +1975,7 @@ async def test_list_products_flattened_async(): @pytest.mark.asyncio async def test_list_products_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1999,7 +1989,7 @@ async def test_list_products_flattened_error_async(): def test_list_products_pager(transport_name: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2049,7 +2039,7 @@ def test_list_products_pager(transport_name: str = "grpc"): def test_list_products_pages(transport_name: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2091,7 +2081,7 @@ def test_list_products_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_products_async_pager(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2141,7 +2131,7 @@ async def test_list_products_async_pager(): @pytest.mark.asyncio async def test_list_products_async_pages(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2196,7 +2186,7 @@ async def test_list_products_async_pages(): ) def test_update_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2260,7 +2250,7 @@ def test_update_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2277,7 +2267,7 @@ async def test_update_product_async( transport: str = "grpc_asyncio", request_type=product_service.UpdateProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2346,7 +2336,7 @@ async def test_update_product_async_from_dict(): def test_update_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2376,7 +2366,7 @@ def test_update_product_field_headers(): @pytest.mark.asyncio async def test_update_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2405,7 +2395,7 @@ async def test_update_product_field_headers_async(): def test_update_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2435,7 +2425,7 @@ def test_update_product_flattened(): def test_update_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2453,7 +2443,7 @@ def test_update_product_flattened_error(): @pytest.mark.asyncio async def test_update_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2486,7 +2476,7 @@ async def test_update_product_flattened_async(): @pytest.mark.asyncio async def test_update_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2510,7 +2500,7 @@ async def test_update_product_flattened_error_async(): ) def test_delete_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2537,7 +2527,7 @@ def test_delete_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2554,7 +2544,7 @@ async def test_delete_product_async( transport: str = "grpc_asyncio", request_type=product_service.DeleteProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2584,7 +2574,7 @@ async def test_delete_product_async_from_dict(): def test_delete_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2614,7 +2604,7 @@ def test_delete_product_field_headers(): @pytest.mark.asyncio async def test_delete_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2643,7 +2633,7 @@ async def test_delete_product_field_headers_async(): def test_delete_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2667,7 +2657,7 @@ def test_delete_product_flattened(): def test_delete_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2682,7 +2672,7 @@ def test_delete_product_flattened_error(): @pytest.mark.asyncio async def test_delete_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2709,7 +2699,7 @@ async def test_delete_product_flattened_async(): @pytest.mark.asyncio async def test_delete_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2730,7 +2720,7 @@ async def test_delete_product_flattened_error_async(): ) def test_import_products(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2757,7 +2747,7 @@ def test_import_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2774,7 +2764,7 @@ async def test_import_products_async( transport: str = "grpc_asyncio", request_type=import_config.ImportProductsRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2806,7 +2796,7 @@ async def test_import_products_async_from_dict(): def test_import_products_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2836,7 +2826,7 @@ def test_import_products_field_headers(): @pytest.mark.asyncio async def test_import_products_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2874,7 +2864,7 @@ async def test_import_products_field_headers_async(): ) def test_set_inventory(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2901,7 +2891,7 @@ def test_set_inventory_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2918,7 +2908,7 @@ async def test_set_inventory_async( transport: str = "grpc_asyncio", request_type=product_service.SetInventoryRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2950,7 +2940,7 @@ async def test_set_inventory_async_from_dict(): def test_set_inventory_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2980,7 +2970,7 @@ def test_set_inventory_field_headers(): @pytest.mark.asyncio async def test_set_inventory_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3011,7 +3001,7 @@ async def test_set_inventory_field_headers_async(): def test_set_inventory_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3039,7 +3029,7 @@ def test_set_inventory_flattened(): def test_set_inventory_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3055,7 +3045,7 @@ def test_set_inventory_flattened_error(): @pytest.mark.asyncio async def test_set_inventory_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3088,7 +3078,7 @@ async def test_set_inventory_flattened_async(): @pytest.mark.asyncio async def test_set_inventory_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3110,7 +3100,7 @@ async def test_set_inventory_flattened_error_async(): ) def test_add_fulfillment_places(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3139,7 +3129,7 @@ def test_add_fulfillment_places_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3159,7 +3149,7 @@ async def test_add_fulfillment_places_async( request_type=product_service.AddFulfillmentPlacesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3193,7 +3183,7 @@ async def test_add_fulfillment_places_async_from_dict(): def test_add_fulfillment_places_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3225,7 +3215,7 @@ def test_add_fulfillment_places_field_headers(): @pytest.mark.asyncio async def test_add_fulfillment_places_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3258,7 +3248,7 @@ async def test_add_fulfillment_places_field_headers_async(): def test_add_fulfillment_places_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3284,7 +3274,7 @@ def test_add_fulfillment_places_flattened(): def test_add_fulfillment_places_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3299,7 +3289,7 @@ def test_add_fulfillment_places_flattened_error(): @pytest.mark.asyncio async def test_add_fulfillment_places_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3330,7 +3320,7 @@ async def test_add_fulfillment_places_flattened_async(): @pytest.mark.asyncio async def test_add_fulfillment_places_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3351,7 +3341,7 @@ async def test_add_fulfillment_places_flattened_error_async(): ) def test_remove_fulfillment_places(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3380,7 +3370,7 @@ def test_remove_fulfillment_places_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3400,7 +3390,7 @@ async def test_remove_fulfillment_places_async( request_type=product_service.RemoveFulfillmentPlacesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3434,7 +3424,7 @@ async def test_remove_fulfillment_places_async_from_dict(): def test_remove_fulfillment_places_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3466,7 +3456,7 @@ def test_remove_fulfillment_places_field_headers(): @pytest.mark.asyncio async def test_remove_fulfillment_places_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3499,7 +3489,7 @@ async def test_remove_fulfillment_places_field_headers_async(): def test_remove_fulfillment_places_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3525,7 +3515,7 @@ def test_remove_fulfillment_places_flattened(): def test_remove_fulfillment_places_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3540,7 +3530,7 @@ def test_remove_fulfillment_places_flattened_error(): @pytest.mark.asyncio async def test_remove_fulfillment_places_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3571,7 +3561,7 @@ async def test_remove_fulfillment_places_flattened_async(): @pytest.mark.asyncio async def test_remove_fulfillment_places_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3592,7 +3582,7 @@ async def test_remove_fulfillment_places_flattened_error_async(): ) def test_add_local_inventories(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3621,7 +3611,7 @@ def test_add_local_inventories_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3641,7 +3631,7 @@ async def test_add_local_inventories_async( request_type=product_service.AddLocalInventoriesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3675,7 +3665,7 @@ async def test_add_local_inventories_async_from_dict(): def test_add_local_inventories_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3707,7 +3697,7 @@ def test_add_local_inventories_field_headers(): @pytest.mark.asyncio async def test_add_local_inventories_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3740,7 +3730,7 @@ async def test_add_local_inventories_field_headers_async(): def test_add_local_inventories_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3766,7 +3756,7 @@ def test_add_local_inventories_flattened(): def test_add_local_inventories_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3781,7 +3771,7 @@ def test_add_local_inventories_flattened_error(): @pytest.mark.asyncio async def test_add_local_inventories_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3812,7 +3802,7 @@ async def test_add_local_inventories_flattened_async(): @pytest.mark.asyncio async def test_add_local_inventories_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3833,7 +3823,7 @@ async def test_add_local_inventories_flattened_error_async(): ) def test_remove_local_inventories(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3862,7 +3852,7 @@ def test_remove_local_inventories_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3882,7 +3872,7 @@ async def test_remove_local_inventories_async( request_type=product_service.RemoveLocalInventoriesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3916,7 +3906,7 @@ async def test_remove_local_inventories_async_from_dict(): def test_remove_local_inventories_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3948,7 +3938,7 @@ def test_remove_local_inventories_field_headers(): @pytest.mark.asyncio async def test_remove_local_inventories_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3981,7 +3971,7 @@ async def test_remove_local_inventories_field_headers_async(): def test_remove_local_inventories_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4007,7 +3997,7 @@ def test_remove_local_inventories_flattened(): def test_remove_local_inventories_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4022,7 +4012,7 @@ def test_remove_local_inventories_flattened_error(): @pytest.mark.asyncio async def test_remove_local_inventories_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4053,7 +4043,7 @@ async def test_remove_local_inventories_flattened_async(): @pytest.mark.asyncio async def test_remove_local_inventories_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4074,7 +4064,7 @@ async def test_remove_local_inventories_flattened_error_async(): ) def test_create_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4310,7 +4300,7 @@ def test_create_product_rest_required_fields( assert "productId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4322,7 +4312,7 @@ def test_create_product_rest_required_fields( jsonified_request["productId"] = "product_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_product._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("product_id",)) @@ -4335,7 +4325,7 @@ def test_create_product_rest_required_fields( assert jsonified_request["productId"] == "product_id_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4384,7 +4374,7 @@ def test_create_product_rest_required_fields( def test_create_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_product._get_unset_required_fields({}) @@ -4403,7 +4393,7 @@ def test_create_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -4459,7 +4449,7 @@ def test_create_product_rest_bad_request( transport: str = "rest", request_type=product_service.CreateProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4483,7 +4473,7 @@ def test_create_product_rest_bad_request( def test_create_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4531,7 +4521,7 @@ def test_create_product_rest_flattened(): def test_create_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4550,7 +4540,7 @@ def test_create_product_rest_flattened_error(transport: str = "rest"): def test_create_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4563,7 +4553,7 @@ def test_create_product_rest_error(): ) def test_get_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4650,7 +4640,7 @@ def test_get_product_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4659,7 +4649,7 @@ def test_get_product_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4668,7 +4658,7 @@ def test_get_product_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4710,7 +4700,7 @@ def test_get_product_rest_required_fields( def test_get_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_product._get_unset_required_fields({}) @@ -4720,7 +4710,7 @@ def test_get_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -4776,7 +4766,7 @@ def test_get_product_rest_bad_request( transport: str = "rest", request_type=product_service.GetProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4800,7 +4790,7 @@ def test_get_product_rest_bad_request( def test_get_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4844,7 +4834,7 @@ def test_get_product_rest_flattened(): def test_get_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4859,7 +4849,7 @@ def test_get_product_rest_flattened_error(transport: str = "rest"): def test_get_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4872,7 +4862,7 @@ def test_get_product_rest_error(): ) def test_list_products_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4925,7 +4915,7 @@ def test_list_products_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4934,7 +4924,7 @@ def test_list_products_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_products._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4952,7 +4942,7 @@ def test_list_products_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4994,7 +4984,7 @@ def test_list_products_rest_required_fields( def test_list_products_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_products._get_unset_required_fields({}) @@ -5014,7 +5004,7 @@ def test_list_products_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_products_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -5072,7 +5062,7 @@ def test_list_products_rest_bad_request( transport: str = "rest", request_type=product_service.ListProductsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5096,7 +5086,7 @@ def test_list_products_rest_bad_request( def test_list_products_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5140,7 +5130,7 @@ def test_list_products_rest_flattened(): def test_list_products_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5155,7 +5145,7 @@ def test_list_products_rest_flattened_error(transport: str = "rest"): def test_list_products_rest_pager(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5227,7 +5217,7 @@ def test_list_products_rest_pager(transport: str = "rest"): ) def test_update_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5462,14 +5452,14 @@ def test_update_product_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_product._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5483,7 +5473,7 @@ def test_update_product_rest_required_fields( # verify required fields with non-default values are left alone client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5526,7 +5516,7 @@ def test_update_product_rest_required_fields( def test_update_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_product._get_unset_required_fields({}) @@ -5544,7 +5534,7 @@ def test_update_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -5600,7 +5590,7 @@ def test_update_product_rest_bad_request( transport: str = "rest", request_type=product_service.UpdateProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5626,7 +5616,7 @@ def test_update_product_rest_bad_request( def test_update_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5675,7 +5665,7 @@ def test_update_product_rest_flattened(): def test_update_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5693,7 +5683,7 @@ def test_update_product_rest_flattened_error(transport: str = "rest"): def test_update_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5706,7 +5696,7 @@ def test_update_product_rest_error(): ) def test_delete_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5754,7 +5744,7 @@ def test_delete_product_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5763,7 +5753,7 @@ def test_delete_product_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5772,7 +5762,7 @@ def test_delete_product_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5811,7 +5801,7 @@ def test_delete_product_rest_required_fields( def test_delete_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_product._get_unset_required_fields({}) @@ -5821,7 +5811,7 @@ def test_delete_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -5871,7 +5861,7 @@ def test_delete_product_rest_bad_request( transport: str = "rest", request_type=product_service.DeleteProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5895,7 +5885,7 @@ def test_delete_product_rest_bad_request( def test_delete_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5937,7 +5927,7 @@ def test_delete_product_rest_flattened(): def test_delete_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5952,7 +5942,7 @@ def test_delete_product_rest_flattened_error(transport: str = "rest"): def test_delete_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5965,7 +5955,7 @@ def test_delete_product_rest_error(): ) def test_import_products_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6013,7 +6003,7 @@ def test_import_products_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6022,7 +6012,7 @@ def test_import_products_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6031,7 +6021,7 @@ def test_import_products_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6071,7 +6061,7 @@ def test_import_products_rest_required_fields( def test_import_products_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_products._get_unset_required_fields({}) @@ -6089,7 +6079,7 @@ def test_import_products_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_products_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6149,7 +6139,7 @@ def test_import_products_rest_bad_request( transport: str = "rest", request_type=import_config.ImportProductsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6173,7 +6163,7 @@ def test_import_products_rest_bad_request( def test_import_products_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6186,7 +6176,7 @@ def test_import_products_rest_error(): ) def test_set_inventory_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6235,21 +6225,21 @@ def test_set_inventory_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_inventory._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_inventory._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6289,7 +6279,7 @@ def test_set_inventory_rest_required_fields( def test_set_inventory_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_inventory._get_unset_required_fields({}) @@ -6299,7 +6289,7 @@ def test_set_inventory_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_inventory_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6359,7 +6349,7 @@ def test_set_inventory_rest_bad_request( transport: str = "rest", request_type=product_service.SetInventoryRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6385,7 +6375,7 @@ def test_set_inventory_rest_bad_request( def test_set_inventory_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6430,7 +6420,7 @@ def test_set_inventory_rest_flattened(): def test_set_inventory_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6446,7 +6436,7 @@ def test_set_inventory_rest_flattened_error(transport: str = "rest"): def test_set_inventory_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6459,7 +6449,7 @@ def test_set_inventory_rest_error(): ) def test_add_fulfillment_places_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6509,7 +6499,7 @@ def test_add_fulfillment_places_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6520,7 +6510,7 @@ def test_add_fulfillment_places_rest_required_fields( jsonified_request["placeIds"] = "place_ids_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6533,7 +6523,7 @@ def test_add_fulfillment_places_rest_required_fields( assert jsonified_request["placeIds"] == "place_ids_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6573,7 +6563,7 @@ def test_add_fulfillment_places_rest_required_fields( def test_add_fulfillment_places_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_fulfillment_places._get_unset_required_fields({}) @@ -6592,7 +6582,7 @@ def test_add_fulfillment_places_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_fulfillment_places_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6652,7 +6642,7 @@ def test_add_fulfillment_places_rest_bad_request( transport: str = "rest", request_type=product_service.AddFulfillmentPlacesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6676,7 +6666,7 @@ def test_add_fulfillment_places_rest_bad_request( def test_add_fulfillment_places_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6718,7 +6708,7 @@ def test_add_fulfillment_places_rest_flattened(): def test_add_fulfillment_places_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6733,7 +6723,7 @@ def test_add_fulfillment_places_rest_flattened_error(transport: str = "rest"): def test_add_fulfillment_places_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6746,7 +6736,7 @@ def test_add_fulfillment_places_rest_error(): ) def test_remove_fulfillment_places_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6796,7 +6786,7 @@ def test_remove_fulfillment_places_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6807,7 +6797,7 @@ def test_remove_fulfillment_places_rest_required_fields( jsonified_request["placeIds"] = "place_ids_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6820,7 +6810,7 @@ def test_remove_fulfillment_places_rest_required_fields( assert jsonified_request["placeIds"] == "place_ids_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6860,7 +6850,7 @@ def test_remove_fulfillment_places_rest_required_fields( def test_remove_fulfillment_places_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_fulfillment_places._get_unset_required_fields({}) @@ -6879,7 +6869,7 @@ def test_remove_fulfillment_places_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_fulfillment_places_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6939,7 +6929,7 @@ def test_remove_fulfillment_places_rest_bad_request( transport: str = "rest", request_type=product_service.RemoveFulfillmentPlacesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6963,7 +6953,7 @@ def test_remove_fulfillment_places_rest_bad_request( def test_remove_fulfillment_places_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7005,7 +6995,7 @@ def test_remove_fulfillment_places_rest_flattened(): def test_remove_fulfillment_places_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7020,7 +7010,7 @@ def test_remove_fulfillment_places_rest_flattened_error(transport: str = "rest") def test_remove_fulfillment_places_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7033,7 +7023,7 @@ def test_remove_fulfillment_places_rest_error(): ) def test_add_local_inventories_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7081,7 +7071,7 @@ def test_add_local_inventories_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7090,7 +7080,7 @@ def test_add_local_inventories_rest_required_fields( jsonified_request["product"] = "product_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7099,7 +7089,7 @@ def test_add_local_inventories_rest_required_fields( assert jsonified_request["product"] == "product_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7139,7 +7129,7 @@ def test_add_local_inventories_rest_required_fields( def test_add_local_inventories_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_local_inventories._get_unset_required_fields({}) @@ -7157,7 +7147,7 @@ def test_add_local_inventories_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_local_inventories_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -7217,7 +7207,7 @@ def test_add_local_inventories_rest_bad_request( transport: str = "rest", request_type=product_service.AddLocalInventoriesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7241,7 +7231,7 @@ def test_add_local_inventories_rest_bad_request( def test_add_local_inventories_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7283,7 +7273,7 @@ def test_add_local_inventories_rest_flattened(): def test_add_local_inventories_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7298,7 +7288,7 @@ def test_add_local_inventories_rest_flattened_error(transport: str = "rest"): def test_add_local_inventories_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7311,7 +7301,7 @@ def test_add_local_inventories_rest_error(): ) def test_remove_local_inventories_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7360,7 +7350,7 @@ def test_remove_local_inventories_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7370,7 +7360,7 @@ def test_remove_local_inventories_rest_required_fields( jsonified_request["placeIds"] = "place_ids_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7381,7 +7371,7 @@ def test_remove_local_inventories_rest_required_fields( assert jsonified_request["placeIds"] == "place_ids_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7421,7 +7411,7 @@ def test_remove_local_inventories_rest_required_fields( def test_remove_local_inventories_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_local_inventories._get_unset_required_fields({}) @@ -7439,7 +7429,7 @@ def test_remove_local_inventories_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_local_inventories_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -7499,7 +7489,7 @@ def test_remove_local_inventories_rest_bad_request( transport: str = "rest", request_type=product_service.RemoveLocalInventoriesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7523,7 +7513,7 @@ def test_remove_local_inventories_rest_bad_request( def test_remove_local_inventories_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7565,7 +7555,7 @@ def test_remove_local_inventories_rest_flattened(): def test_remove_local_inventories_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7580,24 +7570,24 @@ def test_remove_local_inventories_rest_flattened_error(transport: str = "rest"): def test_remove_local_inventories_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProductServiceClient( @@ -7607,7 +7597,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7622,13 +7612,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ProductServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProductServiceClient( @@ -7640,7 +7629,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ProductServiceClient(transport=transport) assert client.transport is transport @@ -7649,13 +7638,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ProductServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7672,7 +7661,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7686,7 +7675,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ProductServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7694,7 +7683,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7706,7 +7695,7 @@ def test_product_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ProductServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7718,7 +7707,7 @@ def test_product_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ProductServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7767,7 +7756,7 @@ def test_product_service_base_transport_with_credentials_file(): "google.cloud.retail_v2.services.product_service.transports.ProductServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProductServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7786,7 +7775,7 @@ def test_product_service_base_transport_with_adc(): "google.cloud.retail_v2.services.product_service.transports.ProductServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProductServiceTransport() adc.assert_called_once() @@ -7794,7 +7783,7 @@ def test_product_service_base_transport_with_adc(): def test_product_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ProductServiceClient() adc.assert_called_once_with( scopes=None, @@ -7814,7 +7803,7 @@ def test_product_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7861,7 +7850,7 @@ def test_product_service_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7889,7 +7878,7 @@ def test_product_service_transport_create_channel(transport_class, grpc_helpers) ], ) def test_product_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7927,7 +7916,7 @@ def test_product_service_grpc_transport_client_cert_source_for_mtls(transport_cl def test_product_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7939,7 +7928,7 @@ def test_product_service_http_transport_client_cert_source_for_mtls(): def test_product_service_rest_lro_client(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -7964,7 +7953,7 @@ def test_product_service_rest_lro_client(): ) def test_product_service_host_no_port(transport_name): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -7987,7 +7976,7 @@ def test_product_service_host_no_port(transport_name): ) def test_product_service_host_with_port(transport_name): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -8007,8 +7996,8 @@ def test_product_service_host_with_port(transport_name): ], ) def test_product_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ProductServiceClient( credentials=creds1, transport=transport_name, @@ -8102,7 +8091,7 @@ def test_product_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -8180,7 +8169,7 @@ def test_product_service_transport_channel_mtls_with_adc(transport_class): def test_product_service_grpc_lro_client(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -8197,7 +8186,7 @@ def test_product_service_grpc_lro_client(): def test_product_service_grpc_lro_async_client(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -8385,7 +8374,7 @@ def test_client_with_default_client_info(): transports.ProductServiceTransport, "_prep_wrapped_messages" ) as prep: client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8395,7 +8384,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ProductServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8404,7 +8393,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -8419,7 +8408,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8449,7 +8438,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -8477,7 +8466,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8507,7 +8496,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -8533,7 +8522,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8558,7 +8547,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8584,7 +8573,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8613,7 +8602,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8642,7 +8631,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8660,7 +8649,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8678,7 +8667,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8703,7 +8692,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8729,7 +8718,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8758,7 +8747,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8787,7 +8776,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8805,7 +8794,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8829,7 +8818,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8846,7 +8835,7 @@ def test_client_ctx(): ] for transport in transports: client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_search_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_search_service.py index fce71b5fd29a..be9ffd871f0e 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_search_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_search_service.py @@ -79,18 +79,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -313,7 +301,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -340,42 +328,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -386,7 +381,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_search_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -438,7 +433,7 @@ def test_search_service_client_service_account_always_use_jwt( ], ) def test_search_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -501,9 +496,7 @@ def test_search_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(SearchServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -902,20 +895,20 @@ def test_search_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -927,13 +920,11 @@ def test_search_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -949,8 +940,7 @@ def test_search_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1103,8 +1093,8 @@ def test_search_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1133,7 +1123,7 @@ def test_search_service_client_create_channel_credentials_file( ) def test_search(request_type, transport: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1173,7 +1163,7 @@ def test_search_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1190,7 +1180,7 @@ async def test_search_async( transport: str = "grpc_asyncio", request_type=search_service.SearchRequest ): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1235,7 +1225,7 @@ async def test_search_async_from_dict(): def test_search_field_headers(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1265,7 +1255,7 @@ def test_search_field_headers(): @pytest.mark.asyncio async def test_search_field_headers_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1296,7 +1286,7 @@ async def test_search_field_headers_async(): def test_search_pager(transport_name: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1348,7 +1338,7 @@ def test_search_pager(transport_name: str = "grpc"): def test_search_pages(transport_name: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1390,7 +1380,7 @@ def test_search_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_async_pager(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1442,7 +1432,7 @@ async def test_search_async_pager(): @pytest.mark.asyncio async def test_search_async_pages(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1495,7 +1485,7 @@ async def test_search_async_pages(): ) def test_search_rest(request_type): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1557,7 +1547,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).search._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1567,7 +1557,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): jsonified_request["visitorId"] = "visitor_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).search._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1578,7 +1568,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): assert jsonified_request["visitorId"] == "visitor_id_value" client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1621,7 +1611,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): def test_search_rest_unset_required_fields(): transport = transports.SearchServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.search._get_unset_required_fields({}) @@ -1639,7 +1629,7 @@ def test_search_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_search_rest_interceptors(null_interceptor): transport = transports.SearchServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SearchServiceRestInterceptor(), @@ -1695,7 +1685,7 @@ def test_search_rest_bad_request( transport: str = "rest", request_type=search_service.SearchRequest ): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1719,7 +1709,7 @@ def test_search_rest_bad_request( def test_search_rest_pager(transport: str = "rest"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1785,17 +1775,17 @@ def test_search_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SearchServiceClient( @@ -1805,7 +1795,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1820,13 +1810,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SearchServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SearchServiceClient( @@ -1838,7 +1827,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SearchServiceClient(transport=transport) assert client.transport is transport @@ -1847,13 +1836,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SearchServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1870,7 +1859,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1884,7 +1873,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SearchServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1892,7 +1881,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1904,7 +1893,7 @@ def test_search_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SearchServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1916,7 +1905,7 @@ def test_search_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SearchServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1950,7 +1939,7 @@ def test_search_service_base_transport_with_credentials_file(): "google.cloud.retail_v2.services.search_service.transports.SearchServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SearchServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1969,7 +1958,7 @@ def test_search_service_base_transport_with_adc(): "google.cloud.retail_v2.services.search_service.transports.SearchServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SearchServiceTransport() adc.assert_called_once() @@ -1977,7 +1966,7 @@ def test_search_service_base_transport_with_adc(): def test_search_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SearchServiceClient() adc.assert_called_once_with( scopes=None, @@ -1997,7 +1986,7 @@ def test_search_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2044,7 +2033,7 @@ def test_search_service_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2072,7 +2061,7 @@ def test_search_service_transport_create_channel(transport_class, grpc_helpers): ], ) def test_search_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2110,7 +2099,7 @@ def test_search_service_grpc_transport_client_cert_source_for_mtls(transport_cla def test_search_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2130,7 +2119,7 @@ def test_search_service_http_transport_client_cert_source_for_mtls(): ) def test_search_service_host_no_port(transport_name): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -2153,7 +2142,7 @@ def test_search_service_host_no_port(transport_name): ) def test_search_service_host_with_port(transport_name): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -2173,8 +2162,8 @@ def test_search_service_host_with_port(transport_name): ], ) def test_search_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SearchServiceClient( credentials=creds1, transport=transport_name, @@ -2236,7 +2225,7 @@ def test_search_service_transport_channel_mtls_with_client_cert_source(transport mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2545,7 +2534,7 @@ def test_client_with_default_client_info(): transports.SearchServiceTransport, "_prep_wrapped_messages" ) as prep: client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2555,7 +2544,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SearchServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2564,7 +2553,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2579,7 +2568,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2609,7 +2598,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -2637,7 +2626,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2667,7 +2656,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -2693,7 +2682,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2718,7 +2707,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2744,7 +2733,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2773,7 +2762,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2802,7 +2791,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2820,7 +2809,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2838,7 +2827,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2863,7 +2852,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2889,7 +2878,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2918,7 +2907,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2947,7 +2936,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2965,7 +2954,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2989,7 +2978,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3006,7 +2995,7 @@ def test_client_ctx(): ] for transport in transports: client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_serving_config_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_serving_config_service.py index 7a36de168958..b86657b740e1 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_serving_config_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_serving_config_service.py @@ -83,18 +83,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -344,7 +332,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -371,42 +359,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -419,7 +414,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_serving_config_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -473,7 +468,7 @@ def test_serving_config_service_client_service_account_always_use_jwt( def test_serving_config_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -544,9 +539,7 @@ def test_serving_config_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ServingConfigServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -965,20 +958,20 @@ def test_serving_config_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -990,13 +983,11 @@ def test_serving_config_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1012,8 +1003,7 @@ def test_serving_config_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1179,8 +1169,8 @@ def test_serving_config_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1209,7 +1199,7 @@ def test_serving_config_service_client_create_channel_credentials_file( ) def test_create_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1278,7 +1268,7 @@ def test_create_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1298,7 +1288,7 @@ async def test_create_serving_config_async( request_type=serving_config_service.CreateServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1372,7 +1362,7 @@ async def test_create_serving_config_async_from_dict(): def test_create_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1404,7 +1394,7 @@ def test_create_serving_config_field_headers(): @pytest.mark.asyncio async def test_create_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1437,7 +1427,7 @@ async def test_create_serving_config_field_headers_async(): def test_create_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1471,7 +1461,7 @@ def test_create_serving_config_flattened(): def test_create_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1488,7 +1478,7 @@ def test_create_serving_config_flattened_error(): @pytest.mark.asyncio async def test_create_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1527,7 +1517,7 @@ async def test_create_serving_config_flattened_async(): @pytest.mark.asyncio async def test_create_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1550,7 +1540,7 @@ async def test_create_serving_config_flattened_error_async(): ) def test_delete_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1579,7 +1569,7 @@ def test_delete_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1599,7 +1589,7 @@ async def test_delete_serving_config_async( request_type=serving_config_service.DeleteServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1631,7 +1621,7 @@ async def test_delete_serving_config_async_from_dict(): def test_delete_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1663,7 +1653,7 @@ def test_delete_serving_config_field_headers(): @pytest.mark.asyncio async def test_delete_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1694,7 +1684,7 @@ async def test_delete_serving_config_field_headers_async(): def test_delete_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1720,7 +1710,7 @@ def test_delete_serving_config_flattened(): def test_delete_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1735,7 +1725,7 @@ def test_delete_serving_config_flattened_error(): @pytest.mark.asyncio async def test_delete_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1764,7 +1754,7 @@ async def test_delete_serving_config_flattened_async(): @pytest.mark.asyncio async def test_delete_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1785,7 +1775,7 @@ async def test_delete_serving_config_flattened_error_async(): ) def test_update_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1854,7 +1844,7 @@ def test_update_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1874,7 +1864,7 @@ async def test_update_serving_config_async( request_type=serving_config_service.UpdateServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1948,7 +1938,7 @@ async def test_update_serving_config_async_from_dict(): def test_update_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1980,7 +1970,7 @@ def test_update_serving_config_field_headers(): @pytest.mark.asyncio async def test_update_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2013,7 +2003,7 @@ async def test_update_serving_config_field_headers_async(): def test_update_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2043,7 +2033,7 @@ def test_update_serving_config_flattened(): def test_update_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2059,7 +2049,7 @@ def test_update_serving_config_flattened_error(): @pytest.mark.asyncio async def test_update_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2094,7 +2084,7 @@ async def test_update_serving_config_flattened_async(): @pytest.mark.asyncio async def test_update_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2116,7 +2106,7 @@ async def test_update_serving_config_flattened_error_async(): ) def test_get_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2185,7 +2175,7 @@ def test_get_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2205,7 +2195,7 @@ async def test_get_serving_config_async( request_type=serving_config_service.GetServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2279,7 +2269,7 @@ async def test_get_serving_config_async_from_dict(): def test_get_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2311,7 +2301,7 @@ def test_get_serving_config_field_headers(): @pytest.mark.asyncio async def test_get_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2344,7 +2334,7 @@ async def test_get_serving_config_field_headers_async(): def test_get_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2370,7 +2360,7 @@ def test_get_serving_config_flattened(): def test_get_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2385,7 +2375,7 @@ def test_get_serving_config_flattened_error(): @pytest.mark.asyncio async def test_get_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2416,7 +2406,7 @@ async def test_get_serving_config_flattened_async(): @pytest.mark.asyncio async def test_get_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2437,7 +2427,7 @@ async def test_get_serving_config_flattened_error_async(): ) def test_list_serving_configs(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2469,7 +2459,7 @@ def test_list_serving_configs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2489,7 +2479,7 @@ async def test_list_serving_configs_async( request_type=serving_config_service.ListServingConfigsRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2526,7 +2516,7 @@ async def test_list_serving_configs_async_from_dict(): def test_list_serving_configs_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2558,7 +2548,7 @@ def test_list_serving_configs_field_headers(): @pytest.mark.asyncio async def test_list_serving_configs_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2591,7 +2581,7 @@ async def test_list_serving_configs_field_headers_async(): def test_list_serving_configs_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2617,7 +2607,7 @@ def test_list_serving_configs_flattened(): def test_list_serving_configs_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2632,7 +2622,7 @@ def test_list_serving_configs_flattened_error(): @pytest.mark.asyncio async def test_list_serving_configs_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2663,7 +2653,7 @@ async def test_list_serving_configs_flattened_async(): @pytest.mark.asyncio async def test_list_serving_configs_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2677,7 +2667,7 @@ async def test_list_serving_configs_flattened_error_async(): def test_list_serving_configs_pager(transport_name: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2729,7 +2719,7 @@ def test_list_serving_configs_pager(transport_name: str = "grpc"): def test_list_serving_configs_pages(transport_name: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2773,7 +2763,7 @@ def test_list_serving_configs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_serving_configs_async_pager(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2825,7 +2815,7 @@ async def test_list_serving_configs_async_pager(): @pytest.mark.asyncio async def test_list_serving_configs_async_pages(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2882,7 +2872,7 @@ async def test_list_serving_configs_async_pages(): ) def test_add_control(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2949,7 +2939,7 @@ def test_add_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2967,7 +2957,7 @@ async def test_add_control_async( request_type=serving_config_service.AddControlRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3039,7 +3029,7 @@ async def test_add_control_async_from_dict(): def test_add_control_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3069,7 +3059,7 @@ def test_add_control_field_headers(): @pytest.mark.asyncio async def test_add_control_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3100,7 +3090,7 @@ async def test_add_control_field_headers_async(): def test_add_control_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3124,7 +3114,7 @@ def test_add_control_flattened(): def test_add_control_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3139,7 +3129,7 @@ def test_add_control_flattened_error(): @pytest.mark.asyncio async def test_add_control_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3168,7 +3158,7 @@ async def test_add_control_flattened_async(): @pytest.mark.asyncio async def test_add_control_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3189,7 +3179,7 @@ async def test_add_control_flattened_error_async(): ) def test_remove_control(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3256,7 +3246,7 @@ def test_remove_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3274,7 +3264,7 @@ async def test_remove_control_async( request_type=serving_config_service.RemoveControlRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3346,7 +3336,7 @@ async def test_remove_control_async_from_dict(): def test_remove_control_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3376,7 +3366,7 @@ def test_remove_control_field_headers(): @pytest.mark.asyncio async def test_remove_control_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3407,7 +3397,7 @@ async def test_remove_control_field_headers_async(): def test_remove_control_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3431,7 +3421,7 @@ def test_remove_control_flattened(): def test_remove_control_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3446,7 +3436,7 @@ def test_remove_control_flattened_error(): @pytest.mark.asyncio async def test_remove_control_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3475,7 +3465,7 @@ async def test_remove_control_flattened_async(): @pytest.mark.asyncio async def test_remove_control_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3496,7 +3486,7 @@ async def test_remove_control_flattened_error_async(): ) def test_create_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3697,7 +3687,7 @@ def test_create_serving_config_rest_required_fields( assert "servingConfigId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3709,7 +3699,7 @@ def test_create_serving_config_rest_required_fields( jsonified_request["servingConfigId"] = "serving_config_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_serving_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("serving_config_id",)) @@ -3722,7 +3712,7 @@ def test_create_serving_config_rest_required_fields( assert jsonified_request["servingConfigId"] == "serving_config_id_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3771,7 +3761,7 @@ def test_create_serving_config_rest_required_fields( def test_create_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_serving_config._get_unset_required_fields({}) @@ -3790,7 +3780,7 @@ def test_create_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -3849,7 +3839,7 @@ def test_create_serving_config_rest_bad_request( request_type=serving_config_service.CreateServingConfigRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3871,7 +3861,7 @@ def test_create_serving_config_rest_bad_request( def test_create_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3917,7 +3907,7 @@ def test_create_serving_config_rest_flattened(): def test_create_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3934,7 +3924,7 @@ def test_create_serving_config_rest_flattened_error(transport: str = "rest"): def test_create_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3947,7 +3937,7 @@ def test_create_serving_config_rest_error(): ) def test_delete_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3995,7 +3985,7 @@ def test_delete_serving_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4004,7 +3994,7 @@ def test_delete_serving_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4013,7 +4003,7 @@ def test_delete_serving_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4052,7 +4042,7 @@ def test_delete_serving_config_rest_required_fields( def test_delete_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_serving_config._get_unset_required_fields({}) @@ -4062,7 +4052,7 @@ def test_delete_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -4113,7 +4103,7 @@ def test_delete_serving_config_rest_bad_request( request_type=serving_config_service.DeleteServingConfigRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4137,7 +4127,7 @@ def test_delete_serving_config_rest_bad_request( def test_delete_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4179,7 +4169,7 @@ def test_delete_serving_config_rest_flattened(): def test_delete_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4194,7 +4184,7 @@ def test_delete_serving_config_rest_flattened_error(transport: str = "rest"): def test_delete_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4207,7 +4197,7 @@ def test_delete_serving_config_rest_error(): ) def test_update_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4409,14 +4399,14 @@ def test_update_serving_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_serving_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -4425,7 +4415,7 @@ def test_update_serving_config_rest_required_fields( # verify required fields with non-default values are left alone client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4468,7 +4458,7 @@ def test_update_serving_config_rest_required_fields( def test_update_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_serving_config._get_unset_required_fields({}) @@ -4478,7 +4468,7 @@ def test_update_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -4537,7 +4527,7 @@ def test_update_serving_config_rest_bad_request( request_type=serving_config_service.UpdateServingConfigRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4563,7 +4553,7 @@ def test_update_serving_config_rest_bad_request( def test_update_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4610,7 +4600,7 @@ def test_update_serving_config_rest_flattened(): def test_update_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4626,7 +4616,7 @@ def test_update_serving_config_rest_flattened_error(transport: str = "rest"): def test_update_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4639,7 +4629,7 @@ def test_update_serving_config_rest_error(): ) def test_get_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4729,7 +4719,7 @@ def test_get_serving_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4738,7 +4728,7 @@ def test_get_serving_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4747,7 +4737,7 @@ def test_get_serving_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4789,7 +4779,7 @@ def test_get_serving_config_rest_required_fields( def test_get_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_serving_config._get_unset_required_fields({}) @@ -4799,7 +4789,7 @@ def test_get_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -4857,7 +4847,7 @@ def test_get_serving_config_rest_bad_request( transport: str = "rest", request_type=serving_config_service.GetServingConfigRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4881,7 +4871,7 @@ def test_get_serving_config_rest_bad_request( def test_get_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4925,7 +4915,7 @@ def test_get_serving_config_rest_flattened(): def test_get_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4940,7 +4930,7 @@ def test_get_serving_config_rest_flattened_error(transport: str = "rest"): def test_get_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4953,7 +4943,7 @@ def test_get_serving_config_rest_error(): ) def test_list_serving_configs_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5006,7 +4996,7 @@ def test_list_serving_configs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_serving_configs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5015,7 +5005,7 @@ def test_list_serving_configs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_serving_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5031,7 +5021,7 @@ def test_list_serving_configs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5075,7 +5065,7 @@ def test_list_serving_configs_rest_required_fields( def test_list_serving_configs_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_serving_configs._get_unset_required_fields({}) @@ -5093,7 +5083,7 @@ def test_list_serving_configs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_serving_configs_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -5154,7 +5144,7 @@ def test_list_serving_configs_rest_bad_request( request_type=serving_config_service.ListServingConfigsRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5176,7 +5166,7 @@ def test_list_serving_configs_rest_bad_request( def test_list_serving_configs_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5222,7 +5212,7 @@ def test_list_serving_configs_rest_flattened(): def test_list_serving_configs_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5237,7 +5227,7 @@ def test_list_serving_configs_rest_flattened_error(transport: str = "rest"): def test_list_serving_configs_rest_pager(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5310,7 +5300,7 @@ def test_list_serving_configs_rest_pager(transport: str = "rest"): ) def test_add_control_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5401,7 +5391,7 @@ def test_add_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5411,7 +5401,7 @@ def test_add_control_rest_required_fields( jsonified_request["controlId"] = "control_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5422,7 +5412,7 @@ def test_add_control_rest_required_fields( assert jsonified_request["controlId"] == "control_id_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5465,7 +5455,7 @@ def test_add_control_rest_required_fields( def test_add_control_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_control._get_unset_required_fields({}) @@ -5483,7 +5473,7 @@ def test_add_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_control_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -5541,7 +5531,7 @@ def test_add_control_rest_bad_request( transport: str = "rest", request_type=serving_config_service.AddControlRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5565,7 +5555,7 @@ def test_add_control_rest_bad_request( def test_add_control_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5609,7 +5599,7 @@ def test_add_control_rest_flattened(): def test_add_control_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5624,7 +5614,7 @@ def test_add_control_rest_flattened_error(transport: str = "rest"): def test_add_control_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5637,7 +5627,7 @@ def test_add_control_rest_error(): ) def test_remove_control_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5728,7 +5718,7 @@ def test_remove_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5738,7 +5728,7 @@ def test_remove_control_rest_required_fields( jsonified_request["controlId"] = "control_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5749,7 +5739,7 @@ def test_remove_control_rest_required_fields( assert jsonified_request["controlId"] == "control_id_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5792,7 +5782,7 @@ def test_remove_control_rest_required_fields( def test_remove_control_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_control._get_unset_required_fields({}) @@ -5810,7 +5800,7 @@ def test_remove_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_control_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -5868,7 +5858,7 @@ def test_remove_control_rest_bad_request( transport: str = "rest", request_type=serving_config_service.RemoveControlRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5892,7 +5882,7 @@ def test_remove_control_rest_bad_request( def test_remove_control_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5936,7 +5926,7 @@ def test_remove_control_rest_flattened(): def test_remove_control_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5951,24 +5941,24 @@ def test_remove_control_rest_flattened_error(transport: str = "rest"): def test_remove_control_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServingConfigServiceClient( @@ -5978,7 +5968,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5993,13 +5983,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ServingConfigServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServingConfigServiceClient( @@ -6011,7 +6000,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServingConfigServiceClient(transport=transport) assert client.transport is transport @@ -6020,13 +6009,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServingConfigServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -6043,7 +6032,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -6057,7 +6046,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ServingConfigServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -6065,7 +6054,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -6077,7 +6066,7 @@ def test_serving_config_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServingConfigServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -6089,7 +6078,7 @@ def test_serving_config_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServingConfigServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -6129,7 +6118,7 @@ def test_serving_config_service_base_transport_with_credentials_file(): "google.cloud.retail_v2.services.serving_config_service.transports.ServingConfigServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServingConfigServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -6148,7 +6137,7 @@ def test_serving_config_service_base_transport_with_adc(): "google.cloud.retail_v2.services.serving_config_service.transports.ServingConfigServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServingConfigServiceTransport() adc.assert_called_once() @@ -6156,7 +6145,7 @@ def test_serving_config_service_base_transport_with_adc(): def test_serving_config_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ServingConfigServiceClient() adc.assert_called_once_with( scopes=None, @@ -6176,7 +6165,7 @@ def test_serving_config_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6223,7 +6212,7 @@ def test_serving_config_service_transport_create_channel(transport_class, grpc_h ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6253,7 +6242,7 @@ def test_serving_config_service_transport_create_channel(transport_class, grpc_h def test_serving_config_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6291,7 +6280,7 @@ def test_serving_config_service_grpc_transport_client_cert_source_for_mtls( def test_serving_config_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6311,7 +6300,7 @@ def test_serving_config_service_http_transport_client_cert_source_for_mtls(): ) def test_serving_config_service_host_no_port(transport_name): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -6334,7 +6323,7 @@ def test_serving_config_service_host_no_port(transport_name): ) def test_serving_config_service_host_with_port(transport_name): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -6354,8 +6343,8 @@ def test_serving_config_service_host_with_port(transport_name): ], ) def test_serving_config_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ServingConfigServiceClient( credentials=creds1, transport=transport_name, @@ -6437,7 +6426,7 @@ def test_serving_config_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6680,7 +6669,7 @@ def test_client_with_default_client_info(): transports.ServingConfigServiceTransport, "_prep_wrapped_messages" ) as prep: client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6690,7 +6679,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServingConfigServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6699,7 +6688,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6714,7 +6703,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6744,7 +6733,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6772,7 +6761,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6802,7 +6791,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -6828,7 +6817,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6853,7 +6842,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6879,7 +6868,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6908,7 +6897,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6937,7 +6926,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6955,7 +6944,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6973,7 +6962,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6998,7 +6987,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7024,7 +7013,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7053,7 +7042,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7082,7 +7071,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7100,7 +7089,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7124,7 +7113,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -7141,7 +7130,7 @@ def test_client_ctx(): ] for transport in transports: client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_user_event_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_user_event_service.py index 7681f4332d9c..3c9efbb99fa9 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_user_event_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_user_event_service.py @@ -102,18 +102,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -341,7 +329,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -368,42 +356,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -416,7 +411,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_user_event_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -470,7 +465,7 @@ def test_user_event_service_client_service_account_always_use_jwt( def test_user_event_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -533,9 +528,7 @@ def test_user_event_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(UserEventServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -954,20 +947,20 @@ def test_user_event_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -979,13 +972,11 @@ def test_user_event_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1001,8 +992,7 @@ def test_user_event_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1160,8 +1150,8 @@ def test_user_event_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1190,7 +1180,7 @@ def test_user_event_service_client_create_channel_credentials_file( ) def test_write_user_event(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1248,7 +1238,7 @@ def test_write_user_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1266,7 +1256,7 @@ async def test_write_user_event_async( request_type=user_event_service.WriteUserEventRequest, ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1329,7 +1319,7 @@ async def test_write_user_event_async_from_dict(): def test_write_user_event_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1359,7 +1349,7 @@ def test_write_user_event_field_headers(): @pytest.mark.asyncio async def test_write_user_event_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1397,7 +1387,7 @@ async def test_write_user_event_field_headers_async(): ) def test_collect_user_event(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1431,7 +1421,7 @@ def test_collect_user_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1451,7 +1441,7 @@ async def test_collect_user_event_async( request_type=user_event_service.CollectUserEventRequest, ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1490,7 +1480,7 @@ async def test_collect_user_event_async_from_dict(): def test_collect_user_event_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1522,7 +1512,7 @@ def test_collect_user_event_field_headers(): @pytest.mark.asyncio async def test_collect_user_event_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1562,7 +1552,7 @@ async def test_collect_user_event_field_headers_async(): ) def test_purge_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1591,7 +1581,7 @@ def test_purge_user_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1610,7 +1600,7 @@ async def test_purge_user_events_async( transport: str = "grpc_asyncio", request_type=purge_config.PurgeUserEventsRequest ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1644,7 +1634,7 @@ async def test_purge_user_events_async_from_dict(): def test_purge_user_events_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1676,7 +1666,7 @@ def test_purge_user_events_field_headers(): @pytest.mark.asyncio async def test_purge_user_events_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1716,7 +1706,7 @@ async def test_purge_user_events_field_headers_async(): ) def test_import_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1745,7 +1735,7 @@ def test_import_user_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1764,7 +1754,7 @@ async def test_import_user_events_async( transport: str = "grpc_asyncio", request_type=import_config.ImportUserEventsRequest ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1798,7 +1788,7 @@ async def test_import_user_events_async_from_dict(): def test_import_user_events_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1830,7 +1820,7 @@ def test_import_user_events_field_headers(): @pytest.mark.asyncio async def test_import_user_events_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1870,7 +1860,7 @@ async def test_import_user_events_field_headers_async(): ) def test_rejoin_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1899,7 +1889,7 @@ def test_rejoin_user_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1919,7 +1909,7 @@ async def test_rejoin_user_events_async( request_type=user_event_service.RejoinUserEventsRequest, ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1953,7 +1943,7 @@ async def test_rejoin_user_events_async_from_dict(): def test_rejoin_user_events_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1985,7 +1975,7 @@ def test_rejoin_user_events_field_headers(): @pytest.mark.asyncio async def test_rejoin_user_events_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2025,7 +2015,7 @@ async def test_rejoin_user_events_field_headers_async(): ) def test_write_user_event_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2296,7 +2286,7 @@ def test_write_user_event_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).write_user_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2305,7 +2295,7 @@ def test_write_user_event_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).write_user_event._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("write_async",)) @@ -2316,7 +2306,7 @@ def test_write_user_event_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2359,7 +2349,7 @@ def test_write_user_event_rest_required_fields( def test_write_user_event_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.write_user_event._get_unset_required_fields({}) @@ -2377,7 +2367,7 @@ def test_write_user_event_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_write_user_event_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -2433,7 +2423,7 @@ def test_write_user_event_rest_bad_request( transport: str = "rest", request_type=user_event_service.WriteUserEventRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2455,7 +2445,7 @@ def test_write_user_event_rest_bad_request( def test_write_user_event_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2468,7 +2458,7 @@ def test_write_user_event_rest_error(): ) def test_collect_user_event_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2521,7 +2511,7 @@ def test_collect_user_event_rest_required_fields( assert "userEvent" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).collect_user_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2533,7 +2523,7 @@ def test_collect_user_event_rest_required_fields( jsonified_request["userEvent"] = "user_event_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).collect_user_event._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2554,7 +2544,7 @@ def test_collect_user_event_rest_required_fields( assert jsonified_request["userEvent"] == "user_event_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2600,7 +2590,7 @@ def test_collect_user_event_rest_required_fields( def test_collect_user_event_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.collect_user_event._get_unset_required_fields({}) @@ -2626,7 +2616,7 @@ def test_collect_user_event_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_collect_user_event_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -2682,7 +2672,7 @@ def test_collect_user_event_rest_bad_request( transport: str = "rest", request_type=user_event_service.CollectUserEventRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2704,7 +2694,7 @@ def test_collect_user_event_rest_bad_request( def test_collect_user_event_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2717,7 +2707,7 @@ def test_collect_user_event_rest_error(): ) def test_purge_user_events_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2764,7 +2754,7 @@ def test_purge_user_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).purge_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2774,7 +2764,7 @@ def test_purge_user_events_rest_required_fields( jsonified_request["filter"] = "filter_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).purge_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2785,7 +2775,7 @@ def test_purge_user_events_rest_required_fields( assert jsonified_request["filter"] == "filter_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2825,7 +2815,7 @@ def test_purge_user_events_rest_required_fields( def test_purge_user_events_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.purge_user_events._get_unset_required_fields({}) @@ -2843,7 +2833,7 @@ def test_purge_user_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_purge_user_events_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -2903,7 +2893,7 @@ def test_purge_user_events_rest_bad_request( transport: str = "rest", request_type=purge_config.PurgeUserEventsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2925,7 +2915,7 @@ def test_purge_user_events_rest_bad_request( def test_purge_user_events_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2938,7 +2928,7 @@ def test_purge_user_events_rest_error(): ) def test_import_user_events_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2984,7 +2974,7 @@ def test_import_user_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2993,7 +2983,7 @@ def test_import_user_events_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3002,7 +2992,7 @@ def test_import_user_events_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3042,7 +3032,7 @@ def test_import_user_events_rest_required_fields( def test_import_user_events_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_user_events._get_unset_required_fields({}) @@ -3060,7 +3050,7 @@ def test_import_user_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_user_events_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -3120,7 +3110,7 @@ def test_import_user_events_rest_bad_request( transport: str = "rest", request_type=import_config.ImportUserEventsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3142,7 +3132,7 @@ def test_import_user_events_rest_bad_request( def test_import_user_events_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3155,7 +3145,7 @@ def test_import_user_events_rest_error(): ) def test_rejoin_user_events_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3201,7 +3191,7 @@ def test_rejoin_user_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).rejoin_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3210,7 +3200,7 @@ def test_rejoin_user_events_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).rejoin_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3219,7 +3209,7 @@ def test_rejoin_user_events_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3259,7 +3249,7 @@ def test_rejoin_user_events_rest_required_fields( def test_rejoin_user_events_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.rejoin_user_events._get_unset_required_fields({}) @@ -3269,7 +3259,7 @@ def test_rejoin_user_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_rejoin_user_events_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -3329,7 +3319,7 @@ def test_rejoin_user_events_rest_bad_request( transport: str = "rest", request_type=user_event_service.RejoinUserEventsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3351,24 +3341,24 @@ def test_rejoin_user_events_rest_bad_request( def test_rejoin_user_events_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = UserEventServiceClient( @@ -3378,7 +3368,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -3393,13 +3383,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = UserEventServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = UserEventServiceClient( @@ -3411,7 +3400,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = UserEventServiceClient(transport=transport) assert client.transport is transport @@ -3420,13 +3409,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.UserEventServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -3443,7 +3432,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3457,7 +3446,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = UserEventServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3465,7 +3454,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3477,7 +3466,7 @@ def test_user_event_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.UserEventServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3489,7 +3478,7 @@ def test_user_event_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.UserEventServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3532,7 +3521,7 @@ def test_user_event_service_base_transport_with_credentials_file(): "google.cloud.retail_v2.services.user_event_service.transports.UserEventServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.UserEventServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3551,7 +3540,7 @@ def test_user_event_service_base_transport_with_adc(): "google.cloud.retail_v2.services.user_event_service.transports.UserEventServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.UserEventServiceTransport() adc.assert_called_once() @@ -3559,7 +3548,7 @@ def test_user_event_service_base_transport_with_adc(): def test_user_event_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) UserEventServiceClient() adc.assert_called_once_with( scopes=None, @@ -3579,7 +3568,7 @@ def test_user_event_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3626,7 +3615,7 @@ def test_user_event_service_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3654,7 +3643,7 @@ def test_user_event_service_transport_create_channel(transport_class, grpc_helpe ], ) def test_user_event_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3692,7 +3681,7 @@ def test_user_event_service_grpc_transport_client_cert_source_for_mtls(transport def test_user_event_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3704,7 +3693,7 @@ def test_user_event_service_http_transport_client_cert_source_for_mtls(): def test_user_event_service_rest_lro_client(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3729,7 +3718,7 @@ def test_user_event_service_rest_lro_client(): ) def test_user_event_service_host_no_port(transport_name): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -3752,7 +3741,7 @@ def test_user_event_service_host_no_port(transport_name): ) def test_user_event_service_host_with_port(transport_name): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -3772,8 +3761,8 @@ def test_user_event_service_host_with_port(transport_name): ], ) def test_user_event_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = UserEventServiceClient( credentials=creds1, transport=transport_name, @@ -3849,7 +3838,7 @@ def test_user_event_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3927,7 +3916,7 @@ def test_user_event_service_transport_channel_mtls_with_adc(transport_class): def test_user_event_service_grpc_lro_client(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -3944,7 +3933,7 @@ def test_user_event_service_grpc_lro_client(): def test_user_event_service_grpc_lro_async_client(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -4129,7 +4118,7 @@ def test_client_with_default_client_info(): transports.UserEventServiceTransport, "_prep_wrapped_messages" ) as prep: client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4139,7 +4128,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = UserEventServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4148,7 +4137,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -4163,7 +4152,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4193,7 +4182,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -4221,7 +4210,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4251,7 +4240,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -4277,7 +4266,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4302,7 +4291,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4328,7 +4317,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4357,7 +4346,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4386,7 +4375,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4404,7 +4393,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4422,7 +4411,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4447,7 +4436,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4473,7 +4462,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4502,7 +4491,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4531,7 +4520,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4549,7 +4538,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4573,7 +4562,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -4590,7 +4579,7 @@ def test_client_ctx(): ] for transport in transports: client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_analytics_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_analytics_service.py index d7ee5e1d0bfc..44b2397efc84 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_analytics_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_analytics_service.py @@ -87,18 +87,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -326,7 +314,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -353,42 +341,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -401,7 +396,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_analytics_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -455,7 +450,7 @@ def test_analytics_service_client_service_account_always_use_jwt( def test_analytics_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -518,9 +513,7 @@ def test_analytics_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(AnalyticsServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -939,20 +932,20 @@ def test_analytics_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -964,13 +957,11 @@ def test_analytics_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -986,8 +977,7 @@ def test_analytics_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1145,8 +1135,8 @@ def test_analytics_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1175,7 +1165,7 @@ def test_analytics_service_client_create_channel_credentials_file( ) def test_export_analytics_metrics(request_type, transport: str = "grpc"): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1204,7 +1194,7 @@ def test_export_analytics_metrics_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1224,7 +1214,7 @@ async def test_export_analytics_metrics_async( request_type=export_config.ExportAnalyticsMetricsRequest, ): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1258,7 +1248,7 @@ async def test_export_analytics_metrics_async_from_dict(): def test_export_analytics_metrics_field_headers(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1290,7 +1280,7 @@ def test_export_analytics_metrics_field_headers(): @pytest.mark.asyncio async def test_export_analytics_metrics_field_headers_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1330,7 +1320,7 @@ async def test_export_analytics_metrics_field_headers_async(): ) def test_export_analytics_metrics_rest(request_type): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1376,7 +1366,7 @@ def test_export_analytics_metrics_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).export_analytics_metrics._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1385,7 +1375,7 @@ def test_export_analytics_metrics_rest_required_fields( jsonified_request["catalog"] = "catalog_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).export_analytics_metrics._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1394,7 +1384,7 @@ def test_export_analytics_metrics_rest_required_fields( assert jsonified_request["catalog"] == "catalog_value" client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1434,7 +1424,7 @@ def test_export_analytics_metrics_rest_required_fields( def test_export_analytics_metrics_rest_unset_required_fields(): transport = transports.AnalyticsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.export_analytics_metrics._get_unset_required_fields({}) @@ -1452,7 +1442,7 @@ def test_export_analytics_metrics_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_export_analytics_metrics_rest_interceptors(null_interceptor): transport = transports.AnalyticsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AnalyticsServiceRestInterceptor(), @@ -1512,7 +1502,7 @@ def test_export_analytics_metrics_rest_bad_request( transport: str = "rest", request_type=export_config.ExportAnalyticsMetricsRequest ): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1534,24 +1524,24 @@ def test_export_analytics_metrics_rest_bad_request( def test_export_analytics_metrics_rest_error(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AnalyticsServiceClient( @@ -1561,7 +1551,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1576,13 +1566,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = AnalyticsServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AnalyticsServiceClient( @@ -1594,7 +1583,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = AnalyticsServiceClient(transport=transport) assert client.transport is transport @@ -1603,13 +1592,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.AnalyticsServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1626,7 +1615,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1640,7 +1629,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = AnalyticsServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1648,7 +1637,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1660,7 +1649,7 @@ def test_analytics_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.AnalyticsServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1672,7 +1661,7 @@ def test_analytics_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.AnalyticsServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1711,7 +1700,7 @@ def test_analytics_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.analytics_service.transports.AnalyticsServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AnalyticsServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1730,7 +1719,7 @@ def test_analytics_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.analytics_service.transports.AnalyticsServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AnalyticsServiceTransport() adc.assert_called_once() @@ -1738,7 +1727,7 @@ def test_analytics_service_base_transport_with_adc(): def test_analytics_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) AnalyticsServiceClient() adc.assert_called_once_with( scopes=None, @@ -1758,7 +1747,7 @@ def test_analytics_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -1805,7 +1794,7 @@ def test_analytics_service_transport_create_channel(transport_class, grpc_helper ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -1833,7 +1822,7 @@ def test_analytics_service_transport_create_channel(transport_class, grpc_helper ], ) def test_analytics_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1871,7 +1860,7 @@ def test_analytics_service_grpc_transport_client_cert_source_for_mtls(transport_ def test_analytics_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -1883,7 +1872,7 @@ def test_analytics_service_http_transport_client_cert_source_for_mtls(): def test_analytics_service_rest_lro_client(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -1908,7 +1897,7 @@ def test_analytics_service_rest_lro_client(): ) def test_analytics_service_host_no_port(transport_name): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -1931,7 +1920,7 @@ def test_analytics_service_host_no_port(transport_name): ) def test_analytics_service_host_with_port(transport_name): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -1951,8 +1940,8 @@ def test_analytics_service_host_with_port(transport_name): ], ) def test_analytics_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = AnalyticsServiceClient( credentials=creds1, transport=transport_name, @@ -2016,7 +2005,7 @@ def test_analytics_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2094,7 +2083,7 @@ def test_analytics_service_transport_channel_mtls_with_adc(transport_class): def test_analytics_service_grpc_lro_client(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -2111,7 +2100,7 @@ def test_analytics_service_grpc_lro_client(): def test_analytics_service_grpc_lro_async_client(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -2236,7 +2225,7 @@ def test_client_with_default_client_info(): transports.AnalyticsServiceTransport, "_prep_wrapped_messages" ) as prep: client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2246,7 +2235,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AnalyticsServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2255,7 +2244,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2270,7 +2259,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2303,7 +2292,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -2333,7 +2322,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2363,7 +2352,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -2389,7 +2378,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2414,7 +2403,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2440,7 +2429,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2469,7 +2458,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2498,7 +2487,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2516,7 +2505,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2534,7 +2523,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2559,7 +2548,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2585,7 +2574,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2614,7 +2603,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2643,7 +2632,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2661,7 +2650,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2685,7 +2674,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2702,7 +2691,7 @@ def test_client_ctx(): ] for transport in transports: client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_catalog_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_catalog_service.py index e4e29efea6ee..8a910b6e2669 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_catalog_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_catalog_service.py @@ -84,18 +84,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -322,7 +310,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -349,42 +337,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -395,7 +390,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_catalog_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -447,7 +442,7 @@ def test_catalog_service_client_service_account_always_use_jwt( ], ) def test_catalog_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -510,9 +505,7 @@ def test_catalog_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CatalogServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -911,20 +904,20 @@ def test_catalog_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -936,13 +929,11 @@ def test_catalog_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -958,8 +949,7 @@ def test_catalog_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1112,8 +1102,8 @@ def test_catalog_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1142,7 +1132,7 @@ def test_catalog_service_client_create_channel_credentials_file( ) def test_list_catalogs(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1172,7 +1162,7 @@ def test_list_catalogs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1189,7 +1179,7 @@ async def test_list_catalogs_async( transport: str = "grpc_asyncio", request_type=catalog_service.ListCatalogsRequest ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1224,7 +1214,7 @@ async def test_list_catalogs_async_from_dict(): def test_list_catalogs_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1254,7 +1244,7 @@ def test_list_catalogs_field_headers(): @pytest.mark.asyncio async def test_list_catalogs_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1285,7 +1275,7 @@ async def test_list_catalogs_field_headers_async(): def test_list_catalogs_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1309,7 +1299,7 @@ def test_list_catalogs_flattened(): def test_list_catalogs_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1324,7 +1314,7 @@ def test_list_catalogs_flattened_error(): @pytest.mark.asyncio async def test_list_catalogs_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1353,7 +1343,7 @@ async def test_list_catalogs_flattened_async(): @pytest.mark.asyncio async def test_list_catalogs_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1367,7 +1357,7 @@ async def test_list_catalogs_flattened_error_async(): def test_list_catalogs_pager(transport_name: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1417,7 +1407,7 @@ def test_list_catalogs_pager(transport_name: str = "grpc"): def test_list_catalogs_pages(transport_name: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1459,7 +1449,7 @@ def test_list_catalogs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_catalogs_async_pager(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1509,7 +1499,7 @@ async def test_list_catalogs_async_pager(): @pytest.mark.asyncio async def test_list_catalogs_async_pages(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1564,7 +1554,7 @@ async def test_list_catalogs_async_pages(): ) def test_update_catalog(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1596,7 +1586,7 @@ def test_update_catalog_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1613,7 +1603,7 @@ async def test_update_catalog_async( transport: str = "grpc_asyncio", request_type=catalog_service.UpdateCatalogRequest ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1650,7 +1640,7 @@ async def test_update_catalog_async_from_dict(): def test_update_catalog_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1680,7 +1670,7 @@ def test_update_catalog_field_headers(): @pytest.mark.asyncio async def test_update_catalog_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1709,7 +1699,7 @@ async def test_update_catalog_field_headers_async(): def test_update_catalog_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1737,7 +1727,7 @@ def test_update_catalog_flattened(): def test_update_catalog_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1753,7 +1743,7 @@ def test_update_catalog_flattened_error(): @pytest.mark.asyncio async def test_update_catalog_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1784,7 +1774,7 @@ async def test_update_catalog_flattened_async(): @pytest.mark.asyncio async def test_update_catalog_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1806,7 +1796,7 @@ async def test_update_catalog_flattened_error_async(): ) def test_set_default_branch(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1835,7 +1825,7 @@ def test_set_default_branch_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1855,7 +1845,7 @@ async def test_set_default_branch_async( request_type=catalog_service.SetDefaultBranchRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1887,7 +1877,7 @@ async def test_set_default_branch_async_from_dict(): def test_set_default_branch_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1919,7 +1909,7 @@ def test_set_default_branch_field_headers(): @pytest.mark.asyncio async def test_set_default_branch_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1950,7 +1940,7 @@ async def test_set_default_branch_field_headers_async(): def test_set_default_branch_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1976,7 +1966,7 @@ def test_set_default_branch_flattened(): def test_set_default_branch_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1991,7 +1981,7 @@ def test_set_default_branch_flattened_error(): @pytest.mark.asyncio async def test_set_default_branch_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2020,7 +2010,7 @@ async def test_set_default_branch_flattened_async(): @pytest.mark.asyncio async def test_set_default_branch_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2041,7 +2031,7 @@ async def test_set_default_branch_flattened_error_async(): ) def test_get_default_branch(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2075,7 +2065,7 @@ def test_get_default_branch_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2095,7 +2085,7 @@ async def test_get_default_branch_async( request_type=catalog_service.GetDefaultBranchRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2134,7 +2124,7 @@ async def test_get_default_branch_async_from_dict(): def test_get_default_branch_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2166,7 +2156,7 @@ def test_get_default_branch_field_headers(): @pytest.mark.asyncio async def test_get_default_branch_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2199,7 +2189,7 @@ async def test_get_default_branch_field_headers_async(): def test_get_default_branch_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2225,7 +2215,7 @@ def test_get_default_branch_flattened(): def test_get_default_branch_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2240,7 +2230,7 @@ def test_get_default_branch_flattened_error(): @pytest.mark.asyncio async def test_get_default_branch_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2271,7 +2261,7 @@ async def test_get_default_branch_flattened_async(): @pytest.mark.asyncio async def test_get_default_branch_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2292,7 +2282,7 @@ async def test_get_default_branch_flattened_error_async(): ) def test_get_completion_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2347,7 +2337,7 @@ def test_get_completion_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2367,7 +2357,7 @@ async def test_get_completion_config_async( request_type=catalog_service.GetCompletionConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2427,7 +2417,7 @@ async def test_get_completion_config_async_from_dict(): def test_get_completion_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2459,7 +2449,7 @@ def test_get_completion_config_field_headers(): @pytest.mark.asyncio async def test_get_completion_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2492,7 +2482,7 @@ async def test_get_completion_config_field_headers_async(): def test_get_completion_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2518,7 +2508,7 @@ def test_get_completion_config_flattened(): def test_get_completion_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2533,7 +2523,7 @@ def test_get_completion_config_flattened_error(): @pytest.mark.asyncio async def test_get_completion_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2564,7 +2554,7 @@ async def test_get_completion_config_flattened_async(): @pytest.mark.asyncio async def test_get_completion_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2585,7 +2575,7 @@ async def test_get_completion_config_flattened_error_async(): ) def test_update_completion_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2640,7 +2630,7 @@ def test_update_completion_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2660,7 +2650,7 @@ async def test_update_completion_config_async( request_type=catalog_service.UpdateCompletionConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2720,7 +2710,7 @@ async def test_update_completion_config_async_from_dict(): def test_update_completion_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2752,7 +2742,7 @@ def test_update_completion_config_field_headers(): @pytest.mark.asyncio async def test_update_completion_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2785,7 +2775,7 @@ async def test_update_completion_config_field_headers_async(): def test_update_completion_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2815,7 +2805,7 @@ def test_update_completion_config_flattened(): def test_update_completion_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2831,7 +2821,7 @@ def test_update_completion_config_flattened_error(): @pytest.mark.asyncio async def test_update_completion_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2866,7 +2856,7 @@ async def test_update_completion_config_flattened_async(): @pytest.mark.asyncio async def test_update_completion_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2888,7 +2878,7 @@ async def test_update_completion_config_flattened_error_async(): ) def test_get_attributes_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2925,7 +2915,7 @@ def test_get_attributes_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2945,7 +2935,7 @@ async def test_get_attributes_config_async( request_type=catalog_service.GetAttributesConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2987,7 +2977,7 @@ async def test_get_attributes_config_async_from_dict(): def test_get_attributes_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3019,7 +3009,7 @@ def test_get_attributes_config_field_headers(): @pytest.mark.asyncio async def test_get_attributes_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3052,7 +3042,7 @@ async def test_get_attributes_config_field_headers_async(): def test_get_attributes_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3078,7 +3068,7 @@ def test_get_attributes_config_flattened(): def test_get_attributes_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3093,7 +3083,7 @@ def test_get_attributes_config_flattened_error(): @pytest.mark.asyncio async def test_get_attributes_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3124,7 +3114,7 @@ async def test_get_attributes_config_flattened_async(): @pytest.mark.asyncio async def test_get_attributes_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3145,7 +3135,7 @@ async def test_get_attributes_config_flattened_error_async(): ) def test_update_attributes_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3182,7 +3172,7 @@ def test_update_attributes_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3202,7 +3192,7 @@ async def test_update_attributes_config_async( request_type=catalog_service.UpdateAttributesConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3244,7 +3234,7 @@ async def test_update_attributes_config_async_from_dict(): def test_update_attributes_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3276,7 +3266,7 @@ def test_update_attributes_config_field_headers(): @pytest.mark.asyncio async def test_update_attributes_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3309,7 +3299,7 @@ async def test_update_attributes_config_field_headers_async(): def test_update_attributes_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3339,7 +3329,7 @@ def test_update_attributes_config_flattened(): def test_update_attributes_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3355,7 +3345,7 @@ def test_update_attributes_config_flattened_error(): @pytest.mark.asyncio async def test_update_attributes_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3390,7 +3380,7 @@ async def test_update_attributes_config_flattened_async(): @pytest.mark.asyncio async def test_update_attributes_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3412,7 +3402,7 @@ async def test_update_attributes_config_flattened_error_async(): ) def test_add_catalog_attribute(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3449,7 +3439,7 @@ def test_add_catalog_attribute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3469,7 +3459,7 @@ async def test_add_catalog_attribute_async( request_type=catalog_service.AddCatalogAttributeRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3511,7 +3501,7 @@ async def test_add_catalog_attribute_async_from_dict(): def test_add_catalog_attribute_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3543,7 +3533,7 @@ def test_add_catalog_attribute_field_headers(): @pytest.mark.asyncio async def test_add_catalog_attribute_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3583,7 +3573,7 @@ async def test_add_catalog_attribute_field_headers_async(): ) def test_remove_catalog_attribute(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3620,7 +3610,7 @@ def test_remove_catalog_attribute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3640,7 +3630,7 @@ async def test_remove_catalog_attribute_async( request_type=catalog_service.RemoveCatalogAttributeRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3682,7 +3672,7 @@ async def test_remove_catalog_attribute_async_from_dict(): def test_remove_catalog_attribute_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3714,7 +3704,7 @@ def test_remove_catalog_attribute_field_headers(): @pytest.mark.asyncio async def test_remove_catalog_attribute_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3754,7 +3744,7 @@ async def test_remove_catalog_attribute_field_headers_async(): ) def test_batch_remove_catalog_attributes(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3788,7 +3778,7 @@ def test_batch_remove_catalog_attributes_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3808,7 +3798,7 @@ async def test_batch_remove_catalog_attributes_async( request_type=catalog_service.BatchRemoveCatalogAttributesRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3847,7 +3837,7 @@ async def test_batch_remove_catalog_attributes_async_from_dict(): def test_batch_remove_catalog_attributes_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3879,7 +3869,7 @@ def test_batch_remove_catalog_attributes_field_headers(): @pytest.mark.asyncio async def test_batch_remove_catalog_attributes_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3919,7 +3909,7 @@ async def test_batch_remove_catalog_attributes_field_headers_async(): ) def test_replace_catalog_attribute(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3956,7 +3946,7 @@ def test_replace_catalog_attribute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3976,7 +3966,7 @@ async def test_replace_catalog_attribute_async( request_type=catalog_service.ReplaceCatalogAttributeRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4018,7 +4008,7 @@ async def test_replace_catalog_attribute_async_from_dict(): def test_replace_catalog_attribute_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4050,7 +4040,7 @@ def test_replace_catalog_attribute_field_headers(): @pytest.mark.asyncio async def test_replace_catalog_attribute_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4090,7 +4080,7 @@ async def test_replace_catalog_attribute_field_headers_async(): ) def test_list_catalogs_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4141,7 +4131,7 @@ def test_list_catalogs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_catalogs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4150,7 +4140,7 @@ def test_list_catalogs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_catalogs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4166,7 +4156,7 @@ def test_list_catalogs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4208,7 +4198,7 @@ def test_list_catalogs_rest_required_fields( def test_list_catalogs_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_catalogs._get_unset_required_fields({}) @@ -4226,7 +4216,7 @@ def test_list_catalogs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_catalogs_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4284,7 +4274,7 @@ def test_list_catalogs_rest_bad_request( transport: str = "rest", request_type=catalog_service.ListCatalogsRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4306,7 +4296,7 @@ def test_list_catalogs_rest_bad_request( def test_list_catalogs_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4348,7 +4338,7 @@ def test_list_catalogs_rest_flattened(): def test_list_catalogs_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4363,7 +4353,7 @@ def test_list_catalogs_rest_flattened_error(transport: str = "rest"): def test_list_catalogs_rest_pager(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4433,7 +4423,7 @@ def test_list_catalogs_rest_pager(transport: str = "rest"): ) def test_update_catalog_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4579,14 +4569,14 @@ def test_update_catalog_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_catalog._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_catalog._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -4595,7 +4585,7 @@ def test_update_catalog_rest_required_fields( # verify required fields with non-default values are left alone client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4638,7 +4628,7 @@ def test_update_catalog_rest_required_fields( def test_update_catalog_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_catalog._get_unset_required_fields({}) @@ -4648,7 +4638,7 @@ def test_update_catalog_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_catalog_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4704,7 +4694,7 @@ def test_update_catalog_rest_bad_request( transport: str = "rest", request_type=catalog_service.UpdateCatalogRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4728,7 +4718,7 @@ def test_update_catalog_rest_bad_request( def test_update_catalog_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4773,7 +4763,7 @@ def test_update_catalog_rest_flattened(): def test_update_catalog_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4789,7 +4779,7 @@ def test_update_catalog_rest_flattened_error(transport: str = "rest"): def test_update_catalog_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4802,7 +4792,7 @@ def test_update_catalog_rest_error(): ) def test_set_default_branch_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4831,7 +4821,7 @@ def test_set_default_branch_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_default_branch_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4881,7 +4871,7 @@ def test_set_default_branch_rest_bad_request( transport: str = "rest", request_type=catalog_service.SetDefaultBranchRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4903,7 +4893,7 @@ def test_set_default_branch_rest_bad_request( def test_set_default_branch_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4945,7 +4935,7 @@ def test_set_default_branch_rest_flattened(): def test_set_default_branch_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4960,7 +4950,7 @@ def test_set_default_branch_rest_flattened_error(transport: str = "rest"): def test_set_default_branch_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4973,7 +4963,7 @@ def test_set_default_branch_rest_error(): ) def test_get_default_branch_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5009,7 +4999,7 @@ def test_get_default_branch_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_default_branch_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -5067,7 +5057,7 @@ def test_get_default_branch_rest_bad_request( transport: str = "rest", request_type=catalog_service.GetDefaultBranchRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5089,7 +5079,7 @@ def test_get_default_branch_rest_bad_request( def test_get_default_branch_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5133,7 +5123,7 @@ def test_get_default_branch_rest_flattened(): def test_get_default_branch_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5148,7 +5138,7 @@ def test_get_default_branch_rest_flattened_error(transport: str = "rest"): def test_get_default_branch_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5161,7 +5151,7 @@ def test_get_default_branch_rest_error(): ) def test_get_completion_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5237,7 +5227,7 @@ def test_get_completion_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_completion_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5246,7 +5236,7 @@ def test_get_completion_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_completion_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5255,7 +5245,7 @@ def test_get_completion_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5297,7 +5287,7 @@ def test_get_completion_config_rest_required_fields( def test_get_completion_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_completion_config._get_unset_required_fields({}) @@ -5307,7 +5297,7 @@ def test_get_completion_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_completion_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -5365,7 +5355,7 @@ def test_get_completion_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.GetCompletionConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5389,7 +5379,7 @@ def test_get_completion_config_rest_bad_request( def test_get_completion_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5433,7 +5423,7 @@ def test_get_completion_config_rest_flattened(): def test_get_completion_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5448,7 +5438,7 @@ def test_get_completion_config_rest_flattened_error(transport: str = "rest"): def test_get_completion_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5461,7 +5451,7 @@ def test_get_completion_config_rest_error(): ) def test_update_completion_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5629,14 +5619,14 @@ def test_update_completion_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_completion_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_completion_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5645,7 +5635,7 @@ def test_update_completion_config_rest_required_fields( # verify required fields with non-default values are left alone client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5688,7 +5678,7 @@ def test_update_completion_config_rest_required_fields( def test_update_completion_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_completion_config._get_unset_required_fields({}) @@ -5698,7 +5688,7 @@ def test_update_completion_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_completion_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -5756,7 +5746,7 @@ def test_update_completion_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.UpdateCompletionConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5782,7 +5772,7 @@ def test_update_completion_config_rest_bad_request( def test_update_completion_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5829,7 +5819,7 @@ def test_update_completion_config_rest_flattened(): def test_update_completion_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5845,7 +5835,7 @@ def test_update_completion_config_rest_flattened_error(transport: str = "rest"): def test_update_completion_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5858,7 +5848,7 @@ def test_update_completion_config_rest_error(): ) def test_get_attributes_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5916,7 +5906,7 @@ def test_get_attributes_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_attributes_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5925,7 +5915,7 @@ def test_get_attributes_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_attributes_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5934,7 +5924,7 @@ def test_get_attributes_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5976,7 +5966,7 @@ def test_get_attributes_config_rest_required_fields( def test_get_attributes_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_attributes_config._get_unset_required_fields({}) @@ -5986,7 +5976,7 @@ def test_get_attributes_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_attributes_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6044,7 +6034,7 @@ def test_get_attributes_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.GetAttributesConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6068,7 +6058,7 @@ def test_get_attributes_config_rest_bad_request( def test_get_attributes_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6112,7 +6102,7 @@ def test_get_attributes_config_rest_flattened(): def test_get_attributes_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6127,7 +6117,7 @@ def test_get_attributes_config_rest_flattened_error(transport: str = "rest"): def test_get_attributes_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6140,7 +6130,7 @@ def test_get_attributes_config_rest_error(): ) def test_update_attributes_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6273,14 +6263,14 @@ def test_update_attributes_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_attributes_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_attributes_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -6289,7 +6279,7 @@ def test_update_attributes_config_rest_required_fields( # verify required fields with non-default values are left alone client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6332,7 +6322,7 @@ def test_update_attributes_config_rest_required_fields( def test_update_attributes_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_attributes_config._get_unset_required_fields({}) @@ -6342,7 +6332,7 @@ def test_update_attributes_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_attributes_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6400,7 +6390,7 @@ def test_update_attributes_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.UpdateAttributesConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6426,7 +6416,7 @@ def test_update_attributes_config_rest_bad_request( def test_update_attributes_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6473,7 +6463,7 @@ def test_update_attributes_config_rest_flattened(): def test_update_attributes_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6489,7 +6479,7 @@ def test_update_attributes_config_rest_flattened_error(transport: str = "rest"): def test_update_attributes_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6502,7 +6492,7 @@ def test_update_attributes_config_rest_error(): ) def test_add_catalog_attribute_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6560,7 +6550,7 @@ def test_add_catalog_attribute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6569,7 +6559,7 @@ def test_add_catalog_attribute_rest_required_fields( jsonified_request["attributesConfig"] = "attributes_config_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6578,7 +6568,7 @@ def test_add_catalog_attribute_rest_required_fields( assert jsonified_request["attributesConfig"] == "attributes_config_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6621,7 +6611,7 @@ def test_add_catalog_attribute_rest_required_fields( def test_add_catalog_attribute_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_catalog_attribute._get_unset_required_fields({}) @@ -6639,7 +6629,7 @@ def test_add_catalog_attribute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_catalog_attribute_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6697,7 +6687,7 @@ def test_add_catalog_attribute_rest_bad_request( transport: str = "rest", request_type=catalog_service.AddCatalogAttributeRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6721,7 +6711,7 @@ def test_add_catalog_attribute_rest_bad_request( def test_add_catalog_attribute_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6734,7 +6724,7 @@ def test_add_catalog_attribute_rest_error(): ) def test_remove_catalog_attribute_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6793,7 +6783,7 @@ def test_remove_catalog_attribute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6803,7 +6793,7 @@ def test_remove_catalog_attribute_rest_required_fields( jsonified_request["key"] = "key_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6814,7 +6804,7 @@ def test_remove_catalog_attribute_rest_required_fields( assert jsonified_request["key"] == "key_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6857,7 +6847,7 @@ def test_remove_catalog_attribute_rest_required_fields( def test_remove_catalog_attribute_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_catalog_attribute._get_unset_required_fields({}) @@ -6875,7 +6865,7 @@ def test_remove_catalog_attribute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_catalog_attribute_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6933,7 +6923,7 @@ def test_remove_catalog_attribute_rest_bad_request( transport: str = "rest", request_type=catalog_service.RemoveCatalogAttributeRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6957,7 +6947,7 @@ def test_remove_catalog_attribute_rest_bad_request( def test_remove_catalog_attribute_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6970,7 +6960,7 @@ def test_remove_catalog_attribute_rest_error(): ) def test_batch_remove_catalog_attributes_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7028,7 +7018,7 @@ def test_batch_remove_catalog_attributes_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).batch_remove_catalog_attributes._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7038,7 +7028,7 @@ def test_batch_remove_catalog_attributes_rest_required_fields( jsonified_request["attributeKeys"] = "attribute_keys_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).batch_remove_catalog_attributes._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7049,7 +7039,7 @@ def test_batch_remove_catalog_attributes_rest_required_fields( assert jsonified_request["attributeKeys"] == "attribute_keys_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7094,7 +7084,7 @@ def test_batch_remove_catalog_attributes_rest_required_fields( def test_batch_remove_catalog_attributes_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.batch_remove_catalog_attributes._get_unset_required_fields( @@ -7114,7 +7104,7 @@ def test_batch_remove_catalog_attributes_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_batch_remove_catalog_attributes_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -7175,7 +7165,7 @@ def test_batch_remove_catalog_attributes_rest_bad_request( request_type=catalog_service.BatchRemoveCatalogAttributesRequest, ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7199,7 +7189,7 @@ def test_batch_remove_catalog_attributes_rest_bad_request( def test_batch_remove_catalog_attributes_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7212,7 +7202,7 @@ def test_batch_remove_catalog_attributes_rest_error(): ) def test_replace_catalog_attribute_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7270,7 +7260,7 @@ def test_replace_catalog_attribute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).replace_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7279,7 +7269,7 @@ def test_replace_catalog_attribute_rest_required_fields( jsonified_request["attributesConfig"] = "attributes_config_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).replace_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7288,7 +7278,7 @@ def test_replace_catalog_attribute_rest_required_fields( assert jsonified_request["attributesConfig"] == "attributes_config_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7331,7 +7321,7 @@ def test_replace_catalog_attribute_rest_required_fields( def test_replace_catalog_attribute_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.replace_catalog_attribute._get_unset_required_fields({}) @@ -7349,7 +7339,7 @@ def test_replace_catalog_attribute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_replace_catalog_attribute_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -7407,7 +7397,7 @@ def test_replace_catalog_attribute_rest_bad_request( transport: str = "rest", request_type=catalog_service.ReplaceCatalogAttributeRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7431,24 +7421,24 @@ def test_replace_catalog_attribute_rest_bad_request( def test_replace_catalog_attribute_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CatalogServiceClient( @@ -7458,7 +7448,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7473,13 +7463,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CatalogServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CatalogServiceClient( @@ -7491,7 +7480,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CatalogServiceClient(transport=transport) assert client.transport is transport @@ -7500,13 +7489,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CatalogServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7523,7 +7512,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7537,7 +7526,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CatalogServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7545,7 +7534,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7557,7 +7546,7 @@ def test_catalog_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CatalogServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7569,7 +7558,7 @@ def test_catalog_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CatalogServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7614,7 +7603,7 @@ def test_catalog_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.catalog_service.transports.CatalogServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CatalogServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7633,7 +7622,7 @@ def test_catalog_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.catalog_service.transports.CatalogServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CatalogServiceTransport() adc.assert_called_once() @@ -7641,7 +7630,7 @@ def test_catalog_service_base_transport_with_adc(): def test_catalog_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CatalogServiceClient() adc.assert_called_once_with( scopes=None, @@ -7661,7 +7650,7 @@ def test_catalog_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7708,7 +7697,7 @@ def test_catalog_service_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7736,7 +7725,7 @@ def test_catalog_service_transport_create_channel(transport_class, grpc_helpers) ], ) def test_catalog_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7774,7 +7763,7 @@ def test_catalog_service_grpc_transport_client_cert_source_for_mtls(transport_cl def test_catalog_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7794,7 +7783,7 @@ def test_catalog_service_http_transport_client_cert_source_for_mtls(): ) def test_catalog_service_host_no_port(transport_name): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -7817,7 +7806,7 @@ def test_catalog_service_host_no_port(transport_name): ) def test_catalog_service_host_with_port(transport_name): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -7837,8 +7826,8 @@ def test_catalog_service_host_with_port(transport_name): ], ) def test_catalog_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CatalogServiceClient( credentials=creds1, transport=transport_name, @@ -7935,7 +7924,7 @@ def test_catalog_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -8228,7 +8217,7 @@ def test_client_with_default_client_info(): transports.CatalogServiceTransport, "_prep_wrapped_messages" ) as prep: client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8238,7 +8227,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CatalogServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8247,7 +8236,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -8262,7 +8251,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8295,7 +8284,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -8325,7 +8314,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8355,7 +8344,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -8381,7 +8370,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8406,7 +8395,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8432,7 +8421,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8461,7 +8450,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8490,7 +8479,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8508,7 +8497,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8526,7 +8515,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8551,7 +8540,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8577,7 +8566,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8606,7 +8595,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8635,7 +8624,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8653,7 +8642,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8677,7 +8666,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8694,7 +8683,7 @@ def test_client_ctx(): ] for transport in transports: client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_completion_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_completion_service.py index 4fe672235e0b..320beac15af7 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_completion_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_completion_service.py @@ -88,18 +88,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -335,7 +323,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -362,42 +350,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -410,7 +405,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_completion_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -464,7 +459,7 @@ def test_completion_service_client_service_account_always_use_jwt( def test_completion_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -527,9 +522,7 @@ def test_completion_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CompletionServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -948,20 +941,20 @@ def test_completion_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -973,13 +966,11 @@ def test_completion_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -995,8 +986,7 @@ def test_completion_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1154,8 +1144,8 @@ def test_completion_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1184,7 +1174,7 @@ def test_completion_service_client_create_channel_credentials_file( ) def test_complete_query(request_type, transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1214,7 +1204,7 @@ def test_complete_query_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1232,7 +1222,7 @@ async def test_complete_query_async( request_type=completion_service.CompleteQueryRequest, ): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1267,7 +1257,7 @@ async def test_complete_query_async_from_dict(): def test_complete_query_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1297,7 +1287,7 @@ def test_complete_query_field_headers(): @pytest.mark.asyncio async def test_complete_query_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1335,7 +1325,7 @@ async def test_complete_query_field_headers_async(): ) def test_import_completion_data(request_type, transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1364,7 +1354,7 @@ def test_import_completion_data_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1384,7 +1374,7 @@ async def test_import_completion_data_async( request_type=import_config.ImportCompletionDataRequest, ): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1418,7 +1408,7 @@ async def test_import_completion_data_async_from_dict(): def test_import_completion_data_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1450,7 +1440,7 @@ def test_import_completion_data_field_headers(): @pytest.mark.asyncio async def test_import_completion_data_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1490,7 +1480,7 @@ async def test_import_completion_data_field_headers_async(): ) def test_complete_query_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1543,7 +1533,7 @@ def test_complete_query_rest_required_fields( assert "query" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).complete_query._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1555,7 +1545,7 @@ def test_complete_query_rest_required_fields( jsonified_request["query"] = "query_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).complete_query._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -1579,7 +1569,7 @@ def test_complete_query_rest_required_fields( assert jsonified_request["query"] == "query_value" client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1627,7 +1617,7 @@ def test_complete_query_rest_required_fields( def test_complete_query_rest_unset_required_fields(): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.complete_query._get_unset_required_fields({}) @@ -1656,7 +1646,7 @@ def test_complete_query_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_complete_query_rest_interceptors(null_interceptor): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CompletionServiceRestInterceptor(), @@ -1714,7 +1704,7 @@ def test_complete_query_rest_bad_request( transport: str = "rest", request_type=completion_service.CompleteQueryRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1736,7 +1726,7 @@ def test_complete_query_rest_bad_request( def test_complete_query_rest_error(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -1749,7 +1739,7 @@ def test_complete_query_rest_error(): ) def test_import_completion_data_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1795,7 +1785,7 @@ def test_import_completion_data_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_completion_data._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1804,7 +1794,7 @@ def test_import_completion_data_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_completion_data._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1813,7 +1803,7 @@ def test_import_completion_data_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1853,7 +1843,7 @@ def test_import_completion_data_rest_required_fields( def test_import_completion_data_rest_unset_required_fields(): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_completion_data._get_unset_required_fields({}) @@ -1871,7 +1861,7 @@ def test_import_completion_data_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_completion_data_rest_interceptors(null_interceptor): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CompletionServiceRestInterceptor(), @@ -1931,7 +1921,7 @@ def test_import_completion_data_rest_bad_request( transport: str = "rest", request_type=import_config.ImportCompletionDataRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1953,24 +1943,24 @@ def test_import_completion_data_rest_bad_request( def test_import_completion_data_rest_error(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CompletionServiceClient( @@ -1980,7 +1970,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1995,13 +1985,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CompletionServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CompletionServiceClient( @@ -2013,7 +2002,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CompletionServiceClient(transport=transport) assert client.transport is transport @@ -2022,13 +2011,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CompletionServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -2045,7 +2034,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -2059,7 +2048,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CompletionServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -2067,7 +2056,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -2079,7 +2068,7 @@ def test_completion_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CompletionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -2091,7 +2080,7 @@ def test_completion_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CompletionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -2131,7 +2120,7 @@ def test_completion_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.completion_service.transports.CompletionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CompletionServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -2150,7 +2139,7 @@ def test_completion_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.completion_service.transports.CompletionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CompletionServiceTransport() adc.assert_called_once() @@ -2158,7 +2147,7 @@ def test_completion_service_base_transport_with_adc(): def test_completion_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CompletionServiceClient() adc.assert_called_once_with( scopes=None, @@ -2178,7 +2167,7 @@ def test_completion_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2225,7 +2214,7 @@ def test_completion_service_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2253,7 +2242,7 @@ def test_completion_service_transport_create_channel(transport_class, grpc_helpe ], ) def test_completion_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2291,7 +2280,7 @@ def test_completion_service_grpc_transport_client_cert_source_for_mtls(transport def test_completion_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2303,7 +2292,7 @@ def test_completion_service_http_transport_client_cert_source_for_mtls(): def test_completion_service_rest_lro_client(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -2328,7 +2317,7 @@ def test_completion_service_rest_lro_client(): ) def test_completion_service_host_no_port(transport_name): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -2351,7 +2340,7 @@ def test_completion_service_host_no_port(transport_name): ) def test_completion_service_host_with_port(transport_name): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -2371,8 +2360,8 @@ def test_completion_service_host_with_port(transport_name): ], ) def test_completion_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CompletionServiceClient( credentials=creds1, transport=transport_name, @@ -2439,7 +2428,7 @@ def test_completion_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2517,7 +2506,7 @@ def test_completion_service_transport_channel_mtls_with_adc(transport_class): def test_completion_service_grpc_lro_client(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -2534,7 +2523,7 @@ def test_completion_service_grpc_lro_client(): def test_completion_service_grpc_lro_async_client(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -2685,7 +2674,7 @@ def test_client_with_default_client_info(): transports.CompletionServiceTransport, "_prep_wrapped_messages" ) as prep: client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2695,7 +2684,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CompletionServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2704,7 +2693,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2719,7 +2708,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2752,7 +2741,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -2782,7 +2771,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2812,7 +2801,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -2838,7 +2827,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2863,7 +2852,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2889,7 +2878,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2918,7 +2907,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2947,7 +2936,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2965,7 +2954,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2983,7 +2972,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3008,7 +2997,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3034,7 +3023,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3063,7 +3052,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3092,7 +3081,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3110,7 +3099,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3134,7 +3123,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3151,7 +3140,7 @@ def test_client_ctx(): ] for transport in transports: client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_control_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_control_service.py index de7121149338..53e2e6e89cb2 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_control_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_control_service.py @@ -84,18 +84,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -322,7 +310,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -349,42 +337,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -395,7 +390,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_control_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -447,7 +442,7 @@ def test_control_service_client_service_account_always_use_jwt( ], ) def test_control_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -510,9 +505,7 @@ def test_control_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ControlServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -911,20 +904,20 @@ def test_control_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -936,13 +929,11 @@ def test_control_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -958,8 +949,7 @@ def test_control_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1112,8 +1102,8 @@ def test_control_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1142,7 +1132,7 @@ def test_control_service_client_create_channel_credentials_file( ) def test_create_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1186,7 +1176,7 @@ def test_create_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1203,7 +1193,7 @@ async def test_create_control_async( transport: str = "grpc_asyncio", request_type=control_service.CreateControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1252,7 +1242,7 @@ async def test_create_control_async_from_dict(): def test_create_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1282,7 +1272,7 @@ def test_create_control_field_headers(): @pytest.mark.asyncio async def test_create_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1311,7 +1301,7 @@ async def test_create_control_field_headers_async(): def test_create_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1355,7 +1345,7 @@ def test_create_control_flattened(): def test_create_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1378,7 +1368,7 @@ def test_create_control_flattened_error(): @pytest.mark.asyncio async def test_create_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1425,7 +1415,7 @@ async def test_create_control_flattened_async(): @pytest.mark.asyncio async def test_create_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1454,7 +1444,7 @@ async def test_create_control_flattened_error_async(): ) def test_delete_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1481,7 +1471,7 @@ def test_delete_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1498,7 +1488,7 @@ async def test_delete_control_async( transport: str = "grpc_asyncio", request_type=control_service.DeleteControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1528,7 +1518,7 @@ async def test_delete_control_async_from_dict(): def test_delete_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1558,7 +1548,7 @@ def test_delete_control_field_headers(): @pytest.mark.asyncio async def test_delete_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1587,7 +1577,7 @@ async def test_delete_control_field_headers_async(): def test_delete_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1611,7 +1601,7 @@ def test_delete_control_flattened(): def test_delete_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1626,7 +1616,7 @@ def test_delete_control_flattened_error(): @pytest.mark.asyncio async def test_delete_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1653,7 +1643,7 @@ async def test_delete_control_flattened_async(): @pytest.mark.asyncio async def test_delete_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1674,7 +1664,7 @@ async def test_delete_control_flattened_error_async(): ) def test_update_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1718,7 +1708,7 @@ def test_update_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1735,7 +1725,7 @@ async def test_update_control_async( transport: str = "grpc_asyncio", request_type=control_service.UpdateControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1784,7 +1774,7 @@ async def test_update_control_async_from_dict(): def test_update_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1814,7 +1804,7 @@ def test_update_control_field_headers(): @pytest.mark.asyncio async def test_update_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1843,7 +1833,7 @@ async def test_update_control_field_headers_async(): def test_update_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1883,7 +1873,7 @@ def test_update_control_flattened(): def test_update_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1905,7 +1895,7 @@ def test_update_control_flattened_error(): @pytest.mark.asyncio async def test_update_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1948,7 +1938,7 @@ async def test_update_control_flattened_async(): @pytest.mark.asyncio async def test_update_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1976,7 +1966,7 @@ async def test_update_control_flattened_error_async(): ) def test_get_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2020,7 +2010,7 @@ def test_get_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2037,7 +2027,7 @@ async def test_get_control_async( transport: str = "grpc_asyncio", request_type=control_service.GetControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2086,7 +2076,7 @@ async def test_get_control_async_from_dict(): def test_get_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2116,7 +2106,7 @@ def test_get_control_field_headers(): @pytest.mark.asyncio async def test_get_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2145,7 +2135,7 @@ async def test_get_control_field_headers_async(): def test_get_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2169,7 +2159,7 @@ def test_get_control_flattened(): def test_get_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2184,7 +2174,7 @@ def test_get_control_flattened_error(): @pytest.mark.asyncio async def test_get_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2211,7 +2201,7 @@ async def test_get_control_flattened_async(): @pytest.mark.asyncio async def test_get_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2232,7 +2222,7 @@ async def test_get_control_flattened_error_async(): ) def test_list_controls(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2262,7 +2252,7 @@ def test_list_controls_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2279,7 +2269,7 @@ async def test_list_controls_async( transport: str = "grpc_asyncio", request_type=control_service.ListControlsRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2314,7 +2304,7 @@ async def test_list_controls_async_from_dict(): def test_list_controls_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2344,7 +2334,7 @@ def test_list_controls_field_headers(): @pytest.mark.asyncio async def test_list_controls_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2375,7 +2365,7 @@ async def test_list_controls_field_headers_async(): def test_list_controls_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2399,7 +2389,7 @@ def test_list_controls_flattened(): def test_list_controls_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2414,7 +2404,7 @@ def test_list_controls_flattened_error(): @pytest.mark.asyncio async def test_list_controls_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2443,7 +2433,7 @@ async def test_list_controls_flattened_async(): @pytest.mark.asyncio async def test_list_controls_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2457,7 +2447,7 @@ async def test_list_controls_flattened_error_async(): def test_list_controls_pager(transport_name: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2507,7 +2497,7 @@ def test_list_controls_pager(transport_name: str = "grpc"): def test_list_controls_pages(transport_name: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2549,7 +2539,7 @@ def test_list_controls_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_controls_async_pager(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2599,7 +2589,7 @@ async def test_list_controls_async_pager(): @pytest.mark.asyncio async def test_list_controls_async_pages(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2654,7 +2644,7 @@ async def test_list_controls_async_pages(): ) def test_create_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2865,7 +2855,7 @@ def test_create_control_rest_required_fields( assert "controlId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2877,7 +2867,7 @@ def test_create_control_rest_required_fields( jsonified_request["controlId"] = "control_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_control._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("control_id",)) @@ -2890,7 +2880,7 @@ def test_create_control_rest_required_fields( assert jsonified_request["controlId"] == "control_id_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2939,7 +2929,7 @@ def test_create_control_rest_required_fields( def test_create_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_control._get_unset_required_fields({}) @@ -2958,7 +2948,7 @@ def test_create_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -3014,7 +3004,7 @@ def test_create_control_rest_bad_request( transport: str = "rest", request_type=control_service.CreateControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3036,7 +3026,7 @@ def test_create_control_rest_bad_request( def test_create_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3088,7 +3078,7 @@ def test_create_control_rest_flattened(): def test_create_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3111,7 +3101,7 @@ def test_create_control_rest_flattened_error(transport: str = "rest"): def test_create_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3124,7 +3114,7 @@ def test_create_control_rest_error(): ) def test_delete_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3172,7 +3162,7 @@ def test_delete_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3181,7 +3171,7 @@ def test_delete_control_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3190,7 +3180,7 @@ def test_delete_control_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3229,7 +3219,7 @@ def test_delete_control_rest_required_fields( def test_delete_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_control._get_unset_required_fields({}) @@ -3239,7 +3229,7 @@ def test_delete_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -3289,7 +3279,7 @@ def test_delete_control_rest_bad_request( transport: str = "rest", request_type=control_service.DeleteControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3313,7 +3303,7 @@ def test_delete_control_rest_bad_request( def test_delete_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3355,7 +3345,7 @@ def test_delete_control_rest_flattened(): def test_delete_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3370,7 +3360,7 @@ def test_delete_control_rest_flattened_error(transport: str = "rest"): def test_delete_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3383,7 +3373,7 @@ def test_delete_control_rest_error(): ) def test_update_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3595,14 +3585,14 @@ def test_update_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_control._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -3611,7 +3601,7 @@ def test_update_control_rest_required_fields( # verify required fields with non-default values are left alone client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3654,7 +3644,7 @@ def test_update_control_rest_required_fields( def test_update_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_control._get_unset_required_fields({}) @@ -3664,7 +3654,7 @@ def test_update_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -3720,7 +3710,7 @@ def test_update_control_rest_bad_request( transport: str = "rest", request_type=control_service.UpdateControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3746,7 +3736,7 @@ def test_update_control_rest_bad_request( def test_update_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3799,7 +3789,7 @@ def test_update_control_rest_flattened(): def test_update_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3821,7 +3811,7 @@ def test_update_control_rest_flattened_error(transport: str = "rest"): def test_update_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3834,7 +3824,7 @@ def test_update_control_rest_error(): ) def test_get_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3901,7 +3891,7 @@ def test_get_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3910,7 +3900,7 @@ def test_get_control_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3919,7 +3909,7 @@ def test_get_control_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3961,7 +3951,7 @@ def test_get_control_rest_required_fields( def test_get_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_control._get_unset_required_fields({}) @@ -3971,7 +3961,7 @@ def test_get_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -4027,7 +4017,7 @@ def test_get_control_rest_bad_request( transport: str = "rest", request_type=control_service.GetControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4051,7 +4041,7 @@ def test_get_control_rest_bad_request( def test_get_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4095,7 +4085,7 @@ def test_get_control_rest_flattened(): def test_get_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4110,7 +4100,7 @@ def test_get_control_rest_flattened_error(transport: str = "rest"): def test_get_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4123,7 +4113,7 @@ def test_get_control_rest_error(): ) def test_list_controls_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4174,7 +4164,7 @@ def test_list_controls_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_controls._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4183,7 +4173,7 @@ def test_list_controls_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_controls._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4200,7 +4190,7 @@ def test_list_controls_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4242,7 +4232,7 @@ def test_list_controls_rest_required_fields( def test_list_controls_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_controls._get_unset_required_fields({}) @@ -4261,7 +4251,7 @@ def test_list_controls_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_controls_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -4319,7 +4309,7 @@ def test_list_controls_rest_bad_request( transport: str = "rest", request_type=control_service.ListControlsRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4341,7 +4331,7 @@ def test_list_controls_rest_bad_request( def test_list_controls_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4385,7 +4375,7 @@ def test_list_controls_rest_flattened(): def test_list_controls_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4400,7 +4390,7 @@ def test_list_controls_rest_flattened_error(transport: str = "rest"): def test_list_controls_rest_pager(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4466,17 +4456,17 @@ def test_list_controls_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ControlServiceClient( @@ -4486,7 +4476,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -4501,13 +4491,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ControlServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ControlServiceClient( @@ -4519,7 +4508,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ControlServiceClient(transport=transport) assert client.transport is transport @@ -4528,13 +4517,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ControlServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -4551,7 +4540,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -4565,7 +4554,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ControlServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -4573,7 +4562,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -4585,7 +4574,7 @@ def test_control_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ControlServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -4597,7 +4586,7 @@ def test_control_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ControlServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -4635,7 +4624,7 @@ def test_control_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.control_service.transports.ControlServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ControlServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -4654,7 +4643,7 @@ def test_control_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.control_service.transports.ControlServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ControlServiceTransport() adc.assert_called_once() @@ -4662,7 +4651,7 @@ def test_control_service_base_transport_with_adc(): def test_control_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ControlServiceClient() adc.assert_called_once_with( scopes=None, @@ -4682,7 +4671,7 @@ def test_control_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -4729,7 +4718,7 @@ def test_control_service_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -4757,7 +4746,7 @@ def test_control_service_transport_create_channel(transport_class, grpc_helpers) ], ) def test_control_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -4795,7 +4784,7 @@ def test_control_service_grpc_transport_client_cert_source_for_mtls(transport_cl def test_control_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -4815,7 +4804,7 @@ def test_control_service_http_transport_client_cert_source_for_mtls(): ) def test_control_service_host_no_port(transport_name): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -4838,7 +4827,7 @@ def test_control_service_host_no_port(transport_name): ) def test_control_service_host_with_port(transport_name): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -4858,8 +4847,8 @@ def test_control_service_host_with_port(transport_name): ], ) def test_control_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ControlServiceClient( credentials=creds1, transport=transport_name, @@ -4935,7 +4924,7 @@ def test_control_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -5176,7 +5165,7 @@ def test_client_with_default_client_info(): transports.ControlServiceTransport, "_prep_wrapped_messages" ) as prep: client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5186,7 +5175,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ControlServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5195,7 +5184,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -5210,7 +5199,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5243,7 +5232,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -5273,7 +5262,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5303,7 +5292,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -5329,7 +5318,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5354,7 +5343,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5380,7 +5369,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5409,7 +5398,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5438,7 +5427,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -5456,7 +5445,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -5474,7 +5463,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5499,7 +5488,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5525,7 +5514,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5554,7 +5543,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5583,7 +5572,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -5601,7 +5590,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -5625,7 +5614,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -5642,7 +5631,7 @@ def test_client_ctx(): ] for transport in transports: client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py index 8697f245c2bb..f05f4edc627b 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py @@ -91,18 +91,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -373,7 +361,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -400,42 +388,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -448,7 +443,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_merchant_center_account_link_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -505,7 +500,7 @@ def test_merchant_center_account_link_service_client_service_account_always_use_ def test_merchant_center_account_link_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -578,9 +573,7 @@ def test_merchant_center_account_link_service_client_client_options( with mock.patch.object( MerchantCenterAccountLinkServiceClient, "get_transport_class" ) as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -1015,20 +1008,20 @@ def test_merchant_center_account_link_service_client_client_api_endpoint(client_ ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -1040,13 +1033,11 @@ def test_merchant_center_account_link_service_client_client_api_endpoint(client_ if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1062,8 +1053,7 @@ def test_merchant_center_account_link_service_client_client_api_endpoint(client_ delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1229,8 +1219,8 @@ def test_merchant_center_account_link_service_client_create_channel_credentials_ ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1259,7 +1249,7 @@ def test_merchant_center_account_link_service_client_create_channel_credentials_ ) def test_list_merchant_center_account_links(request_type, transport: str = "grpc"): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1296,7 +1286,7 @@ def test_list_merchant_center_account_links_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1319,7 +1309,7 @@ async def test_list_merchant_center_account_links_async( request_type=merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest, ): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1359,7 +1349,7 @@ async def test_list_merchant_center_account_links_async_from_dict(): def test_list_merchant_center_account_links_field_headers(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1395,7 +1385,7 @@ def test_list_merchant_center_account_links_field_headers(): @pytest.mark.asyncio async def test_list_merchant_center_account_links_field_headers_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1430,7 +1420,7 @@ async def test_list_merchant_center_account_links_field_headers_async(): def test_list_merchant_center_account_links_flattened(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1458,7 +1448,7 @@ def test_list_merchant_center_account_links_flattened(): def test_list_merchant_center_account_links_flattened_error(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1473,7 +1463,7 @@ def test_list_merchant_center_account_links_flattened_error(): @pytest.mark.asyncio async def test_list_merchant_center_account_links_flattened_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1506,7 +1496,7 @@ async def test_list_merchant_center_account_links_flattened_async(): @pytest.mark.asyncio async def test_list_merchant_center_account_links_flattened_error_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1527,7 +1517,7 @@ async def test_list_merchant_center_account_links_flattened_error_async(): ) def test_create_merchant_center_account_link(request_type, transport: str = "grpc"): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1559,7 +1549,7 @@ def test_create_merchant_center_account_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1582,7 +1572,7 @@ async def test_create_merchant_center_account_link_async( request_type=merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest, ): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1619,7 +1609,7 @@ async def test_create_merchant_center_account_link_async_from_dict(): def test_create_merchant_center_account_link_field_headers(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1653,7 +1643,7 @@ def test_create_merchant_center_account_link_field_headers(): @pytest.mark.asyncio async def test_create_merchant_center_account_link_field_headers_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1688,7 +1678,7 @@ async def test_create_merchant_center_account_link_field_headers_async(): def test_create_merchant_center_account_link_flattened(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1722,7 +1712,7 @@ def test_create_merchant_center_account_link_flattened(): def test_create_merchant_center_account_link_flattened_error(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1740,7 +1730,7 @@ def test_create_merchant_center_account_link_flattened_error(): @pytest.mark.asyncio async def test_create_merchant_center_account_link_flattened_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1779,7 +1769,7 @@ async def test_create_merchant_center_account_link_flattened_async(): @pytest.mark.asyncio async def test_create_merchant_center_account_link_flattened_error_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1803,7 +1793,7 @@ async def test_create_merchant_center_account_link_flattened_error_async(): ) def test_delete_merchant_center_account_link(request_type, transport: str = "grpc"): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1835,7 +1825,7 @@ def test_delete_merchant_center_account_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1858,7 +1848,7 @@ async def test_delete_merchant_center_account_link_async( request_type=merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest, ): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1893,7 +1883,7 @@ async def test_delete_merchant_center_account_link_async_from_dict(): def test_delete_merchant_center_account_link_field_headers(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1927,7 +1917,7 @@ def test_delete_merchant_center_account_link_field_headers(): @pytest.mark.asyncio async def test_delete_merchant_center_account_link_field_headers_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1960,7 +1950,7 @@ async def test_delete_merchant_center_account_link_field_headers_async(): def test_delete_merchant_center_account_link_flattened(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1986,7 +1976,7 @@ def test_delete_merchant_center_account_link_flattened(): def test_delete_merchant_center_account_link_flattened_error(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2001,7 +1991,7 @@ def test_delete_merchant_center_account_link_flattened_error(): @pytest.mark.asyncio async def test_delete_merchant_center_account_link_flattened_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2030,7 +2020,7 @@ async def test_delete_merchant_center_account_link_flattened_async(): @pytest.mark.asyncio async def test_delete_merchant_center_account_link_flattened_error_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2051,7 +2041,7 @@ async def test_delete_merchant_center_account_link_flattened_error_async(): ) def test_list_merchant_center_account_links_rest(request_type): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2106,7 +2096,7 @@ def test_list_merchant_center_account_links_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_merchant_center_account_links._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2115,7 +2105,7 @@ def test_list_merchant_center_account_links_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_merchant_center_account_links._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2124,7 +2114,7 @@ def test_list_merchant_center_account_links_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2170,7 +2160,7 @@ def test_list_merchant_center_account_links_rest_required_fields( def test_list_merchant_center_account_links_rest_unset_required_fields(): transport = transports.MerchantCenterAccountLinkServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = ( @@ -2182,7 +2172,7 @@ def test_list_merchant_center_account_links_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_merchant_center_account_links_rest_interceptors(null_interceptor): transport = transports.MerchantCenterAccountLinkServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.MerchantCenterAccountLinkServiceRestInterceptor(), @@ -2247,7 +2237,7 @@ def test_list_merchant_center_account_links_rest_bad_request( request_type=merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest, ): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2269,7 +2259,7 @@ def test_list_merchant_center_account_links_rest_bad_request( def test_list_merchant_center_account_links_rest_flattened(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2319,7 +2309,7 @@ def test_list_merchant_center_account_links_rest_flattened_error( transport: str = "rest", ): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2334,7 +2324,7 @@ def test_list_merchant_center_account_links_rest_flattened_error( def test_list_merchant_center_account_links_rest_error(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2347,7 +2337,7 @@ def test_list_merchant_center_account_links_rest_error(): ) def test_create_merchant_center_account_link_rest(request_type): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2479,7 +2469,7 @@ def test_create_merchant_center_account_link_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_merchant_center_account_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2488,7 +2478,7 @@ def test_create_merchant_center_account_link_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_merchant_center_account_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2497,7 +2487,7 @@ def test_create_merchant_center_account_link_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2537,7 +2527,7 @@ def test_create_merchant_center_account_link_rest_required_fields( def test_create_merchant_center_account_link_rest_unset_required_fields(): transport = transports.MerchantCenterAccountLinkServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = ( @@ -2557,7 +2547,7 @@ def test_create_merchant_center_account_link_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_merchant_center_account_link_rest_interceptors(null_interceptor): transport = transports.MerchantCenterAccountLinkServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.MerchantCenterAccountLinkServiceRestInterceptor(), @@ -2622,7 +2612,7 @@ def test_create_merchant_center_account_link_rest_bad_request( request_type=merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest, ): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2644,7 +2634,7 @@ def test_create_merchant_center_account_link_rest_bad_request( def test_create_merchant_center_account_link_rest_flattened(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2691,7 +2681,7 @@ def test_create_merchant_center_account_link_rest_flattened_error( transport: str = "rest", ): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2709,7 +2699,7 @@ def test_create_merchant_center_account_link_rest_flattened_error( def test_create_merchant_center_account_link_rest_error(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2722,7 +2712,7 @@ def test_create_merchant_center_account_link_rest_error(): ) def test_delete_merchant_center_account_link_rest(request_type): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2770,7 +2760,7 @@ def test_delete_merchant_center_account_link_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_merchant_center_account_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2779,7 +2769,7 @@ def test_delete_merchant_center_account_link_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_merchant_center_account_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2788,7 +2778,7 @@ def test_delete_merchant_center_account_link_rest_required_fields( assert jsonified_request["name"] == "name_value" client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2827,7 +2817,7 @@ def test_delete_merchant_center_account_link_rest_required_fields( def test_delete_merchant_center_account_link_rest_unset_required_fields(): transport = transports.MerchantCenterAccountLinkServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = ( @@ -2839,7 +2829,7 @@ def test_delete_merchant_center_account_link_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_merchant_center_account_link_rest_interceptors(null_interceptor): transport = transports.MerchantCenterAccountLinkServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.MerchantCenterAccountLinkServiceRestInterceptor(), @@ -2893,7 +2883,7 @@ def test_delete_merchant_center_account_link_rest_bad_request( request_type=merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest, ): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2917,7 +2907,7 @@ def test_delete_merchant_center_account_link_rest_bad_request( def test_delete_merchant_center_account_link_rest_flattened(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2961,7 +2951,7 @@ def test_delete_merchant_center_account_link_rest_flattened_error( transport: str = "rest", ): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2976,24 +2966,24 @@ def test_delete_merchant_center_account_link_rest_flattened_error( def test_delete_merchant_center_account_link_rest_error(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.MerchantCenterAccountLinkServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.MerchantCenterAccountLinkServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = MerchantCenterAccountLinkServiceClient( @@ -3003,7 +2993,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.MerchantCenterAccountLinkServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -3018,13 +3008,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = MerchantCenterAccountLinkServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.MerchantCenterAccountLinkServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = MerchantCenterAccountLinkServiceClient( @@ -3036,7 +3025,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.MerchantCenterAccountLinkServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = MerchantCenterAccountLinkServiceClient(transport=transport) assert client.transport is transport @@ -3045,13 +3034,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.MerchantCenterAccountLinkServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.MerchantCenterAccountLinkServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -3068,7 +3057,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3084,7 +3073,7 @@ def test_transport_kind(transport_name): transport = MerchantCenterAccountLinkServiceClient.get_transport_class( transport_name )( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3092,7 +3081,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3104,7 +3093,7 @@ def test_merchant_center_account_link_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.MerchantCenterAccountLinkServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3116,7 +3105,7 @@ def test_merchant_center_account_link_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.MerchantCenterAccountLinkServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3157,7 +3146,7 @@ def test_merchant_center_account_link_service_base_transport_with_credentials_fi "google.cloud.retail_v2alpha.services.merchant_center_account_link_service.transports.MerchantCenterAccountLinkServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.MerchantCenterAccountLinkServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3176,7 +3165,7 @@ def test_merchant_center_account_link_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.merchant_center_account_link_service.transports.MerchantCenterAccountLinkServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.MerchantCenterAccountLinkServiceTransport() adc.assert_called_once() @@ -3184,7 +3173,7 @@ def test_merchant_center_account_link_service_base_transport_with_adc(): def test_merchant_center_account_link_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) MerchantCenterAccountLinkServiceClient() adc.assert_called_once_with( scopes=None, @@ -3204,7 +3193,7 @@ def test_merchant_center_account_link_service_transport_auth_adc(transport_class # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3258,7 +3247,7 @@ def test_merchant_center_account_link_service_transport_create_channel( ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3288,7 +3277,7 @@ def test_merchant_center_account_link_service_transport_create_channel( def test_merchant_center_account_link_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3326,7 +3315,7 @@ def test_merchant_center_account_link_service_grpc_transport_client_cert_source_ def test_merchant_center_account_link_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3338,7 +3327,7 @@ def test_merchant_center_account_link_service_http_transport_client_cert_source_ def test_merchant_center_account_link_service_rest_lro_client(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3363,7 +3352,7 @@ def test_merchant_center_account_link_service_rest_lro_client(): ) def test_merchant_center_account_link_service_host_no_port(transport_name): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -3386,7 +3375,7 @@ def test_merchant_center_account_link_service_host_no_port(transport_name): ) def test_merchant_center_account_link_service_host_with_port(transport_name): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -3408,8 +3397,8 @@ def test_merchant_center_account_link_service_host_with_port(transport_name): def test_merchant_center_account_link_service_client_transport_session_collision( transport_name, ): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = MerchantCenterAccountLinkServiceClient( credentials=creds1, transport=transport_name, @@ -3479,7 +3468,7 @@ def test_merchant_center_account_link_service_transport_channel_mtls_with_client mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3559,7 +3548,7 @@ def test_merchant_center_account_link_service_transport_channel_mtls_with_adc( def test_merchant_center_account_link_service_grpc_lro_client(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -3576,7 +3565,7 @@ def test_merchant_center_account_link_service_grpc_lro_client(): def test_merchant_center_account_link_service_grpc_lro_async_client(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -3776,7 +3765,7 @@ def test_client_with_default_client_info(): transports.MerchantCenterAccountLinkServiceTransport, "_prep_wrapped_messages" ) as prep: client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3786,7 +3775,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = MerchantCenterAccountLinkServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3795,7 +3784,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -3810,7 +3799,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3843,7 +3832,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -3873,7 +3862,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3903,7 +3892,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -3929,7 +3918,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3954,7 +3943,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3980,7 +3969,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4009,7 +3998,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4038,7 +4027,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4056,7 +4045,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4074,7 +4063,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4099,7 +4088,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4125,7 +4114,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4154,7 +4143,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4183,7 +4172,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4201,7 +4190,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = MerchantCenterAccountLinkServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4225,7 +4214,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -4242,7 +4231,7 @@ def test_client_ctx(): ] for transport in transports: client = MerchantCenterAccountLinkServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_model_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_model_service.py index 270b1fa87c11..bd91f0c266a3 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_model_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_model_service.py @@ -93,18 +93,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -316,7 +304,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -343,42 +331,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -389,7 +384,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_model_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -441,7 +436,7 @@ def test_model_service_client_service_account_always_use_jwt( ], ) def test_model_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -504,9 +499,7 @@ def test_model_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ModelServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -899,20 +892,20 @@ def test_model_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -924,13 +917,11 @@ def test_model_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -946,8 +937,7 @@ def test_model_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1098,8 +1088,8 @@ def test_model_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1128,7 +1118,7 @@ def test_model_service_client_create_channel_credentials_file( ) def test_create_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1155,7 +1145,7 @@ def test_create_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1172,7 +1162,7 @@ async def test_create_model_async( transport: str = "grpc_asyncio", request_type=model_service.CreateModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1204,7 +1194,7 @@ async def test_create_model_async_from_dict(): def test_create_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1234,7 +1224,7 @@ def test_create_model_field_headers(): @pytest.mark.asyncio async def test_create_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1265,7 +1255,7 @@ async def test_create_model_field_headers_async(): def test_create_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1301,7 +1291,7 @@ def test_create_model_flattened(): def test_create_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1321,7 +1311,7 @@ def test_create_model_flattened_error(): @pytest.mark.asyncio async def test_create_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1362,7 +1352,7 @@ async def test_create_model_flattened_async(): @pytest.mark.asyncio async def test_create_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1388,7 +1378,7 @@ async def test_create_model_flattened_error_async(): ) def test_get_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1442,7 +1432,7 @@ def test_get_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1459,7 +1449,7 @@ async def test_get_model_async( transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1518,7 +1508,7 @@ async def test_get_model_async_from_dict(): def test_get_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1548,7 +1538,7 @@ def test_get_model_field_headers(): @pytest.mark.asyncio async def test_get_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1577,7 +1567,7 @@ async def test_get_model_field_headers_async(): def test_get_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1601,7 +1591,7 @@ def test_get_model_flattened(): def test_get_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1616,7 +1606,7 @@ def test_get_model_flattened_error(): @pytest.mark.asyncio async def test_get_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1643,7 +1633,7 @@ async def test_get_model_flattened_async(): @pytest.mark.asyncio async def test_get_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1664,7 +1654,7 @@ async def test_get_model_flattened_error_async(): ) def test_pause_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1718,7 +1708,7 @@ def test_pause_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1735,7 +1725,7 @@ async def test_pause_model_async( transport: str = "grpc_asyncio", request_type=model_service.PauseModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1794,7 +1784,7 @@ async def test_pause_model_async_from_dict(): def test_pause_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1824,7 +1814,7 @@ def test_pause_model_field_headers(): @pytest.mark.asyncio async def test_pause_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1853,7 +1843,7 @@ async def test_pause_model_field_headers_async(): def test_pause_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1877,7 +1867,7 @@ def test_pause_model_flattened(): def test_pause_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1892,7 +1882,7 @@ def test_pause_model_flattened_error(): @pytest.mark.asyncio async def test_pause_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1919,7 +1909,7 @@ async def test_pause_model_flattened_async(): @pytest.mark.asyncio async def test_pause_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1940,7 +1930,7 @@ async def test_pause_model_flattened_error_async(): ) def test_resume_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1994,7 +1984,7 @@ def test_resume_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2011,7 +2001,7 @@ async def test_resume_model_async( transport: str = "grpc_asyncio", request_type=model_service.ResumeModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2070,7 +2060,7 @@ async def test_resume_model_async_from_dict(): def test_resume_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2100,7 +2090,7 @@ def test_resume_model_field_headers(): @pytest.mark.asyncio async def test_resume_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2129,7 +2119,7 @@ async def test_resume_model_field_headers_async(): def test_resume_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2153,7 +2143,7 @@ def test_resume_model_flattened(): def test_resume_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2168,7 +2158,7 @@ def test_resume_model_flattened_error(): @pytest.mark.asyncio async def test_resume_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2195,7 +2185,7 @@ async def test_resume_model_flattened_async(): @pytest.mark.asyncio async def test_resume_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2216,7 +2206,7 @@ async def test_resume_model_flattened_error_async(): ) def test_delete_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2243,7 +2233,7 @@ def test_delete_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2260,7 +2250,7 @@ async def test_delete_model_async( transport: str = "grpc_asyncio", request_type=model_service.DeleteModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2290,7 +2280,7 @@ async def test_delete_model_async_from_dict(): def test_delete_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2320,7 +2310,7 @@ def test_delete_model_field_headers(): @pytest.mark.asyncio async def test_delete_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2349,7 +2339,7 @@ async def test_delete_model_field_headers_async(): def test_delete_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2373,7 +2363,7 @@ def test_delete_model_flattened(): def test_delete_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2388,7 +2378,7 @@ def test_delete_model_flattened_error(): @pytest.mark.asyncio async def test_delete_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2415,7 +2405,7 @@ async def test_delete_model_flattened_async(): @pytest.mark.asyncio async def test_delete_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2436,7 +2426,7 @@ async def test_delete_model_flattened_error_async(): ) def test_list_models(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2466,7 +2456,7 @@ def test_list_models_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2483,7 +2473,7 @@ async def test_list_models_async( transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2518,7 +2508,7 @@ async def test_list_models_async_from_dict(): def test_list_models_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2548,7 +2538,7 @@ def test_list_models_field_headers(): @pytest.mark.asyncio async def test_list_models_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2579,7 +2569,7 @@ async def test_list_models_field_headers_async(): def test_list_models_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2603,7 +2593,7 @@ def test_list_models_flattened(): def test_list_models_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2618,7 +2608,7 @@ def test_list_models_flattened_error(): @pytest.mark.asyncio async def test_list_models_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2647,7 +2637,7 @@ async def test_list_models_flattened_async(): @pytest.mark.asyncio async def test_list_models_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2661,7 +2651,7 @@ async def test_list_models_flattened_error_async(): def test_list_models_pager(transport_name: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2711,7 +2701,7 @@ def test_list_models_pager(transport_name: str = "grpc"): def test_list_models_pages(transport_name: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2753,7 +2743,7 @@ def test_list_models_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_models_async_pager(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2803,7 +2793,7 @@ async def test_list_models_async_pager(): @pytest.mark.asyncio async def test_list_models_async_pages(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2858,7 +2848,7 @@ async def test_list_models_async_pages(): ) def test_update_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2912,7 +2902,7 @@ def test_update_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2929,7 +2919,7 @@ async def test_update_model_async( transport: str = "grpc_asyncio", request_type=model_service.UpdateModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2988,7 +2978,7 @@ async def test_update_model_async_from_dict(): def test_update_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3018,7 +3008,7 @@ def test_update_model_field_headers(): @pytest.mark.asyncio async def test_update_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3047,7 +3037,7 @@ async def test_update_model_field_headers_async(): def test_update_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3083,7 +3073,7 @@ def test_update_model_flattened(): def test_update_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3103,7 +3093,7 @@ def test_update_model_flattened_error(): @pytest.mark.asyncio async def test_update_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3142,7 +3132,7 @@ async def test_update_model_flattened_async(): @pytest.mark.asyncio async def test_update_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3168,7 +3158,7 @@ async def test_update_model_flattened_error_async(): ) def test_tune_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3195,7 +3185,7 @@ def test_tune_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3212,7 +3202,7 @@ async def test_tune_model_async( transport: str = "grpc_asyncio", request_type=model_service.TuneModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3244,7 +3234,7 @@ async def test_tune_model_async_from_dict(): def test_tune_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3274,7 +3264,7 @@ def test_tune_model_field_headers(): @pytest.mark.asyncio async def test_tune_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3305,7 +3295,7 @@ async def test_tune_model_field_headers_async(): def test_tune_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3329,7 +3319,7 @@ def test_tune_model_flattened(): def test_tune_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3344,7 +3334,7 @@ def test_tune_model_flattened_error(): @pytest.mark.asyncio async def test_tune_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3373,7 +3363,7 @@ async def test_tune_model_flattened_async(): @pytest.mark.asyncio async def test_tune_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3394,7 +3384,7 @@ async def test_tune_model_flattened_error_async(): ) def test_create_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3541,7 +3531,7 @@ def test_create_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3550,7 +3540,7 @@ def test_create_model_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_model._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("dry_run",)) @@ -3561,7 +3551,7 @@ def test_create_model_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3601,7 +3591,7 @@ def test_create_model_rest_required_fields( def test_create_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_model._get_unset_required_fields({}) @@ -3619,7 +3609,7 @@ def test_create_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -3679,7 +3669,7 @@ def test_create_model_rest_bad_request( transport: str = "rest", request_type=model_service.CreateModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3701,7 +3691,7 @@ def test_create_model_rest_bad_request( def test_create_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3748,7 +3738,7 @@ def test_create_model_rest_flattened(): def test_create_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3768,7 +3758,7 @@ def test_create_model_rest_flattened_error(transport: str = "rest"): def test_create_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3781,7 +3771,7 @@ def test_create_model_rest_error(): ) def test_get_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3856,7 +3846,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3865,7 +3855,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3874,7 +3864,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3916,7 +3906,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque def test_get_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_model._get_unset_required_fields({}) @@ -3926,7 +3916,7 @@ def test_get_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -3980,7 +3970,7 @@ def test_get_model_rest_bad_request( transport: str = "rest", request_type=model_service.GetModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4004,7 +3994,7 @@ def test_get_model_rest_bad_request( def test_get_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4048,7 +4038,7 @@ def test_get_model_rest_flattened(): def test_get_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4063,7 +4053,7 @@ def test_get_model_rest_flattened_error(transport: str = "rest"): def test_get_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4076,7 +4066,7 @@ def test_get_model_rest_error(): ) def test_pause_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4151,7 +4141,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4160,7 +4150,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4169,7 +4159,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4212,7 +4202,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR def test_pause_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.pause_model._get_unset_required_fields({}) @@ -4222,7 +4212,7 @@ def test_pause_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_pause_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -4278,7 +4268,7 @@ def test_pause_model_rest_bad_request( transport: str = "rest", request_type=model_service.PauseModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4302,7 +4292,7 @@ def test_pause_model_rest_bad_request( def test_pause_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4346,7 +4336,7 @@ def test_pause_model_rest_flattened(): def test_pause_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4361,7 +4351,7 @@ def test_pause_model_rest_flattened_error(transport: str = "rest"): def test_pause_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4374,7 +4364,7 @@ def test_pause_model_rest_error(): ) def test_resume_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4451,7 +4441,7 @@ def test_resume_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4460,7 +4450,7 @@ def test_resume_model_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4469,7 +4459,7 @@ def test_resume_model_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4512,7 +4502,7 @@ def test_resume_model_rest_required_fields( def test_resume_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.resume_model._get_unset_required_fields({}) @@ -4522,7 +4512,7 @@ def test_resume_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_resume_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -4578,7 +4568,7 @@ def test_resume_model_rest_bad_request( transport: str = "rest", request_type=model_service.ResumeModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4602,7 +4592,7 @@ def test_resume_model_rest_bad_request( def test_resume_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4646,7 +4636,7 @@ def test_resume_model_rest_flattened(): def test_resume_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4661,7 +4651,7 @@ def test_resume_model_rest_flattened_error(transport: str = "rest"): def test_resume_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4674,7 +4664,7 @@ def test_resume_model_rest_error(): ) def test_delete_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4722,7 +4712,7 @@ def test_delete_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4731,7 +4721,7 @@ def test_delete_model_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4740,7 +4730,7 @@ def test_delete_model_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4779,7 +4769,7 @@ def test_delete_model_rest_required_fields( def test_delete_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_model._get_unset_required_fields({}) @@ -4789,7 +4779,7 @@ def test_delete_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -4839,7 +4829,7 @@ def test_delete_model_rest_bad_request( transport: str = "rest", request_type=model_service.DeleteModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4863,7 +4853,7 @@ def test_delete_model_rest_bad_request( def test_delete_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4905,7 +4895,7 @@ def test_delete_model_rest_flattened(): def test_delete_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4920,7 +4910,7 @@ def test_delete_model_rest_flattened_error(transport: str = "rest"): def test_delete_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4933,7 +4923,7 @@ def test_delete_model_rest_error(): ) def test_list_models_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4982,7 +4972,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_models._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4991,7 +4981,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_models._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5007,7 +4997,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR assert jsonified_request["parent"] == "parent_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5049,7 +5039,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR def test_list_models_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_models._get_unset_required_fields({}) @@ -5067,7 +5057,7 @@ def test_list_models_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_models_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -5125,7 +5115,7 @@ def test_list_models_rest_bad_request( transport: str = "rest", request_type=model_service.ListModelsRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5147,7 +5137,7 @@ def test_list_models_rest_bad_request( def test_list_models_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5191,7 +5181,7 @@ def test_list_models_rest_flattened(): def test_list_models_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5206,7 +5196,7 @@ def test_list_models_rest_flattened_error(transport: str = "rest"): def test_list_models_rest_pager(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5276,7 +5266,7 @@ def test_list_models_rest_pager(transport: str = "rest"): ) def test_update_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5455,14 +5445,14 @@ def test_update_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_model._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5471,7 +5461,7 @@ def test_update_model_rest_required_fields( # verify required fields with non-default values are left alone client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5514,7 +5504,7 @@ def test_update_model_rest_required_fields( def test_update_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_model._get_unset_required_fields({}) @@ -5524,7 +5514,7 @@ def test_update_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -5580,7 +5570,7 @@ def test_update_model_rest_bad_request( transport: str = "rest", request_type=model_service.UpdateModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5606,7 +5596,7 @@ def test_update_model_rest_bad_request( def test_update_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5657,7 +5647,7 @@ def test_update_model_rest_flattened(): def test_update_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5677,7 +5667,7 @@ def test_update_model_rest_flattened_error(transport: str = "rest"): def test_update_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5690,7 +5680,7 @@ def test_update_model_rest_error(): ) def test_tune_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5736,7 +5726,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).tune_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5745,7 +5735,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).tune_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5754,7 +5744,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5794,7 +5784,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq def test_tune_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.tune_model._get_unset_required_fields({}) @@ -5804,7 +5794,7 @@ def test_tune_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_tune_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -5862,7 +5852,7 @@ def test_tune_model_rest_bad_request( transport: str = "rest", request_type=model_service.TuneModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5886,7 +5876,7 @@ def test_tune_model_rest_bad_request( def test_tune_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5928,7 +5918,7 @@ def test_tune_model_rest_flattened(): def test_tune_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5943,24 +5933,24 @@ def test_tune_model_rest_flattened_error(transport: str = "rest"): def test_tune_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ModelServiceClient( @@ -5970,7 +5960,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5985,13 +5975,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ModelServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ModelServiceClient( @@ -6003,7 +5992,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ModelServiceClient(transport=transport) assert client.transport is transport @@ -6012,13 +6001,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ModelServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -6035,7 +6024,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -6049,7 +6038,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ModelServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -6057,7 +6046,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -6069,7 +6058,7 @@ def test_model_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ModelServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -6081,7 +6070,7 @@ def test_model_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ModelServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -6127,7 +6116,7 @@ def test_model_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.model_service.transports.ModelServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ModelServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -6146,7 +6135,7 @@ def test_model_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.model_service.transports.ModelServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ModelServiceTransport() adc.assert_called_once() @@ -6154,7 +6143,7 @@ def test_model_service_base_transport_with_adc(): def test_model_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ModelServiceClient() adc.assert_called_once_with( scopes=None, @@ -6174,7 +6163,7 @@ def test_model_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6221,7 +6210,7 @@ def test_model_service_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6246,7 +6235,7 @@ def test_model_service_transport_create_channel(transport_class, grpc_helpers): [transports.ModelServiceGrpcTransport, transports.ModelServiceGrpcAsyncIOTransport], ) def test_model_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6284,7 +6273,7 @@ def test_model_service_grpc_transport_client_cert_source_for_mtls(transport_clas def test_model_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6296,7 +6285,7 @@ def test_model_service_http_transport_client_cert_source_for_mtls(): def test_model_service_rest_lro_client(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -6321,7 +6310,7 @@ def test_model_service_rest_lro_client(): ) def test_model_service_host_no_port(transport_name): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -6344,7 +6333,7 @@ def test_model_service_host_no_port(transport_name): ) def test_model_service_host_with_port(transport_name): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -6364,8 +6353,8 @@ def test_model_service_host_with_port(transport_name): ], ) def test_model_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ModelServiceClient( credentials=creds1, transport=transport_name, @@ -6445,7 +6434,7 @@ def test_model_service_transport_channel_mtls_with_client_cert_source(transport_ mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6520,7 +6509,7 @@ def test_model_service_transport_channel_mtls_with_adc(transport_class): def test_model_service_grpc_lro_client(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -6537,7 +6526,7 @@ def test_model_service_grpc_lro_client(): def test_model_service_grpc_lro_async_client(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -6717,7 +6706,7 @@ def test_client_with_default_client_info(): transports.ModelServiceTransport, "_prep_wrapped_messages" ) as prep: client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6727,7 +6716,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ModelServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6736,7 +6725,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6751,7 +6740,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6784,7 +6773,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -6814,7 +6803,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6844,7 +6833,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -6870,7 +6859,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6895,7 +6884,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6921,7 +6910,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6950,7 +6939,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6979,7 +6968,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6997,7 +6986,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7015,7 +7004,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7040,7 +7029,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7066,7 +7055,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7095,7 +7084,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7124,7 +7113,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7142,7 +7131,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7166,7 +7155,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -7183,7 +7172,7 @@ def test_client_ctx(): ] for transport in transports: client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_prediction_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_prediction_service.py index 1e783ec27b65..a92da37fda52 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_prediction_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_prediction_service.py @@ -89,18 +89,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -336,7 +324,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -363,42 +351,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -411,7 +406,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_prediction_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -465,7 +460,7 @@ def test_prediction_service_client_service_account_always_use_jwt( def test_prediction_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -528,9 +523,7 @@ def test_prediction_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(PredictionServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -949,20 +942,20 @@ def test_prediction_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -974,13 +967,11 @@ def test_prediction_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -996,8 +987,7 @@ def test_prediction_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1155,8 +1145,8 @@ def test_prediction_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1185,7 +1175,7 @@ def test_prediction_service_client_create_channel_credentials_file( ) def test_predict(request_type, transport: str = "grpc"): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1219,7 +1209,7 @@ def test_predict_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1236,7 +1226,7 @@ async def test_predict_async( transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest ): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1275,7 +1265,7 @@ async def test_predict_async_from_dict(): def test_predict_field_headers(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1305,7 +1295,7 @@ def test_predict_field_headers(): @pytest.mark.asyncio async def test_predict_field_headers_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1343,7 +1333,7 @@ async def test_predict_field_headers_async(): ) def test_predict_rest(request_type): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1398,7 +1388,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).predict._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1407,7 +1397,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq jsonified_request["placement"] = "placement_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).predict._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1416,7 +1406,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq assert jsonified_request["placement"] == "placement_value" client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1459,7 +1449,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq def test_predict_rest_unset_required_fields(): transport = transports.PredictionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.predict._get_unset_required_fields({}) @@ -1477,7 +1467,7 @@ def test_predict_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_predict_rest_interceptors(null_interceptor): transport = transports.PredictionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.PredictionServiceRestInterceptor(), @@ -1535,7 +1525,7 @@ def test_predict_rest_bad_request( transport: str = "rest", request_type=prediction_service.PredictRequest ): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1559,24 +1549,24 @@ def test_predict_rest_bad_request( def test_predict_rest_error(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = PredictionServiceClient( @@ -1586,7 +1576,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1601,13 +1591,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = PredictionServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = PredictionServiceClient( @@ -1619,7 +1608,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = PredictionServiceClient(transport=transport) assert client.transport is transport @@ -1628,13 +1617,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.PredictionServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1651,7 +1640,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1665,7 +1654,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = PredictionServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1673,7 +1662,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1685,7 +1674,7 @@ def test_prediction_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.PredictionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1697,7 +1686,7 @@ def test_prediction_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.PredictionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1731,7 +1720,7 @@ def test_prediction_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.prediction_service.transports.PredictionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PredictionServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1750,7 +1739,7 @@ def test_prediction_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.prediction_service.transports.PredictionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PredictionServiceTransport() adc.assert_called_once() @@ -1758,7 +1747,7 @@ def test_prediction_service_base_transport_with_adc(): def test_prediction_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) PredictionServiceClient() adc.assert_called_once_with( scopes=None, @@ -1778,7 +1767,7 @@ def test_prediction_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -1825,7 +1814,7 @@ def test_prediction_service_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -1853,7 +1842,7 @@ def test_prediction_service_transport_create_channel(transport_class, grpc_helpe ], ) def test_prediction_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1891,7 +1880,7 @@ def test_prediction_service_grpc_transport_client_cert_source_for_mtls(transport def test_prediction_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -1911,7 +1900,7 @@ def test_prediction_service_http_transport_client_cert_source_for_mtls(): ) def test_prediction_service_host_no_port(transport_name): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -1934,7 +1923,7 @@ def test_prediction_service_host_no_port(transport_name): ) def test_prediction_service_host_with_port(transport_name): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -1954,8 +1943,8 @@ def test_prediction_service_host_with_port(transport_name): ], ) def test_prediction_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = PredictionServiceClient( credentials=creds1, transport=transport_name, @@ -2019,7 +2008,7 @@ def test_prediction_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2239,7 +2228,7 @@ def test_client_with_default_client_info(): transports.PredictionServiceTransport, "_prep_wrapped_messages" ) as prep: client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2249,7 +2238,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = PredictionServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2258,7 +2247,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2273,7 +2262,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2306,7 +2295,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -2336,7 +2325,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2366,7 +2355,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -2392,7 +2381,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2417,7 +2406,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2443,7 +2432,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2472,7 +2461,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2501,7 +2490,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2519,7 +2508,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2537,7 +2526,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2562,7 +2551,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2588,7 +2577,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2617,7 +2606,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2646,7 +2635,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2664,7 +2653,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2688,7 +2677,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2705,7 +2694,7 @@ def test_client_ctx(): ] for transport in transports: client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_product_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_product_service.py index 75abb66fec58..2cbd1828d973 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_product_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_product_service.py @@ -96,18 +96,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -334,7 +322,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -361,42 +349,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -407,7 +402,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_product_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -459,7 +454,7 @@ def test_product_service_client_service_account_always_use_jwt( ], ) def test_product_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -522,9 +517,7 @@ def test_product_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ProductServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -923,20 +916,20 @@ def test_product_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -948,13 +941,11 @@ def test_product_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -970,8 +961,7 @@ def test_product_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1124,8 +1114,8 @@ def test_product_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1154,7 +1144,7 @@ def test_product_service_client_create_channel_credentials_file( ) def test_create_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1218,7 +1208,7 @@ def test_create_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1235,7 +1225,7 @@ async def test_create_product_async( transport: str = "grpc_asyncio", request_type=product_service.CreateProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1304,7 +1294,7 @@ async def test_create_product_async_from_dict(): def test_create_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1334,7 +1324,7 @@ def test_create_product_field_headers(): @pytest.mark.asyncio async def test_create_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1363,7 +1353,7 @@ async def test_create_product_field_headers_async(): def test_create_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1397,7 +1387,7 @@ def test_create_product_flattened(): def test_create_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1416,7 +1406,7 @@ def test_create_product_flattened_error(): @pytest.mark.asyncio async def test_create_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1453,7 +1443,7 @@ async def test_create_product_flattened_async(): @pytest.mark.asyncio async def test_create_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1478,7 +1468,7 @@ async def test_create_product_flattened_error_async(): ) def test_get_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1542,7 +1532,7 @@ def test_get_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1559,7 +1549,7 @@ async def test_get_product_async( transport: str = "grpc_asyncio", request_type=product_service.GetProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1628,7 +1618,7 @@ async def test_get_product_async_from_dict(): def test_get_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1658,7 +1648,7 @@ def test_get_product_field_headers(): @pytest.mark.asyncio async def test_get_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1687,7 +1677,7 @@ async def test_get_product_field_headers_async(): def test_get_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1711,7 +1701,7 @@ def test_get_product_flattened(): def test_get_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1726,7 +1716,7 @@ def test_get_product_flattened_error(): @pytest.mark.asyncio async def test_get_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1753,7 +1743,7 @@ async def test_get_product_flattened_async(): @pytest.mark.asyncio async def test_get_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1774,7 +1764,7 @@ async def test_get_product_flattened_error_async(): ) def test_list_products(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1806,7 +1796,7 @@ def test_list_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1823,7 +1813,7 @@ async def test_list_products_async( transport: str = "grpc_asyncio", request_type=product_service.ListProductsRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1860,7 +1850,7 @@ async def test_list_products_async_from_dict(): def test_list_products_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1890,7 +1880,7 @@ def test_list_products_field_headers(): @pytest.mark.asyncio async def test_list_products_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1921,7 +1911,7 @@ async def test_list_products_field_headers_async(): def test_list_products_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1945,7 +1935,7 @@ def test_list_products_flattened(): def test_list_products_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1960,7 +1950,7 @@ def test_list_products_flattened_error(): @pytest.mark.asyncio async def test_list_products_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1989,7 +1979,7 @@ async def test_list_products_flattened_async(): @pytest.mark.asyncio async def test_list_products_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2003,7 +1993,7 @@ async def test_list_products_flattened_error_async(): def test_list_products_pager(transport_name: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2053,7 +2043,7 @@ def test_list_products_pager(transport_name: str = "grpc"): def test_list_products_pages(transport_name: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2095,7 +2085,7 @@ def test_list_products_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_products_async_pager(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2145,7 +2135,7 @@ async def test_list_products_async_pager(): @pytest.mark.asyncio async def test_list_products_async_pages(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2200,7 +2190,7 @@ async def test_list_products_async_pages(): ) def test_update_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2264,7 +2254,7 @@ def test_update_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2281,7 +2271,7 @@ async def test_update_product_async( transport: str = "grpc_asyncio", request_type=product_service.UpdateProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2350,7 +2340,7 @@ async def test_update_product_async_from_dict(): def test_update_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2380,7 +2370,7 @@ def test_update_product_field_headers(): @pytest.mark.asyncio async def test_update_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2409,7 +2399,7 @@ async def test_update_product_field_headers_async(): def test_update_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2439,7 +2429,7 @@ def test_update_product_flattened(): def test_update_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2457,7 +2447,7 @@ def test_update_product_flattened_error(): @pytest.mark.asyncio async def test_update_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2490,7 +2480,7 @@ async def test_update_product_flattened_async(): @pytest.mark.asyncio async def test_update_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2514,7 +2504,7 @@ async def test_update_product_flattened_error_async(): ) def test_delete_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2541,7 +2531,7 @@ def test_delete_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2558,7 +2548,7 @@ async def test_delete_product_async( transport: str = "grpc_asyncio", request_type=product_service.DeleteProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2588,7 +2578,7 @@ async def test_delete_product_async_from_dict(): def test_delete_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2618,7 +2608,7 @@ def test_delete_product_field_headers(): @pytest.mark.asyncio async def test_delete_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2647,7 +2637,7 @@ async def test_delete_product_field_headers_async(): def test_delete_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2671,7 +2661,7 @@ def test_delete_product_flattened(): def test_delete_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2686,7 +2676,7 @@ def test_delete_product_flattened_error(): @pytest.mark.asyncio async def test_delete_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2713,7 +2703,7 @@ async def test_delete_product_flattened_async(): @pytest.mark.asyncio async def test_delete_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2734,7 +2724,7 @@ async def test_delete_product_flattened_error_async(): ) def test_purge_products(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2761,7 +2751,7 @@ def test_purge_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2778,7 +2768,7 @@ async def test_purge_products_async( transport: str = "grpc_asyncio", request_type=purge_config.PurgeProductsRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2810,7 +2800,7 @@ async def test_purge_products_async_from_dict(): def test_purge_products_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2840,7 +2830,7 @@ def test_purge_products_field_headers(): @pytest.mark.asyncio async def test_purge_products_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2878,7 +2868,7 @@ async def test_purge_products_field_headers_async(): ) def test_import_products(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2905,7 +2895,7 @@ def test_import_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2922,7 +2912,7 @@ async def test_import_products_async( transport: str = "grpc_asyncio", request_type=import_config.ImportProductsRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2954,7 +2944,7 @@ async def test_import_products_async_from_dict(): def test_import_products_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2984,7 +2974,7 @@ def test_import_products_field_headers(): @pytest.mark.asyncio async def test_import_products_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3022,7 +3012,7 @@ async def test_import_products_field_headers_async(): ) def test_set_inventory(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3049,7 +3039,7 @@ def test_set_inventory_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3066,7 +3056,7 @@ async def test_set_inventory_async( transport: str = "grpc_asyncio", request_type=product_service.SetInventoryRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3098,7 +3088,7 @@ async def test_set_inventory_async_from_dict(): def test_set_inventory_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3128,7 +3118,7 @@ def test_set_inventory_field_headers(): @pytest.mark.asyncio async def test_set_inventory_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3159,7 +3149,7 @@ async def test_set_inventory_field_headers_async(): def test_set_inventory_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3187,7 +3177,7 @@ def test_set_inventory_flattened(): def test_set_inventory_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3203,7 +3193,7 @@ def test_set_inventory_flattened_error(): @pytest.mark.asyncio async def test_set_inventory_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3236,7 +3226,7 @@ async def test_set_inventory_flattened_async(): @pytest.mark.asyncio async def test_set_inventory_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3258,7 +3248,7 @@ async def test_set_inventory_flattened_error_async(): ) def test_add_fulfillment_places(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3287,7 +3277,7 @@ def test_add_fulfillment_places_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3307,7 +3297,7 @@ async def test_add_fulfillment_places_async( request_type=product_service.AddFulfillmentPlacesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3341,7 +3331,7 @@ async def test_add_fulfillment_places_async_from_dict(): def test_add_fulfillment_places_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3373,7 +3363,7 @@ def test_add_fulfillment_places_field_headers(): @pytest.mark.asyncio async def test_add_fulfillment_places_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3406,7 +3396,7 @@ async def test_add_fulfillment_places_field_headers_async(): def test_add_fulfillment_places_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3432,7 +3422,7 @@ def test_add_fulfillment_places_flattened(): def test_add_fulfillment_places_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3447,7 +3437,7 @@ def test_add_fulfillment_places_flattened_error(): @pytest.mark.asyncio async def test_add_fulfillment_places_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3478,7 +3468,7 @@ async def test_add_fulfillment_places_flattened_async(): @pytest.mark.asyncio async def test_add_fulfillment_places_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3499,7 +3489,7 @@ async def test_add_fulfillment_places_flattened_error_async(): ) def test_remove_fulfillment_places(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3528,7 +3518,7 @@ def test_remove_fulfillment_places_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3548,7 +3538,7 @@ async def test_remove_fulfillment_places_async( request_type=product_service.RemoveFulfillmentPlacesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3582,7 +3572,7 @@ async def test_remove_fulfillment_places_async_from_dict(): def test_remove_fulfillment_places_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3614,7 +3604,7 @@ def test_remove_fulfillment_places_field_headers(): @pytest.mark.asyncio async def test_remove_fulfillment_places_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3647,7 +3637,7 @@ async def test_remove_fulfillment_places_field_headers_async(): def test_remove_fulfillment_places_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3673,7 +3663,7 @@ def test_remove_fulfillment_places_flattened(): def test_remove_fulfillment_places_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3688,7 +3678,7 @@ def test_remove_fulfillment_places_flattened_error(): @pytest.mark.asyncio async def test_remove_fulfillment_places_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3719,7 +3709,7 @@ async def test_remove_fulfillment_places_flattened_async(): @pytest.mark.asyncio async def test_remove_fulfillment_places_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3740,7 +3730,7 @@ async def test_remove_fulfillment_places_flattened_error_async(): ) def test_add_local_inventories(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3769,7 +3759,7 @@ def test_add_local_inventories_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3789,7 +3779,7 @@ async def test_add_local_inventories_async( request_type=product_service.AddLocalInventoriesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3823,7 +3813,7 @@ async def test_add_local_inventories_async_from_dict(): def test_add_local_inventories_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3855,7 +3845,7 @@ def test_add_local_inventories_field_headers(): @pytest.mark.asyncio async def test_add_local_inventories_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3888,7 +3878,7 @@ async def test_add_local_inventories_field_headers_async(): def test_add_local_inventories_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3914,7 +3904,7 @@ def test_add_local_inventories_flattened(): def test_add_local_inventories_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3929,7 +3919,7 @@ def test_add_local_inventories_flattened_error(): @pytest.mark.asyncio async def test_add_local_inventories_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3960,7 +3950,7 @@ async def test_add_local_inventories_flattened_async(): @pytest.mark.asyncio async def test_add_local_inventories_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3981,7 +3971,7 @@ async def test_add_local_inventories_flattened_error_async(): ) def test_remove_local_inventories(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4010,7 +4000,7 @@ def test_remove_local_inventories_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4030,7 +4020,7 @@ async def test_remove_local_inventories_async( request_type=product_service.RemoveLocalInventoriesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4064,7 +4054,7 @@ async def test_remove_local_inventories_async_from_dict(): def test_remove_local_inventories_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4096,7 +4086,7 @@ def test_remove_local_inventories_field_headers(): @pytest.mark.asyncio async def test_remove_local_inventories_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4129,7 +4119,7 @@ async def test_remove_local_inventories_field_headers_async(): def test_remove_local_inventories_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4155,7 +4145,7 @@ def test_remove_local_inventories_flattened(): def test_remove_local_inventories_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4170,7 +4160,7 @@ def test_remove_local_inventories_flattened_error(): @pytest.mark.asyncio async def test_remove_local_inventories_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4201,7 +4191,7 @@ async def test_remove_local_inventories_flattened_async(): @pytest.mark.asyncio async def test_remove_local_inventories_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4222,7 +4212,7 @@ async def test_remove_local_inventories_flattened_error_async(): ) def test_create_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4458,7 +4448,7 @@ def test_create_product_rest_required_fields( assert "productId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4470,7 +4460,7 @@ def test_create_product_rest_required_fields( jsonified_request["productId"] = "product_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_product._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("product_id",)) @@ -4483,7 +4473,7 @@ def test_create_product_rest_required_fields( assert jsonified_request["productId"] == "product_id_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4532,7 +4522,7 @@ def test_create_product_rest_required_fields( def test_create_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_product._get_unset_required_fields({}) @@ -4551,7 +4541,7 @@ def test_create_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -4607,7 +4597,7 @@ def test_create_product_rest_bad_request( transport: str = "rest", request_type=product_service.CreateProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4631,7 +4621,7 @@ def test_create_product_rest_bad_request( def test_create_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4679,7 +4669,7 @@ def test_create_product_rest_flattened(): def test_create_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4698,7 +4688,7 @@ def test_create_product_rest_flattened_error(transport: str = "rest"): def test_create_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4711,7 +4701,7 @@ def test_create_product_rest_error(): ) def test_get_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4798,7 +4788,7 @@ def test_get_product_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4807,7 +4797,7 @@ def test_get_product_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4816,7 +4806,7 @@ def test_get_product_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4858,7 +4848,7 @@ def test_get_product_rest_required_fields( def test_get_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_product._get_unset_required_fields({}) @@ -4868,7 +4858,7 @@ def test_get_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -4924,7 +4914,7 @@ def test_get_product_rest_bad_request( transport: str = "rest", request_type=product_service.GetProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4948,7 +4938,7 @@ def test_get_product_rest_bad_request( def test_get_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4992,7 +4982,7 @@ def test_get_product_rest_flattened(): def test_get_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5007,7 +4997,7 @@ def test_get_product_rest_flattened_error(transport: str = "rest"): def test_get_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5020,7 +5010,7 @@ def test_get_product_rest_error(): ) def test_list_products_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5075,7 +5065,7 @@ def test_list_products_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5084,7 +5074,7 @@ def test_list_products_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_products._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5103,7 +5093,7 @@ def test_list_products_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5145,7 +5135,7 @@ def test_list_products_rest_required_fields( def test_list_products_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_products._get_unset_required_fields({}) @@ -5166,7 +5156,7 @@ def test_list_products_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_products_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -5224,7 +5214,7 @@ def test_list_products_rest_bad_request( transport: str = "rest", request_type=product_service.ListProductsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5248,7 +5238,7 @@ def test_list_products_rest_bad_request( def test_list_products_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5292,7 +5282,7 @@ def test_list_products_rest_flattened(): def test_list_products_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5307,7 +5297,7 @@ def test_list_products_rest_flattened_error(transport: str = "rest"): def test_list_products_rest_pager(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5379,7 +5369,7 @@ def test_list_products_rest_pager(transport: str = "rest"): ) def test_update_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5614,14 +5604,14 @@ def test_update_product_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_product._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5635,7 +5625,7 @@ def test_update_product_rest_required_fields( # verify required fields with non-default values are left alone client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5678,7 +5668,7 @@ def test_update_product_rest_required_fields( def test_update_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_product._get_unset_required_fields({}) @@ -5696,7 +5686,7 @@ def test_update_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -5752,7 +5742,7 @@ def test_update_product_rest_bad_request( transport: str = "rest", request_type=product_service.UpdateProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5778,7 +5768,7 @@ def test_update_product_rest_bad_request( def test_update_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5827,7 +5817,7 @@ def test_update_product_rest_flattened(): def test_update_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5845,7 +5835,7 @@ def test_update_product_rest_flattened_error(transport: str = "rest"): def test_update_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5858,7 +5848,7 @@ def test_update_product_rest_error(): ) def test_delete_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5906,7 +5896,7 @@ def test_delete_product_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5915,7 +5905,7 @@ def test_delete_product_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_product._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("force",)) @@ -5926,7 +5916,7 @@ def test_delete_product_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5965,7 +5955,7 @@ def test_delete_product_rest_required_fields( def test_delete_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_product._get_unset_required_fields({}) @@ -5975,7 +5965,7 @@ def test_delete_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6025,7 +6015,7 @@ def test_delete_product_rest_bad_request( transport: str = "rest", request_type=product_service.DeleteProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6049,7 +6039,7 @@ def test_delete_product_rest_bad_request( def test_delete_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6091,7 +6081,7 @@ def test_delete_product_rest_flattened(): def test_delete_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6106,7 +6096,7 @@ def test_delete_product_rest_flattened_error(transport: str = "rest"): def test_delete_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6119,7 +6109,7 @@ def test_delete_product_rest_error(): ) def test_purge_products_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6168,7 +6158,7 @@ def test_purge_products_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).purge_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6178,7 +6168,7 @@ def test_purge_products_rest_required_fields( jsonified_request["filter"] = "filter_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).purge_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6189,7 +6179,7 @@ def test_purge_products_rest_required_fields( assert jsonified_request["filter"] == "filter_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6229,7 +6219,7 @@ def test_purge_products_rest_required_fields( def test_purge_products_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.purge_products._get_unset_required_fields({}) @@ -6247,7 +6237,7 @@ def test_purge_products_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_purge_products_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6307,7 +6297,7 @@ def test_purge_products_rest_bad_request( transport: str = "rest", request_type=purge_config.PurgeProductsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6331,7 +6321,7 @@ def test_purge_products_rest_bad_request( def test_purge_products_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6344,7 +6334,7 @@ def test_purge_products_rest_error(): ) def test_import_products_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6392,7 +6382,7 @@ def test_import_products_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6401,7 +6391,7 @@ def test_import_products_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6410,7 +6400,7 @@ def test_import_products_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6450,7 +6440,7 @@ def test_import_products_rest_required_fields( def test_import_products_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_products._get_unset_required_fields({}) @@ -6468,7 +6458,7 @@ def test_import_products_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_products_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6528,7 +6518,7 @@ def test_import_products_rest_bad_request( transport: str = "rest", request_type=import_config.ImportProductsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6552,7 +6542,7 @@ def test_import_products_rest_bad_request( def test_import_products_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6565,7 +6555,7 @@ def test_import_products_rest_error(): ) def test_set_inventory_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6614,21 +6604,21 @@ def test_set_inventory_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_inventory._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_inventory._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6668,7 +6658,7 @@ def test_set_inventory_rest_required_fields( def test_set_inventory_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_inventory._get_unset_required_fields({}) @@ -6678,7 +6668,7 @@ def test_set_inventory_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_inventory_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6738,7 +6728,7 @@ def test_set_inventory_rest_bad_request( transport: str = "rest", request_type=product_service.SetInventoryRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6764,7 +6754,7 @@ def test_set_inventory_rest_bad_request( def test_set_inventory_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6809,7 +6799,7 @@ def test_set_inventory_rest_flattened(): def test_set_inventory_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6825,7 +6815,7 @@ def test_set_inventory_rest_flattened_error(transport: str = "rest"): def test_set_inventory_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6838,7 +6828,7 @@ def test_set_inventory_rest_error(): ) def test_add_fulfillment_places_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6888,7 +6878,7 @@ def test_add_fulfillment_places_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6899,7 +6889,7 @@ def test_add_fulfillment_places_rest_required_fields( jsonified_request["placeIds"] = "place_ids_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6912,7 +6902,7 @@ def test_add_fulfillment_places_rest_required_fields( assert jsonified_request["placeIds"] == "place_ids_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6952,7 +6942,7 @@ def test_add_fulfillment_places_rest_required_fields( def test_add_fulfillment_places_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_fulfillment_places._get_unset_required_fields({}) @@ -6971,7 +6961,7 @@ def test_add_fulfillment_places_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_fulfillment_places_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -7031,7 +7021,7 @@ def test_add_fulfillment_places_rest_bad_request( transport: str = "rest", request_type=product_service.AddFulfillmentPlacesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7055,7 +7045,7 @@ def test_add_fulfillment_places_rest_bad_request( def test_add_fulfillment_places_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7097,7 +7087,7 @@ def test_add_fulfillment_places_rest_flattened(): def test_add_fulfillment_places_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7112,7 +7102,7 @@ def test_add_fulfillment_places_rest_flattened_error(transport: str = "rest"): def test_add_fulfillment_places_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7125,7 +7115,7 @@ def test_add_fulfillment_places_rest_error(): ) def test_remove_fulfillment_places_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7175,7 +7165,7 @@ def test_remove_fulfillment_places_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7186,7 +7176,7 @@ def test_remove_fulfillment_places_rest_required_fields( jsonified_request["placeIds"] = "place_ids_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7199,7 +7189,7 @@ def test_remove_fulfillment_places_rest_required_fields( assert jsonified_request["placeIds"] == "place_ids_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7239,7 +7229,7 @@ def test_remove_fulfillment_places_rest_required_fields( def test_remove_fulfillment_places_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_fulfillment_places._get_unset_required_fields({}) @@ -7258,7 +7248,7 @@ def test_remove_fulfillment_places_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_fulfillment_places_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -7318,7 +7308,7 @@ def test_remove_fulfillment_places_rest_bad_request( transport: str = "rest", request_type=product_service.RemoveFulfillmentPlacesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7342,7 +7332,7 @@ def test_remove_fulfillment_places_rest_bad_request( def test_remove_fulfillment_places_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7384,7 +7374,7 @@ def test_remove_fulfillment_places_rest_flattened(): def test_remove_fulfillment_places_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7399,7 +7389,7 @@ def test_remove_fulfillment_places_rest_flattened_error(transport: str = "rest") def test_remove_fulfillment_places_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7412,7 +7402,7 @@ def test_remove_fulfillment_places_rest_error(): ) def test_add_local_inventories_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7460,7 +7450,7 @@ def test_add_local_inventories_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7469,7 +7459,7 @@ def test_add_local_inventories_rest_required_fields( jsonified_request["product"] = "product_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7478,7 +7468,7 @@ def test_add_local_inventories_rest_required_fields( assert jsonified_request["product"] == "product_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7518,7 +7508,7 @@ def test_add_local_inventories_rest_required_fields( def test_add_local_inventories_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_local_inventories._get_unset_required_fields({}) @@ -7536,7 +7526,7 @@ def test_add_local_inventories_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_local_inventories_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -7596,7 +7586,7 @@ def test_add_local_inventories_rest_bad_request( transport: str = "rest", request_type=product_service.AddLocalInventoriesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7620,7 +7610,7 @@ def test_add_local_inventories_rest_bad_request( def test_add_local_inventories_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7662,7 +7652,7 @@ def test_add_local_inventories_rest_flattened(): def test_add_local_inventories_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7677,7 +7667,7 @@ def test_add_local_inventories_rest_flattened_error(transport: str = "rest"): def test_add_local_inventories_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7690,7 +7680,7 @@ def test_add_local_inventories_rest_error(): ) def test_remove_local_inventories_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7739,7 +7729,7 @@ def test_remove_local_inventories_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7749,7 +7739,7 @@ def test_remove_local_inventories_rest_required_fields( jsonified_request["placeIds"] = "place_ids_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7760,7 +7750,7 @@ def test_remove_local_inventories_rest_required_fields( assert jsonified_request["placeIds"] == "place_ids_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7800,7 +7790,7 @@ def test_remove_local_inventories_rest_required_fields( def test_remove_local_inventories_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_local_inventories._get_unset_required_fields({}) @@ -7818,7 +7808,7 @@ def test_remove_local_inventories_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_local_inventories_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -7878,7 +7868,7 @@ def test_remove_local_inventories_rest_bad_request( transport: str = "rest", request_type=product_service.RemoveLocalInventoriesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7902,7 +7892,7 @@ def test_remove_local_inventories_rest_bad_request( def test_remove_local_inventories_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7944,7 +7934,7 @@ def test_remove_local_inventories_rest_flattened(): def test_remove_local_inventories_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7959,24 +7949,24 @@ def test_remove_local_inventories_rest_flattened_error(transport: str = "rest"): def test_remove_local_inventories_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProductServiceClient( @@ -7986,7 +7976,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -8001,13 +7991,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ProductServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProductServiceClient( @@ -8019,7 +8008,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ProductServiceClient(transport=transport) assert client.transport is transport @@ -8028,13 +8017,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ProductServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -8051,7 +8040,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -8065,7 +8054,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ProductServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -8073,7 +8062,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -8085,7 +8074,7 @@ def test_product_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ProductServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -8097,7 +8086,7 @@ def test_product_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ProductServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -8147,7 +8136,7 @@ def test_product_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.product_service.transports.ProductServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProductServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -8166,7 +8155,7 @@ def test_product_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.product_service.transports.ProductServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProductServiceTransport() adc.assert_called_once() @@ -8174,7 +8163,7 @@ def test_product_service_base_transport_with_adc(): def test_product_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ProductServiceClient() adc.assert_called_once_with( scopes=None, @@ -8194,7 +8183,7 @@ def test_product_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -8241,7 +8230,7 @@ def test_product_service_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -8269,7 +8258,7 @@ def test_product_service_transport_create_channel(transport_class, grpc_helpers) ], ) def test_product_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -8307,7 +8296,7 @@ def test_product_service_grpc_transport_client_cert_source_for_mtls(transport_cl def test_product_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -8319,7 +8308,7 @@ def test_product_service_http_transport_client_cert_source_for_mtls(): def test_product_service_rest_lro_client(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -8344,7 +8333,7 @@ def test_product_service_rest_lro_client(): ) def test_product_service_host_no_port(transport_name): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -8367,7 +8356,7 @@ def test_product_service_host_no_port(transport_name): ) def test_product_service_host_with_port(transport_name): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -8387,8 +8376,8 @@ def test_product_service_host_with_port(transport_name): ], ) def test_product_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ProductServiceClient( credentials=creds1, transport=transport_name, @@ -8485,7 +8474,7 @@ def test_product_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -8563,7 +8552,7 @@ def test_product_service_transport_channel_mtls_with_adc(transport_class): def test_product_service_grpc_lro_client(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -8580,7 +8569,7 @@ def test_product_service_grpc_lro_client(): def test_product_service_grpc_lro_async_client(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -8768,7 +8757,7 @@ def test_client_with_default_client_info(): transports.ProductServiceTransport, "_prep_wrapped_messages" ) as prep: client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8778,7 +8767,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ProductServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8787,7 +8776,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -8802,7 +8791,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8835,7 +8824,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -8865,7 +8854,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8895,7 +8884,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -8921,7 +8910,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8946,7 +8935,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8972,7 +8961,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9001,7 +8990,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9030,7 +9019,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -9048,7 +9037,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -9066,7 +9055,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9091,7 +9080,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9117,7 +9106,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9146,7 +9135,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9175,7 +9164,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -9193,7 +9182,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -9217,7 +9206,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -9234,7 +9223,7 @@ def test_client_ctx(): ] for transport in transports: client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_search_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_search_service.py index 6f08dad7bc7f..ddf453bea981 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_search_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_search_service.py @@ -79,18 +79,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -313,7 +301,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -340,42 +328,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -386,7 +381,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_search_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -438,7 +433,7 @@ def test_search_service_client_service_account_always_use_jwt( ], ) def test_search_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -501,9 +496,7 @@ def test_search_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(SearchServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -902,20 +895,20 @@ def test_search_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -927,13 +920,11 @@ def test_search_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -949,8 +940,7 @@ def test_search_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1103,8 +1093,8 @@ def test_search_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1133,7 +1123,7 @@ def test_search_service_client_create_channel_credentials_file( ) def test_search(request_type, transport: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1173,7 +1163,7 @@ def test_search_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1190,7 +1180,7 @@ async def test_search_async( transport: str = "grpc_asyncio", request_type=search_service.SearchRequest ): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1235,7 +1225,7 @@ async def test_search_async_from_dict(): def test_search_field_headers(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1265,7 +1255,7 @@ def test_search_field_headers(): @pytest.mark.asyncio async def test_search_field_headers_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1296,7 +1286,7 @@ async def test_search_field_headers_async(): def test_search_pager(transport_name: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1348,7 +1338,7 @@ def test_search_pager(transport_name: str = "grpc"): def test_search_pages(transport_name: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1390,7 +1380,7 @@ def test_search_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_async_pager(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1442,7 +1432,7 @@ async def test_search_async_pager(): @pytest.mark.asyncio async def test_search_async_pages(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1495,7 +1485,7 @@ async def test_search_async_pages(): ) def test_search_rest(request_type): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1557,7 +1547,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).search._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1567,7 +1557,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): jsonified_request["visitorId"] = "visitor_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).search._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1578,7 +1568,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): assert jsonified_request["visitorId"] == "visitor_id_value" client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1621,7 +1611,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): def test_search_rest_unset_required_fields(): transport = transports.SearchServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.search._get_unset_required_fields({}) @@ -1639,7 +1629,7 @@ def test_search_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_search_rest_interceptors(null_interceptor): transport = transports.SearchServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SearchServiceRestInterceptor(), @@ -1695,7 +1685,7 @@ def test_search_rest_bad_request( transport: str = "rest", request_type=search_service.SearchRequest ): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1719,7 +1709,7 @@ def test_search_rest_bad_request( def test_search_rest_pager(transport: str = "rest"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1785,17 +1775,17 @@ def test_search_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SearchServiceClient( @@ -1805,7 +1795,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1820,13 +1810,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SearchServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SearchServiceClient( @@ -1838,7 +1827,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SearchServiceClient(transport=transport) assert client.transport is transport @@ -1847,13 +1836,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SearchServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1870,7 +1859,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1884,7 +1873,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SearchServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1892,7 +1881,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1904,7 +1893,7 @@ def test_search_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SearchServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1916,7 +1905,7 @@ def test_search_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SearchServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1950,7 +1939,7 @@ def test_search_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.search_service.transports.SearchServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SearchServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1969,7 +1958,7 @@ def test_search_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.search_service.transports.SearchServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SearchServiceTransport() adc.assert_called_once() @@ -1977,7 +1966,7 @@ def test_search_service_base_transport_with_adc(): def test_search_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SearchServiceClient() adc.assert_called_once_with( scopes=None, @@ -1997,7 +1986,7 @@ def test_search_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2044,7 +2033,7 @@ def test_search_service_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2072,7 +2061,7 @@ def test_search_service_transport_create_channel(transport_class, grpc_helpers): ], ) def test_search_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2110,7 +2099,7 @@ def test_search_service_grpc_transport_client_cert_source_for_mtls(transport_cla def test_search_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2130,7 +2119,7 @@ def test_search_service_http_transport_client_cert_source_for_mtls(): ) def test_search_service_host_no_port(transport_name): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -2153,7 +2142,7 @@ def test_search_service_host_no_port(transport_name): ) def test_search_service_host_with_port(transport_name): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -2173,8 +2162,8 @@ def test_search_service_host_with_port(transport_name): ], ) def test_search_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SearchServiceClient( credentials=creds1, transport=transport_name, @@ -2236,7 +2225,7 @@ def test_search_service_transport_channel_mtls_with_client_cert_source(transport mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2545,7 +2534,7 @@ def test_client_with_default_client_info(): transports.SearchServiceTransport, "_prep_wrapped_messages" ) as prep: client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2555,7 +2544,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SearchServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2564,7 +2553,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2579,7 +2568,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2612,7 +2601,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -2642,7 +2631,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2672,7 +2661,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -2698,7 +2687,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2723,7 +2712,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2749,7 +2738,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2778,7 +2767,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2807,7 +2796,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2825,7 +2814,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2843,7 +2832,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2868,7 +2857,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2894,7 +2883,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2923,7 +2912,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2952,7 +2941,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2970,7 +2959,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2994,7 +2983,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3011,7 +3000,7 @@ def test_client_ctx(): ] for transport in transports: client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_serving_config_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_serving_config_service.py index 4ff4ce302861..54d12a98760e 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_serving_config_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_serving_config_service.py @@ -83,18 +83,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -344,7 +332,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -371,42 +359,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -419,7 +414,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_serving_config_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -473,7 +468,7 @@ def test_serving_config_service_client_service_account_always_use_jwt( def test_serving_config_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -544,9 +539,7 @@ def test_serving_config_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ServingConfigServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -965,20 +958,20 @@ def test_serving_config_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -990,13 +983,11 @@ def test_serving_config_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1012,8 +1003,7 @@ def test_serving_config_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1179,8 +1169,8 @@ def test_serving_config_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1209,7 +1199,7 @@ def test_serving_config_service_client_create_channel_credentials_file( ) def test_create_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1278,7 +1268,7 @@ def test_create_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1298,7 +1288,7 @@ async def test_create_serving_config_async( request_type=serving_config_service.CreateServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1372,7 +1362,7 @@ async def test_create_serving_config_async_from_dict(): def test_create_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1404,7 +1394,7 @@ def test_create_serving_config_field_headers(): @pytest.mark.asyncio async def test_create_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1437,7 +1427,7 @@ async def test_create_serving_config_field_headers_async(): def test_create_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1471,7 +1461,7 @@ def test_create_serving_config_flattened(): def test_create_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1488,7 +1478,7 @@ def test_create_serving_config_flattened_error(): @pytest.mark.asyncio async def test_create_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1527,7 +1517,7 @@ async def test_create_serving_config_flattened_async(): @pytest.mark.asyncio async def test_create_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1550,7 +1540,7 @@ async def test_create_serving_config_flattened_error_async(): ) def test_delete_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1579,7 +1569,7 @@ def test_delete_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1599,7 +1589,7 @@ async def test_delete_serving_config_async( request_type=serving_config_service.DeleteServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1631,7 +1621,7 @@ async def test_delete_serving_config_async_from_dict(): def test_delete_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1663,7 +1653,7 @@ def test_delete_serving_config_field_headers(): @pytest.mark.asyncio async def test_delete_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1694,7 +1684,7 @@ async def test_delete_serving_config_field_headers_async(): def test_delete_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1720,7 +1710,7 @@ def test_delete_serving_config_flattened(): def test_delete_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1735,7 +1725,7 @@ def test_delete_serving_config_flattened_error(): @pytest.mark.asyncio async def test_delete_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1764,7 +1754,7 @@ async def test_delete_serving_config_flattened_async(): @pytest.mark.asyncio async def test_delete_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1785,7 +1775,7 @@ async def test_delete_serving_config_flattened_error_async(): ) def test_update_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1854,7 +1844,7 @@ def test_update_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1874,7 +1864,7 @@ async def test_update_serving_config_async( request_type=serving_config_service.UpdateServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1948,7 +1938,7 @@ async def test_update_serving_config_async_from_dict(): def test_update_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1980,7 +1970,7 @@ def test_update_serving_config_field_headers(): @pytest.mark.asyncio async def test_update_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2013,7 +2003,7 @@ async def test_update_serving_config_field_headers_async(): def test_update_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2043,7 +2033,7 @@ def test_update_serving_config_flattened(): def test_update_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2059,7 +2049,7 @@ def test_update_serving_config_flattened_error(): @pytest.mark.asyncio async def test_update_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2094,7 +2084,7 @@ async def test_update_serving_config_flattened_async(): @pytest.mark.asyncio async def test_update_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2116,7 +2106,7 @@ async def test_update_serving_config_flattened_error_async(): ) def test_get_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2185,7 +2175,7 @@ def test_get_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2205,7 +2195,7 @@ async def test_get_serving_config_async( request_type=serving_config_service.GetServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2279,7 +2269,7 @@ async def test_get_serving_config_async_from_dict(): def test_get_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2311,7 +2301,7 @@ def test_get_serving_config_field_headers(): @pytest.mark.asyncio async def test_get_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2344,7 +2334,7 @@ async def test_get_serving_config_field_headers_async(): def test_get_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2370,7 +2360,7 @@ def test_get_serving_config_flattened(): def test_get_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2385,7 +2375,7 @@ def test_get_serving_config_flattened_error(): @pytest.mark.asyncio async def test_get_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2416,7 +2406,7 @@ async def test_get_serving_config_flattened_async(): @pytest.mark.asyncio async def test_get_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2437,7 +2427,7 @@ async def test_get_serving_config_flattened_error_async(): ) def test_list_serving_configs(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2469,7 +2459,7 @@ def test_list_serving_configs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2489,7 +2479,7 @@ async def test_list_serving_configs_async( request_type=serving_config_service.ListServingConfigsRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2526,7 +2516,7 @@ async def test_list_serving_configs_async_from_dict(): def test_list_serving_configs_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2558,7 +2548,7 @@ def test_list_serving_configs_field_headers(): @pytest.mark.asyncio async def test_list_serving_configs_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2591,7 +2581,7 @@ async def test_list_serving_configs_field_headers_async(): def test_list_serving_configs_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2617,7 +2607,7 @@ def test_list_serving_configs_flattened(): def test_list_serving_configs_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2632,7 +2622,7 @@ def test_list_serving_configs_flattened_error(): @pytest.mark.asyncio async def test_list_serving_configs_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2663,7 +2653,7 @@ async def test_list_serving_configs_flattened_async(): @pytest.mark.asyncio async def test_list_serving_configs_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2677,7 +2667,7 @@ async def test_list_serving_configs_flattened_error_async(): def test_list_serving_configs_pager(transport_name: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2729,7 +2719,7 @@ def test_list_serving_configs_pager(transport_name: str = "grpc"): def test_list_serving_configs_pages(transport_name: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2773,7 +2763,7 @@ def test_list_serving_configs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_serving_configs_async_pager(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2825,7 +2815,7 @@ async def test_list_serving_configs_async_pager(): @pytest.mark.asyncio async def test_list_serving_configs_async_pages(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2882,7 +2872,7 @@ async def test_list_serving_configs_async_pages(): ) def test_add_control(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2949,7 +2939,7 @@ def test_add_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2967,7 +2957,7 @@ async def test_add_control_async( request_type=serving_config_service.AddControlRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3039,7 +3029,7 @@ async def test_add_control_async_from_dict(): def test_add_control_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3069,7 +3059,7 @@ def test_add_control_field_headers(): @pytest.mark.asyncio async def test_add_control_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3100,7 +3090,7 @@ async def test_add_control_field_headers_async(): def test_add_control_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3124,7 +3114,7 @@ def test_add_control_flattened(): def test_add_control_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3139,7 +3129,7 @@ def test_add_control_flattened_error(): @pytest.mark.asyncio async def test_add_control_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3168,7 +3158,7 @@ async def test_add_control_flattened_async(): @pytest.mark.asyncio async def test_add_control_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3189,7 +3179,7 @@ async def test_add_control_flattened_error_async(): ) def test_remove_control(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3256,7 +3246,7 @@ def test_remove_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3274,7 +3264,7 @@ async def test_remove_control_async( request_type=serving_config_service.RemoveControlRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3346,7 +3336,7 @@ async def test_remove_control_async_from_dict(): def test_remove_control_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3376,7 +3366,7 @@ def test_remove_control_field_headers(): @pytest.mark.asyncio async def test_remove_control_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3407,7 +3397,7 @@ async def test_remove_control_field_headers_async(): def test_remove_control_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3431,7 +3421,7 @@ def test_remove_control_flattened(): def test_remove_control_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3446,7 +3436,7 @@ def test_remove_control_flattened_error(): @pytest.mark.asyncio async def test_remove_control_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3475,7 +3465,7 @@ async def test_remove_control_flattened_async(): @pytest.mark.asyncio async def test_remove_control_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3496,7 +3486,7 @@ async def test_remove_control_flattened_error_async(): ) def test_create_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3697,7 +3687,7 @@ def test_create_serving_config_rest_required_fields( assert "servingConfigId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3709,7 +3699,7 @@ def test_create_serving_config_rest_required_fields( jsonified_request["servingConfigId"] = "serving_config_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_serving_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("serving_config_id",)) @@ -3722,7 +3712,7 @@ def test_create_serving_config_rest_required_fields( assert jsonified_request["servingConfigId"] == "serving_config_id_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3771,7 +3761,7 @@ def test_create_serving_config_rest_required_fields( def test_create_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_serving_config._get_unset_required_fields({}) @@ -3790,7 +3780,7 @@ def test_create_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -3849,7 +3839,7 @@ def test_create_serving_config_rest_bad_request( request_type=serving_config_service.CreateServingConfigRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3871,7 +3861,7 @@ def test_create_serving_config_rest_bad_request( def test_create_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3917,7 +3907,7 @@ def test_create_serving_config_rest_flattened(): def test_create_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3934,7 +3924,7 @@ def test_create_serving_config_rest_flattened_error(transport: str = "rest"): def test_create_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3947,7 +3937,7 @@ def test_create_serving_config_rest_error(): ) def test_delete_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3995,7 +3985,7 @@ def test_delete_serving_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4004,7 +3994,7 @@ def test_delete_serving_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4013,7 +4003,7 @@ def test_delete_serving_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4052,7 +4042,7 @@ def test_delete_serving_config_rest_required_fields( def test_delete_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_serving_config._get_unset_required_fields({}) @@ -4062,7 +4052,7 @@ def test_delete_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -4113,7 +4103,7 @@ def test_delete_serving_config_rest_bad_request( request_type=serving_config_service.DeleteServingConfigRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4137,7 +4127,7 @@ def test_delete_serving_config_rest_bad_request( def test_delete_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4179,7 +4169,7 @@ def test_delete_serving_config_rest_flattened(): def test_delete_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4194,7 +4184,7 @@ def test_delete_serving_config_rest_flattened_error(transport: str = "rest"): def test_delete_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4207,7 +4197,7 @@ def test_delete_serving_config_rest_error(): ) def test_update_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4409,14 +4399,14 @@ def test_update_serving_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_serving_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -4425,7 +4415,7 @@ def test_update_serving_config_rest_required_fields( # verify required fields with non-default values are left alone client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4468,7 +4458,7 @@ def test_update_serving_config_rest_required_fields( def test_update_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_serving_config._get_unset_required_fields({}) @@ -4478,7 +4468,7 @@ def test_update_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -4537,7 +4527,7 @@ def test_update_serving_config_rest_bad_request( request_type=serving_config_service.UpdateServingConfigRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4563,7 +4553,7 @@ def test_update_serving_config_rest_bad_request( def test_update_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4610,7 +4600,7 @@ def test_update_serving_config_rest_flattened(): def test_update_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4626,7 +4616,7 @@ def test_update_serving_config_rest_flattened_error(transport: str = "rest"): def test_update_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4639,7 +4629,7 @@ def test_update_serving_config_rest_error(): ) def test_get_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4729,7 +4719,7 @@ def test_get_serving_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4738,7 +4728,7 @@ def test_get_serving_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4747,7 +4737,7 @@ def test_get_serving_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4789,7 +4779,7 @@ def test_get_serving_config_rest_required_fields( def test_get_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_serving_config._get_unset_required_fields({}) @@ -4799,7 +4789,7 @@ def test_get_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -4857,7 +4847,7 @@ def test_get_serving_config_rest_bad_request( transport: str = "rest", request_type=serving_config_service.GetServingConfigRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4881,7 +4871,7 @@ def test_get_serving_config_rest_bad_request( def test_get_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4925,7 +4915,7 @@ def test_get_serving_config_rest_flattened(): def test_get_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4940,7 +4930,7 @@ def test_get_serving_config_rest_flattened_error(transport: str = "rest"): def test_get_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4953,7 +4943,7 @@ def test_get_serving_config_rest_error(): ) def test_list_serving_configs_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5006,7 +4996,7 @@ def test_list_serving_configs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_serving_configs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5015,7 +5005,7 @@ def test_list_serving_configs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_serving_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5031,7 +5021,7 @@ def test_list_serving_configs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5075,7 +5065,7 @@ def test_list_serving_configs_rest_required_fields( def test_list_serving_configs_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_serving_configs._get_unset_required_fields({}) @@ -5093,7 +5083,7 @@ def test_list_serving_configs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_serving_configs_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -5154,7 +5144,7 @@ def test_list_serving_configs_rest_bad_request( request_type=serving_config_service.ListServingConfigsRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5176,7 +5166,7 @@ def test_list_serving_configs_rest_bad_request( def test_list_serving_configs_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5222,7 +5212,7 @@ def test_list_serving_configs_rest_flattened(): def test_list_serving_configs_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5237,7 +5227,7 @@ def test_list_serving_configs_rest_flattened_error(transport: str = "rest"): def test_list_serving_configs_rest_pager(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5310,7 +5300,7 @@ def test_list_serving_configs_rest_pager(transport: str = "rest"): ) def test_add_control_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5401,7 +5391,7 @@ def test_add_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5411,7 +5401,7 @@ def test_add_control_rest_required_fields( jsonified_request["controlId"] = "control_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5422,7 +5412,7 @@ def test_add_control_rest_required_fields( assert jsonified_request["controlId"] == "control_id_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5465,7 +5455,7 @@ def test_add_control_rest_required_fields( def test_add_control_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_control._get_unset_required_fields({}) @@ -5483,7 +5473,7 @@ def test_add_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_control_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -5541,7 +5531,7 @@ def test_add_control_rest_bad_request( transport: str = "rest", request_type=serving_config_service.AddControlRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5565,7 +5555,7 @@ def test_add_control_rest_bad_request( def test_add_control_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5609,7 +5599,7 @@ def test_add_control_rest_flattened(): def test_add_control_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5624,7 +5614,7 @@ def test_add_control_rest_flattened_error(transport: str = "rest"): def test_add_control_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5637,7 +5627,7 @@ def test_add_control_rest_error(): ) def test_remove_control_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5728,7 +5718,7 @@ def test_remove_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5738,7 +5728,7 @@ def test_remove_control_rest_required_fields( jsonified_request["controlId"] = "control_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5749,7 +5739,7 @@ def test_remove_control_rest_required_fields( assert jsonified_request["controlId"] == "control_id_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5792,7 +5782,7 @@ def test_remove_control_rest_required_fields( def test_remove_control_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_control._get_unset_required_fields({}) @@ -5810,7 +5800,7 @@ def test_remove_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_control_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -5868,7 +5858,7 @@ def test_remove_control_rest_bad_request( transport: str = "rest", request_type=serving_config_service.RemoveControlRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5892,7 +5882,7 @@ def test_remove_control_rest_bad_request( def test_remove_control_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5936,7 +5926,7 @@ def test_remove_control_rest_flattened(): def test_remove_control_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5951,24 +5941,24 @@ def test_remove_control_rest_flattened_error(transport: str = "rest"): def test_remove_control_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServingConfigServiceClient( @@ -5978,7 +5968,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5993,13 +5983,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ServingConfigServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServingConfigServiceClient( @@ -6011,7 +6000,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServingConfigServiceClient(transport=transport) assert client.transport is transport @@ -6020,13 +6009,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServingConfigServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -6043,7 +6032,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -6057,7 +6046,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ServingConfigServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -6065,7 +6054,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -6077,7 +6066,7 @@ def test_serving_config_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServingConfigServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -6089,7 +6078,7 @@ def test_serving_config_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServingConfigServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -6129,7 +6118,7 @@ def test_serving_config_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.serving_config_service.transports.ServingConfigServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServingConfigServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -6148,7 +6137,7 @@ def test_serving_config_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.serving_config_service.transports.ServingConfigServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServingConfigServiceTransport() adc.assert_called_once() @@ -6156,7 +6145,7 @@ def test_serving_config_service_base_transport_with_adc(): def test_serving_config_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ServingConfigServiceClient() adc.assert_called_once_with( scopes=None, @@ -6176,7 +6165,7 @@ def test_serving_config_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6223,7 +6212,7 @@ def test_serving_config_service_transport_create_channel(transport_class, grpc_h ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6253,7 +6242,7 @@ def test_serving_config_service_transport_create_channel(transport_class, grpc_h def test_serving_config_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6291,7 +6280,7 @@ def test_serving_config_service_grpc_transport_client_cert_source_for_mtls( def test_serving_config_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6311,7 +6300,7 @@ def test_serving_config_service_http_transport_client_cert_source_for_mtls(): ) def test_serving_config_service_host_no_port(transport_name): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -6334,7 +6323,7 @@ def test_serving_config_service_host_no_port(transport_name): ) def test_serving_config_service_host_with_port(transport_name): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -6354,8 +6343,8 @@ def test_serving_config_service_host_with_port(transport_name): ], ) def test_serving_config_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ServingConfigServiceClient( credentials=creds1, transport=transport_name, @@ -6437,7 +6426,7 @@ def test_serving_config_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6680,7 +6669,7 @@ def test_client_with_default_client_info(): transports.ServingConfigServiceTransport, "_prep_wrapped_messages" ) as prep: client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6690,7 +6679,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServingConfigServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6699,7 +6688,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6714,7 +6703,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6747,7 +6736,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -6777,7 +6766,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6807,7 +6796,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -6833,7 +6822,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6858,7 +6847,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6884,7 +6873,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6913,7 +6902,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6942,7 +6931,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6960,7 +6949,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6978,7 +6967,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7003,7 +6992,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7029,7 +7018,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7058,7 +7047,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7087,7 +7076,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7105,7 +7094,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7129,7 +7118,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -7146,7 +7135,7 @@ def test_client_ctx(): ] for transport in transports: client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_user_event_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_user_event_service.py index 6506a95d1d07..e78be774d670 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_user_event_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_user_event_service.py @@ -102,18 +102,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -341,7 +329,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -368,42 +356,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -416,7 +411,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_user_event_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -470,7 +465,7 @@ def test_user_event_service_client_service_account_always_use_jwt( def test_user_event_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -533,9 +528,7 @@ def test_user_event_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(UserEventServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -954,20 +947,20 @@ def test_user_event_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -979,13 +972,11 @@ def test_user_event_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1001,8 +992,7 @@ def test_user_event_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1160,8 +1150,8 @@ def test_user_event_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1190,7 +1180,7 @@ def test_user_event_service_client_create_channel_credentials_file( ) def test_write_user_event(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1248,7 +1238,7 @@ def test_write_user_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1266,7 +1256,7 @@ async def test_write_user_event_async( request_type=user_event_service.WriteUserEventRequest, ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1329,7 +1319,7 @@ async def test_write_user_event_async_from_dict(): def test_write_user_event_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1359,7 +1349,7 @@ def test_write_user_event_field_headers(): @pytest.mark.asyncio async def test_write_user_event_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1397,7 +1387,7 @@ async def test_write_user_event_field_headers_async(): ) def test_collect_user_event(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1431,7 +1421,7 @@ def test_collect_user_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1451,7 +1441,7 @@ async def test_collect_user_event_async( request_type=user_event_service.CollectUserEventRequest, ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1490,7 +1480,7 @@ async def test_collect_user_event_async_from_dict(): def test_collect_user_event_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1522,7 +1512,7 @@ def test_collect_user_event_field_headers(): @pytest.mark.asyncio async def test_collect_user_event_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1562,7 +1552,7 @@ async def test_collect_user_event_field_headers_async(): ) def test_purge_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1591,7 +1581,7 @@ def test_purge_user_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1610,7 +1600,7 @@ async def test_purge_user_events_async( transport: str = "grpc_asyncio", request_type=purge_config.PurgeUserEventsRequest ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1644,7 +1634,7 @@ async def test_purge_user_events_async_from_dict(): def test_purge_user_events_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1676,7 +1666,7 @@ def test_purge_user_events_field_headers(): @pytest.mark.asyncio async def test_purge_user_events_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1716,7 +1706,7 @@ async def test_purge_user_events_field_headers_async(): ) def test_import_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1745,7 +1735,7 @@ def test_import_user_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1764,7 +1754,7 @@ async def test_import_user_events_async( transport: str = "grpc_asyncio", request_type=import_config.ImportUserEventsRequest ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1798,7 +1788,7 @@ async def test_import_user_events_async_from_dict(): def test_import_user_events_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1830,7 +1820,7 @@ def test_import_user_events_field_headers(): @pytest.mark.asyncio async def test_import_user_events_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1870,7 +1860,7 @@ async def test_import_user_events_field_headers_async(): ) def test_rejoin_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1899,7 +1889,7 @@ def test_rejoin_user_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1919,7 +1909,7 @@ async def test_rejoin_user_events_async( request_type=user_event_service.RejoinUserEventsRequest, ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1953,7 +1943,7 @@ async def test_rejoin_user_events_async_from_dict(): def test_rejoin_user_events_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1985,7 +1975,7 @@ def test_rejoin_user_events_field_headers(): @pytest.mark.asyncio async def test_rejoin_user_events_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2025,7 +2015,7 @@ async def test_rejoin_user_events_field_headers_async(): ) def test_write_user_event_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2296,7 +2286,7 @@ def test_write_user_event_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).write_user_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2305,7 +2295,7 @@ def test_write_user_event_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).write_user_event._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("write_async",)) @@ -2316,7 +2306,7 @@ def test_write_user_event_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2359,7 +2349,7 @@ def test_write_user_event_rest_required_fields( def test_write_user_event_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.write_user_event._get_unset_required_fields({}) @@ -2377,7 +2367,7 @@ def test_write_user_event_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_write_user_event_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -2433,7 +2423,7 @@ def test_write_user_event_rest_bad_request( transport: str = "rest", request_type=user_event_service.WriteUserEventRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2455,7 +2445,7 @@ def test_write_user_event_rest_bad_request( def test_write_user_event_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2468,7 +2458,7 @@ def test_write_user_event_rest_error(): ) def test_collect_user_event_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2521,7 +2511,7 @@ def test_collect_user_event_rest_required_fields( assert "userEvent" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).collect_user_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2533,7 +2523,7 @@ def test_collect_user_event_rest_required_fields( jsonified_request["userEvent"] = "user_event_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).collect_user_event._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2554,7 +2544,7 @@ def test_collect_user_event_rest_required_fields( assert jsonified_request["userEvent"] == "user_event_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2600,7 +2590,7 @@ def test_collect_user_event_rest_required_fields( def test_collect_user_event_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.collect_user_event._get_unset_required_fields({}) @@ -2626,7 +2616,7 @@ def test_collect_user_event_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_collect_user_event_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -2682,7 +2672,7 @@ def test_collect_user_event_rest_bad_request( transport: str = "rest", request_type=user_event_service.CollectUserEventRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2704,7 +2694,7 @@ def test_collect_user_event_rest_bad_request( def test_collect_user_event_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2717,7 +2707,7 @@ def test_collect_user_event_rest_error(): ) def test_purge_user_events_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2764,7 +2754,7 @@ def test_purge_user_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).purge_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2774,7 +2764,7 @@ def test_purge_user_events_rest_required_fields( jsonified_request["filter"] = "filter_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).purge_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2785,7 +2775,7 @@ def test_purge_user_events_rest_required_fields( assert jsonified_request["filter"] == "filter_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2825,7 +2815,7 @@ def test_purge_user_events_rest_required_fields( def test_purge_user_events_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.purge_user_events._get_unset_required_fields({}) @@ -2843,7 +2833,7 @@ def test_purge_user_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_purge_user_events_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -2903,7 +2893,7 @@ def test_purge_user_events_rest_bad_request( transport: str = "rest", request_type=purge_config.PurgeUserEventsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2925,7 +2915,7 @@ def test_purge_user_events_rest_bad_request( def test_purge_user_events_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2938,7 +2928,7 @@ def test_purge_user_events_rest_error(): ) def test_import_user_events_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2984,7 +2974,7 @@ def test_import_user_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2993,7 +2983,7 @@ def test_import_user_events_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3002,7 +2992,7 @@ def test_import_user_events_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3042,7 +3032,7 @@ def test_import_user_events_rest_required_fields( def test_import_user_events_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_user_events._get_unset_required_fields({}) @@ -3060,7 +3050,7 @@ def test_import_user_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_user_events_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -3120,7 +3110,7 @@ def test_import_user_events_rest_bad_request( transport: str = "rest", request_type=import_config.ImportUserEventsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3142,7 +3132,7 @@ def test_import_user_events_rest_bad_request( def test_import_user_events_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3155,7 +3145,7 @@ def test_import_user_events_rest_error(): ) def test_rejoin_user_events_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3201,7 +3191,7 @@ def test_rejoin_user_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).rejoin_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3210,7 +3200,7 @@ def test_rejoin_user_events_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).rejoin_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3219,7 +3209,7 @@ def test_rejoin_user_events_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3259,7 +3249,7 @@ def test_rejoin_user_events_rest_required_fields( def test_rejoin_user_events_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.rejoin_user_events._get_unset_required_fields({}) @@ -3269,7 +3259,7 @@ def test_rejoin_user_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_rejoin_user_events_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -3329,7 +3319,7 @@ def test_rejoin_user_events_rest_bad_request( transport: str = "rest", request_type=user_event_service.RejoinUserEventsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3351,24 +3341,24 @@ def test_rejoin_user_events_rest_bad_request( def test_rejoin_user_events_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = UserEventServiceClient( @@ -3378,7 +3368,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -3393,13 +3383,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = UserEventServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = UserEventServiceClient( @@ -3411,7 +3400,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = UserEventServiceClient(transport=transport) assert client.transport is transport @@ -3420,13 +3409,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.UserEventServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -3443,7 +3432,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3457,7 +3446,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = UserEventServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3465,7 +3454,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3477,7 +3466,7 @@ def test_user_event_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.UserEventServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3489,7 +3478,7 @@ def test_user_event_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.UserEventServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3532,7 +3521,7 @@ def test_user_event_service_base_transport_with_credentials_file(): "google.cloud.retail_v2alpha.services.user_event_service.transports.UserEventServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.UserEventServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3551,7 +3540,7 @@ def test_user_event_service_base_transport_with_adc(): "google.cloud.retail_v2alpha.services.user_event_service.transports.UserEventServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.UserEventServiceTransport() adc.assert_called_once() @@ -3559,7 +3548,7 @@ def test_user_event_service_base_transport_with_adc(): def test_user_event_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) UserEventServiceClient() adc.assert_called_once_with( scopes=None, @@ -3579,7 +3568,7 @@ def test_user_event_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3626,7 +3615,7 @@ def test_user_event_service_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3654,7 +3643,7 @@ def test_user_event_service_transport_create_channel(transport_class, grpc_helpe ], ) def test_user_event_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3692,7 +3681,7 @@ def test_user_event_service_grpc_transport_client_cert_source_for_mtls(transport def test_user_event_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3704,7 +3693,7 @@ def test_user_event_service_http_transport_client_cert_source_for_mtls(): def test_user_event_service_rest_lro_client(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3729,7 +3718,7 @@ def test_user_event_service_rest_lro_client(): ) def test_user_event_service_host_no_port(transport_name): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -3752,7 +3741,7 @@ def test_user_event_service_host_no_port(transport_name): ) def test_user_event_service_host_with_port(transport_name): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -3772,8 +3761,8 @@ def test_user_event_service_host_with_port(transport_name): ], ) def test_user_event_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = UserEventServiceClient( credentials=creds1, transport=transport_name, @@ -3849,7 +3838,7 @@ def test_user_event_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3927,7 +3916,7 @@ def test_user_event_service_transport_channel_mtls_with_adc(transport_class): def test_user_event_service_grpc_lro_client(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -3944,7 +3933,7 @@ def test_user_event_service_grpc_lro_client(): def test_user_event_service_grpc_lro_async_client(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -4129,7 +4118,7 @@ def test_client_with_default_client_info(): transports.UserEventServiceTransport, "_prep_wrapped_messages" ) as prep: client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4139,7 +4128,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = UserEventServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4148,7 +4137,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -4163,7 +4152,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4196,7 +4185,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -4226,7 +4215,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4256,7 +4245,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -4282,7 +4271,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4307,7 +4296,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4333,7 +4322,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4362,7 +4351,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4391,7 +4380,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4409,7 +4398,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4427,7 +4416,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4452,7 +4441,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4478,7 +4467,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4507,7 +4496,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4536,7 +4525,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4554,7 +4543,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4578,7 +4567,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -4595,7 +4584,7 @@ def test_client_ctx(): ] for transport in transports: client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_analytics_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_analytics_service.py index 81e05fd72655..3a5a7c4ff995 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_analytics_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_analytics_service.py @@ -87,18 +87,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -326,7 +314,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -353,42 +341,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -401,7 +396,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_analytics_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -455,7 +450,7 @@ def test_analytics_service_client_service_account_always_use_jwt( def test_analytics_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -518,9 +513,7 @@ def test_analytics_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(AnalyticsServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -939,20 +932,20 @@ def test_analytics_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -964,13 +957,11 @@ def test_analytics_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -986,8 +977,7 @@ def test_analytics_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1145,8 +1135,8 @@ def test_analytics_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1175,7 +1165,7 @@ def test_analytics_service_client_create_channel_credentials_file( ) def test_export_analytics_metrics(request_type, transport: str = "grpc"): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1204,7 +1194,7 @@ def test_export_analytics_metrics_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1224,7 +1214,7 @@ async def test_export_analytics_metrics_async( request_type=export_config.ExportAnalyticsMetricsRequest, ): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1258,7 +1248,7 @@ async def test_export_analytics_metrics_async_from_dict(): def test_export_analytics_metrics_field_headers(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1290,7 +1280,7 @@ def test_export_analytics_metrics_field_headers(): @pytest.mark.asyncio async def test_export_analytics_metrics_field_headers_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1330,7 +1320,7 @@ async def test_export_analytics_metrics_field_headers_async(): ) def test_export_analytics_metrics_rest(request_type): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1376,7 +1366,7 @@ def test_export_analytics_metrics_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).export_analytics_metrics._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1385,7 +1375,7 @@ def test_export_analytics_metrics_rest_required_fields( jsonified_request["catalog"] = "catalog_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).export_analytics_metrics._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1394,7 +1384,7 @@ def test_export_analytics_metrics_rest_required_fields( assert jsonified_request["catalog"] == "catalog_value" client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1434,7 +1424,7 @@ def test_export_analytics_metrics_rest_required_fields( def test_export_analytics_metrics_rest_unset_required_fields(): transport = transports.AnalyticsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.export_analytics_metrics._get_unset_required_fields({}) @@ -1452,7 +1442,7 @@ def test_export_analytics_metrics_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_export_analytics_metrics_rest_interceptors(null_interceptor): transport = transports.AnalyticsServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AnalyticsServiceRestInterceptor(), @@ -1512,7 +1502,7 @@ def test_export_analytics_metrics_rest_bad_request( transport: str = "rest", request_type=export_config.ExportAnalyticsMetricsRequest ): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1534,24 +1524,24 @@ def test_export_analytics_metrics_rest_bad_request( def test_export_analytics_metrics_rest_error(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AnalyticsServiceClient( @@ -1561,7 +1551,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1576,13 +1566,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = AnalyticsServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AnalyticsServiceClient( @@ -1594,7 +1583,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = AnalyticsServiceClient(transport=transport) assert client.transport is transport @@ -1603,13 +1592,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.AnalyticsServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.AnalyticsServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1626,7 +1615,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1640,7 +1629,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = AnalyticsServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1648,7 +1637,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1660,7 +1649,7 @@ def test_analytics_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.AnalyticsServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1672,7 +1661,7 @@ def test_analytics_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.AnalyticsServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1711,7 +1700,7 @@ def test_analytics_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.analytics_service.transports.AnalyticsServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AnalyticsServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1730,7 +1719,7 @@ def test_analytics_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.analytics_service.transports.AnalyticsServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AnalyticsServiceTransport() adc.assert_called_once() @@ -1738,7 +1727,7 @@ def test_analytics_service_base_transport_with_adc(): def test_analytics_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) AnalyticsServiceClient() adc.assert_called_once_with( scopes=None, @@ -1758,7 +1747,7 @@ def test_analytics_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -1805,7 +1794,7 @@ def test_analytics_service_transport_create_channel(transport_class, grpc_helper ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -1833,7 +1822,7 @@ def test_analytics_service_transport_create_channel(transport_class, grpc_helper ], ) def test_analytics_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1871,7 +1860,7 @@ def test_analytics_service_grpc_transport_client_cert_source_for_mtls(transport_ def test_analytics_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -1883,7 +1872,7 @@ def test_analytics_service_http_transport_client_cert_source_for_mtls(): def test_analytics_service_rest_lro_client(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -1908,7 +1897,7 @@ def test_analytics_service_rest_lro_client(): ) def test_analytics_service_host_no_port(transport_name): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -1931,7 +1920,7 @@ def test_analytics_service_host_no_port(transport_name): ) def test_analytics_service_host_with_port(transport_name): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -1951,8 +1940,8 @@ def test_analytics_service_host_with_port(transport_name): ], ) def test_analytics_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = AnalyticsServiceClient( credentials=creds1, transport=transport_name, @@ -2016,7 +2005,7 @@ def test_analytics_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2094,7 +2083,7 @@ def test_analytics_service_transport_channel_mtls_with_adc(transport_class): def test_analytics_service_grpc_lro_client(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -2111,7 +2100,7 @@ def test_analytics_service_grpc_lro_client(): def test_analytics_service_grpc_lro_async_client(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -2236,7 +2225,7 @@ def test_client_with_default_client_info(): transports.AnalyticsServiceTransport, "_prep_wrapped_messages" ) as prep: client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2246,7 +2235,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AnalyticsServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2255,7 +2244,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2270,7 +2259,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2303,7 +2292,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -2333,7 +2322,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2363,7 +2352,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -2389,7 +2378,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2414,7 +2403,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2440,7 +2429,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2469,7 +2458,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2498,7 +2487,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2516,7 +2505,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2534,7 +2523,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2559,7 +2548,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2585,7 +2574,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2614,7 +2603,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2643,7 +2632,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2661,7 +2650,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = AnalyticsServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2685,7 +2674,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2702,7 +2691,7 @@ def test_client_ctx(): ] for transport in transports: client = AnalyticsServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_catalog_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_catalog_service.py index fb8971f69c6d..473973ab1cd1 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_catalog_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_catalog_service.py @@ -84,18 +84,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -322,7 +310,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -349,42 +337,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -395,7 +390,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_catalog_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -447,7 +442,7 @@ def test_catalog_service_client_service_account_always_use_jwt( ], ) def test_catalog_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -510,9 +505,7 @@ def test_catalog_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CatalogServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -911,20 +904,20 @@ def test_catalog_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -936,13 +929,11 @@ def test_catalog_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -958,8 +949,7 @@ def test_catalog_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1112,8 +1102,8 @@ def test_catalog_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1142,7 +1132,7 @@ def test_catalog_service_client_create_channel_credentials_file( ) def test_list_catalogs(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1172,7 +1162,7 @@ def test_list_catalogs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1189,7 +1179,7 @@ async def test_list_catalogs_async( transport: str = "grpc_asyncio", request_type=catalog_service.ListCatalogsRequest ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1224,7 +1214,7 @@ async def test_list_catalogs_async_from_dict(): def test_list_catalogs_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1254,7 +1244,7 @@ def test_list_catalogs_field_headers(): @pytest.mark.asyncio async def test_list_catalogs_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1285,7 +1275,7 @@ async def test_list_catalogs_field_headers_async(): def test_list_catalogs_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1309,7 +1299,7 @@ def test_list_catalogs_flattened(): def test_list_catalogs_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1324,7 +1314,7 @@ def test_list_catalogs_flattened_error(): @pytest.mark.asyncio async def test_list_catalogs_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1353,7 +1343,7 @@ async def test_list_catalogs_flattened_async(): @pytest.mark.asyncio async def test_list_catalogs_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1367,7 +1357,7 @@ async def test_list_catalogs_flattened_error_async(): def test_list_catalogs_pager(transport_name: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1417,7 +1407,7 @@ def test_list_catalogs_pager(transport_name: str = "grpc"): def test_list_catalogs_pages(transport_name: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1459,7 +1449,7 @@ def test_list_catalogs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_catalogs_async_pager(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1509,7 +1499,7 @@ async def test_list_catalogs_async_pager(): @pytest.mark.asyncio async def test_list_catalogs_async_pages(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1564,7 +1554,7 @@ async def test_list_catalogs_async_pages(): ) def test_update_catalog(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1596,7 +1586,7 @@ def test_update_catalog_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1613,7 +1603,7 @@ async def test_update_catalog_async( transport: str = "grpc_asyncio", request_type=catalog_service.UpdateCatalogRequest ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1650,7 +1640,7 @@ async def test_update_catalog_async_from_dict(): def test_update_catalog_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1680,7 +1670,7 @@ def test_update_catalog_field_headers(): @pytest.mark.asyncio async def test_update_catalog_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1709,7 +1699,7 @@ async def test_update_catalog_field_headers_async(): def test_update_catalog_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1737,7 +1727,7 @@ def test_update_catalog_flattened(): def test_update_catalog_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1753,7 +1743,7 @@ def test_update_catalog_flattened_error(): @pytest.mark.asyncio async def test_update_catalog_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1784,7 +1774,7 @@ async def test_update_catalog_flattened_async(): @pytest.mark.asyncio async def test_update_catalog_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1806,7 +1796,7 @@ async def test_update_catalog_flattened_error_async(): ) def test_set_default_branch(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1835,7 +1825,7 @@ def test_set_default_branch_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1855,7 +1845,7 @@ async def test_set_default_branch_async( request_type=catalog_service.SetDefaultBranchRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1887,7 +1877,7 @@ async def test_set_default_branch_async_from_dict(): def test_set_default_branch_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1919,7 +1909,7 @@ def test_set_default_branch_field_headers(): @pytest.mark.asyncio async def test_set_default_branch_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1950,7 +1940,7 @@ async def test_set_default_branch_field_headers_async(): def test_set_default_branch_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1976,7 +1966,7 @@ def test_set_default_branch_flattened(): def test_set_default_branch_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1991,7 +1981,7 @@ def test_set_default_branch_flattened_error(): @pytest.mark.asyncio async def test_set_default_branch_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2020,7 +2010,7 @@ async def test_set_default_branch_flattened_async(): @pytest.mark.asyncio async def test_set_default_branch_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2041,7 +2031,7 @@ async def test_set_default_branch_flattened_error_async(): ) def test_get_default_branch(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2075,7 +2065,7 @@ def test_get_default_branch_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2095,7 +2085,7 @@ async def test_get_default_branch_async( request_type=catalog_service.GetDefaultBranchRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2134,7 +2124,7 @@ async def test_get_default_branch_async_from_dict(): def test_get_default_branch_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2166,7 +2156,7 @@ def test_get_default_branch_field_headers(): @pytest.mark.asyncio async def test_get_default_branch_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2199,7 +2189,7 @@ async def test_get_default_branch_field_headers_async(): def test_get_default_branch_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2225,7 +2215,7 @@ def test_get_default_branch_flattened(): def test_get_default_branch_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2240,7 +2230,7 @@ def test_get_default_branch_flattened_error(): @pytest.mark.asyncio async def test_get_default_branch_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2271,7 +2261,7 @@ async def test_get_default_branch_flattened_async(): @pytest.mark.asyncio async def test_get_default_branch_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2292,7 +2282,7 @@ async def test_get_default_branch_flattened_error_async(): ) def test_get_completion_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2347,7 +2337,7 @@ def test_get_completion_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2367,7 +2357,7 @@ async def test_get_completion_config_async( request_type=catalog_service.GetCompletionConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2427,7 +2417,7 @@ async def test_get_completion_config_async_from_dict(): def test_get_completion_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2459,7 +2449,7 @@ def test_get_completion_config_field_headers(): @pytest.mark.asyncio async def test_get_completion_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2492,7 +2482,7 @@ async def test_get_completion_config_field_headers_async(): def test_get_completion_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2518,7 +2508,7 @@ def test_get_completion_config_flattened(): def test_get_completion_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2533,7 +2523,7 @@ def test_get_completion_config_flattened_error(): @pytest.mark.asyncio async def test_get_completion_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2564,7 +2554,7 @@ async def test_get_completion_config_flattened_async(): @pytest.mark.asyncio async def test_get_completion_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2585,7 +2575,7 @@ async def test_get_completion_config_flattened_error_async(): ) def test_update_completion_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2640,7 +2630,7 @@ def test_update_completion_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2660,7 +2650,7 @@ async def test_update_completion_config_async( request_type=catalog_service.UpdateCompletionConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2720,7 +2710,7 @@ async def test_update_completion_config_async_from_dict(): def test_update_completion_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2752,7 +2742,7 @@ def test_update_completion_config_field_headers(): @pytest.mark.asyncio async def test_update_completion_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2785,7 +2775,7 @@ async def test_update_completion_config_field_headers_async(): def test_update_completion_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2815,7 +2805,7 @@ def test_update_completion_config_flattened(): def test_update_completion_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2831,7 +2821,7 @@ def test_update_completion_config_flattened_error(): @pytest.mark.asyncio async def test_update_completion_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2866,7 +2856,7 @@ async def test_update_completion_config_flattened_async(): @pytest.mark.asyncio async def test_update_completion_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2888,7 +2878,7 @@ async def test_update_completion_config_flattened_error_async(): ) def test_get_attributes_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2925,7 +2915,7 @@ def test_get_attributes_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2945,7 +2935,7 @@ async def test_get_attributes_config_async( request_type=catalog_service.GetAttributesConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2987,7 +2977,7 @@ async def test_get_attributes_config_async_from_dict(): def test_get_attributes_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3019,7 +3009,7 @@ def test_get_attributes_config_field_headers(): @pytest.mark.asyncio async def test_get_attributes_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3052,7 +3042,7 @@ async def test_get_attributes_config_field_headers_async(): def test_get_attributes_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3078,7 +3068,7 @@ def test_get_attributes_config_flattened(): def test_get_attributes_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3093,7 +3083,7 @@ def test_get_attributes_config_flattened_error(): @pytest.mark.asyncio async def test_get_attributes_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3124,7 +3114,7 @@ async def test_get_attributes_config_flattened_async(): @pytest.mark.asyncio async def test_get_attributes_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3145,7 +3135,7 @@ async def test_get_attributes_config_flattened_error_async(): ) def test_update_attributes_config(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3182,7 +3172,7 @@ def test_update_attributes_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3202,7 +3192,7 @@ async def test_update_attributes_config_async( request_type=catalog_service.UpdateAttributesConfigRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3244,7 +3234,7 @@ async def test_update_attributes_config_async_from_dict(): def test_update_attributes_config_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3276,7 +3266,7 @@ def test_update_attributes_config_field_headers(): @pytest.mark.asyncio async def test_update_attributes_config_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3309,7 +3299,7 @@ async def test_update_attributes_config_field_headers_async(): def test_update_attributes_config_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3339,7 +3329,7 @@ def test_update_attributes_config_flattened(): def test_update_attributes_config_flattened_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3355,7 +3345,7 @@ def test_update_attributes_config_flattened_error(): @pytest.mark.asyncio async def test_update_attributes_config_flattened_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3390,7 +3380,7 @@ async def test_update_attributes_config_flattened_async(): @pytest.mark.asyncio async def test_update_attributes_config_flattened_error_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3412,7 +3402,7 @@ async def test_update_attributes_config_flattened_error_async(): ) def test_add_catalog_attribute(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3449,7 +3439,7 @@ def test_add_catalog_attribute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3469,7 +3459,7 @@ async def test_add_catalog_attribute_async( request_type=catalog_service.AddCatalogAttributeRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3511,7 +3501,7 @@ async def test_add_catalog_attribute_async_from_dict(): def test_add_catalog_attribute_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3543,7 +3533,7 @@ def test_add_catalog_attribute_field_headers(): @pytest.mark.asyncio async def test_add_catalog_attribute_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3583,7 +3573,7 @@ async def test_add_catalog_attribute_field_headers_async(): ) def test_remove_catalog_attribute(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3620,7 +3610,7 @@ def test_remove_catalog_attribute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3640,7 +3630,7 @@ async def test_remove_catalog_attribute_async( request_type=catalog_service.RemoveCatalogAttributeRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3682,7 +3672,7 @@ async def test_remove_catalog_attribute_async_from_dict(): def test_remove_catalog_attribute_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3714,7 +3704,7 @@ def test_remove_catalog_attribute_field_headers(): @pytest.mark.asyncio async def test_remove_catalog_attribute_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3754,7 +3744,7 @@ async def test_remove_catalog_attribute_field_headers_async(): ) def test_batch_remove_catalog_attributes(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3788,7 +3778,7 @@ def test_batch_remove_catalog_attributes_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3808,7 +3798,7 @@ async def test_batch_remove_catalog_attributes_async( request_type=catalog_service.BatchRemoveCatalogAttributesRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3847,7 +3837,7 @@ async def test_batch_remove_catalog_attributes_async_from_dict(): def test_batch_remove_catalog_attributes_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3879,7 +3869,7 @@ def test_batch_remove_catalog_attributes_field_headers(): @pytest.mark.asyncio async def test_batch_remove_catalog_attributes_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3919,7 +3909,7 @@ async def test_batch_remove_catalog_attributes_field_headers_async(): ) def test_replace_catalog_attribute(request_type, transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3956,7 +3946,7 @@ def test_replace_catalog_attribute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3976,7 +3966,7 @@ async def test_replace_catalog_attribute_async( request_type=catalog_service.ReplaceCatalogAttributeRequest, ): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4018,7 +4008,7 @@ async def test_replace_catalog_attribute_async_from_dict(): def test_replace_catalog_attribute_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4050,7 +4040,7 @@ def test_replace_catalog_attribute_field_headers(): @pytest.mark.asyncio async def test_replace_catalog_attribute_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4090,7 +4080,7 @@ async def test_replace_catalog_attribute_field_headers_async(): ) def test_list_catalogs_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4141,7 +4131,7 @@ def test_list_catalogs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_catalogs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4150,7 +4140,7 @@ def test_list_catalogs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_catalogs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4166,7 +4156,7 @@ def test_list_catalogs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4208,7 +4198,7 @@ def test_list_catalogs_rest_required_fields( def test_list_catalogs_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_catalogs._get_unset_required_fields({}) @@ -4226,7 +4216,7 @@ def test_list_catalogs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_catalogs_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4284,7 +4274,7 @@ def test_list_catalogs_rest_bad_request( transport: str = "rest", request_type=catalog_service.ListCatalogsRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4306,7 +4296,7 @@ def test_list_catalogs_rest_bad_request( def test_list_catalogs_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4348,7 +4338,7 @@ def test_list_catalogs_rest_flattened(): def test_list_catalogs_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4363,7 +4353,7 @@ def test_list_catalogs_rest_flattened_error(transport: str = "rest"): def test_list_catalogs_rest_pager(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4433,7 +4423,7 @@ def test_list_catalogs_rest_pager(transport: str = "rest"): ) def test_update_catalog_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4579,14 +4569,14 @@ def test_update_catalog_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_catalog._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_catalog._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -4595,7 +4585,7 @@ def test_update_catalog_rest_required_fields( # verify required fields with non-default values are left alone client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4638,7 +4628,7 @@ def test_update_catalog_rest_required_fields( def test_update_catalog_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_catalog._get_unset_required_fields({}) @@ -4648,7 +4638,7 @@ def test_update_catalog_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_catalog_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4704,7 +4694,7 @@ def test_update_catalog_rest_bad_request( transport: str = "rest", request_type=catalog_service.UpdateCatalogRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4728,7 +4718,7 @@ def test_update_catalog_rest_bad_request( def test_update_catalog_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4773,7 +4763,7 @@ def test_update_catalog_rest_flattened(): def test_update_catalog_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4789,7 +4779,7 @@ def test_update_catalog_rest_flattened_error(transport: str = "rest"): def test_update_catalog_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4802,7 +4792,7 @@ def test_update_catalog_rest_error(): ) def test_set_default_branch_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4831,7 +4821,7 @@ def test_set_default_branch_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_default_branch_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -4881,7 +4871,7 @@ def test_set_default_branch_rest_bad_request( transport: str = "rest", request_type=catalog_service.SetDefaultBranchRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4903,7 +4893,7 @@ def test_set_default_branch_rest_bad_request( def test_set_default_branch_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4945,7 +4935,7 @@ def test_set_default_branch_rest_flattened(): def test_set_default_branch_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4960,7 +4950,7 @@ def test_set_default_branch_rest_flattened_error(transport: str = "rest"): def test_set_default_branch_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4973,7 +4963,7 @@ def test_set_default_branch_rest_error(): ) def test_get_default_branch_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5009,7 +4999,7 @@ def test_get_default_branch_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_default_branch_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -5067,7 +5057,7 @@ def test_get_default_branch_rest_bad_request( transport: str = "rest", request_type=catalog_service.GetDefaultBranchRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5089,7 +5079,7 @@ def test_get_default_branch_rest_bad_request( def test_get_default_branch_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5133,7 +5123,7 @@ def test_get_default_branch_rest_flattened(): def test_get_default_branch_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5148,7 +5138,7 @@ def test_get_default_branch_rest_flattened_error(transport: str = "rest"): def test_get_default_branch_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5161,7 +5151,7 @@ def test_get_default_branch_rest_error(): ) def test_get_completion_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5237,7 +5227,7 @@ def test_get_completion_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_completion_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5246,7 +5236,7 @@ def test_get_completion_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_completion_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5255,7 +5245,7 @@ def test_get_completion_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5297,7 +5287,7 @@ def test_get_completion_config_rest_required_fields( def test_get_completion_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_completion_config._get_unset_required_fields({}) @@ -5307,7 +5297,7 @@ def test_get_completion_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_completion_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -5365,7 +5355,7 @@ def test_get_completion_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.GetCompletionConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5389,7 +5379,7 @@ def test_get_completion_config_rest_bad_request( def test_get_completion_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5433,7 +5423,7 @@ def test_get_completion_config_rest_flattened(): def test_get_completion_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5448,7 +5438,7 @@ def test_get_completion_config_rest_flattened_error(transport: str = "rest"): def test_get_completion_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5461,7 +5451,7 @@ def test_get_completion_config_rest_error(): ) def test_update_completion_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5629,14 +5619,14 @@ def test_update_completion_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_completion_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_completion_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5645,7 +5635,7 @@ def test_update_completion_config_rest_required_fields( # verify required fields with non-default values are left alone client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5688,7 +5678,7 @@ def test_update_completion_config_rest_required_fields( def test_update_completion_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_completion_config._get_unset_required_fields({}) @@ -5698,7 +5688,7 @@ def test_update_completion_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_completion_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -5756,7 +5746,7 @@ def test_update_completion_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.UpdateCompletionConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5782,7 +5772,7 @@ def test_update_completion_config_rest_bad_request( def test_update_completion_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5829,7 +5819,7 @@ def test_update_completion_config_rest_flattened(): def test_update_completion_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5845,7 +5835,7 @@ def test_update_completion_config_rest_flattened_error(transport: str = "rest"): def test_update_completion_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5858,7 +5848,7 @@ def test_update_completion_config_rest_error(): ) def test_get_attributes_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5916,7 +5906,7 @@ def test_get_attributes_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_attributes_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5925,7 +5915,7 @@ def test_get_attributes_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_attributes_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5934,7 +5924,7 @@ def test_get_attributes_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5976,7 +5966,7 @@ def test_get_attributes_config_rest_required_fields( def test_get_attributes_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_attributes_config._get_unset_required_fields({}) @@ -5986,7 +5976,7 @@ def test_get_attributes_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_attributes_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6044,7 +6034,7 @@ def test_get_attributes_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.GetAttributesConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6068,7 +6058,7 @@ def test_get_attributes_config_rest_bad_request( def test_get_attributes_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6112,7 +6102,7 @@ def test_get_attributes_config_rest_flattened(): def test_get_attributes_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6127,7 +6117,7 @@ def test_get_attributes_config_rest_flattened_error(transport: str = "rest"): def test_get_attributes_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6140,7 +6130,7 @@ def test_get_attributes_config_rest_error(): ) def test_update_attributes_config_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6273,14 +6263,14 @@ def test_update_attributes_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_attributes_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_attributes_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -6289,7 +6279,7 @@ def test_update_attributes_config_rest_required_fields( # verify required fields with non-default values are left alone client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6332,7 +6322,7 @@ def test_update_attributes_config_rest_required_fields( def test_update_attributes_config_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_attributes_config._get_unset_required_fields({}) @@ -6342,7 +6332,7 @@ def test_update_attributes_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_attributes_config_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6400,7 +6390,7 @@ def test_update_attributes_config_rest_bad_request( transport: str = "rest", request_type=catalog_service.UpdateAttributesConfigRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6426,7 +6416,7 @@ def test_update_attributes_config_rest_bad_request( def test_update_attributes_config_rest_flattened(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6473,7 +6463,7 @@ def test_update_attributes_config_rest_flattened(): def test_update_attributes_config_rest_flattened_error(transport: str = "rest"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6489,7 +6479,7 @@ def test_update_attributes_config_rest_flattened_error(transport: str = "rest"): def test_update_attributes_config_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6502,7 +6492,7 @@ def test_update_attributes_config_rest_error(): ) def test_add_catalog_attribute_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6560,7 +6550,7 @@ def test_add_catalog_attribute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6569,7 +6559,7 @@ def test_add_catalog_attribute_rest_required_fields( jsonified_request["attributesConfig"] = "attributes_config_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6578,7 +6568,7 @@ def test_add_catalog_attribute_rest_required_fields( assert jsonified_request["attributesConfig"] == "attributes_config_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6621,7 +6611,7 @@ def test_add_catalog_attribute_rest_required_fields( def test_add_catalog_attribute_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_catalog_attribute._get_unset_required_fields({}) @@ -6639,7 +6629,7 @@ def test_add_catalog_attribute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_catalog_attribute_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6697,7 +6687,7 @@ def test_add_catalog_attribute_rest_bad_request( transport: str = "rest", request_type=catalog_service.AddCatalogAttributeRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6721,7 +6711,7 @@ def test_add_catalog_attribute_rest_bad_request( def test_add_catalog_attribute_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6734,7 +6724,7 @@ def test_add_catalog_attribute_rest_error(): ) def test_remove_catalog_attribute_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6793,7 +6783,7 @@ def test_remove_catalog_attribute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6803,7 +6793,7 @@ def test_remove_catalog_attribute_rest_required_fields( jsonified_request["key"] = "key_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6814,7 +6804,7 @@ def test_remove_catalog_attribute_rest_required_fields( assert jsonified_request["key"] == "key_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6857,7 +6847,7 @@ def test_remove_catalog_attribute_rest_required_fields( def test_remove_catalog_attribute_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_catalog_attribute._get_unset_required_fields({}) @@ -6875,7 +6865,7 @@ def test_remove_catalog_attribute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_catalog_attribute_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -6933,7 +6923,7 @@ def test_remove_catalog_attribute_rest_bad_request( transport: str = "rest", request_type=catalog_service.RemoveCatalogAttributeRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6957,7 +6947,7 @@ def test_remove_catalog_attribute_rest_bad_request( def test_remove_catalog_attribute_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6970,7 +6960,7 @@ def test_remove_catalog_attribute_rest_error(): ) def test_batch_remove_catalog_attributes_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7028,7 +7018,7 @@ def test_batch_remove_catalog_attributes_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).batch_remove_catalog_attributes._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7038,7 +7028,7 @@ def test_batch_remove_catalog_attributes_rest_required_fields( jsonified_request["attributeKeys"] = "attribute_keys_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).batch_remove_catalog_attributes._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7049,7 +7039,7 @@ def test_batch_remove_catalog_attributes_rest_required_fields( assert jsonified_request["attributeKeys"] == "attribute_keys_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7094,7 +7084,7 @@ def test_batch_remove_catalog_attributes_rest_required_fields( def test_batch_remove_catalog_attributes_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.batch_remove_catalog_attributes._get_unset_required_fields( @@ -7114,7 +7104,7 @@ def test_batch_remove_catalog_attributes_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_batch_remove_catalog_attributes_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -7175,7 +7165,7 @@ def test_batch_remove_catalog_attributes_rest_bad_request( request_type=catalog_service.BatchRemoveCatalogAttributesRequest, ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7199,7 +7189,7 @@ def test_batch_remove_catalog_attributes_rest_bad_request( def test_batch_remove_catalog_attributes_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7212,7 +7202,7 @@ def test_batch_remove_catalog_attributes_rest_error(): ) def test_replace_catalog_attribute_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7270,7 +7260,7 @@ def test_replace_catalog_attribute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).replace_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7279,7 +7269,7 @@ def test_replace_catalog_attribute_rest_required_fields( jsonified_request["attributesConfig"] = "attributes_config_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).replace_catalog_attribute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7288,7 +7278,7 @@ def test_replace_catalog_attribute_rest_required_fields( assert jsonified_request["attributesConfig"] == "attributes_config_value" client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7331,7 +7321,7 @@ def test_replace_catalog_attribute_rest_required_fields( def test_replace_catalog_attribute_rest_unset_required_fields(): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.replace_catalog_attribute._get_unset_required_fields({}) @@ -7349,7 +7339,7 @@ def test_replace_catalog_attribute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_replace_catalog_attribute_rest_interceptors(null_interceptor): transport = transports.CatalogServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CatalogServiceRestInterceptor(), @@ -7407,7 +7397,7 @@ def test_replace_catalog_attribute_rest_bad_request( transport: str = "rest", request_type=catalog_service.ReplaceCatalogAttributeRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7431,24 +7421,24 @@ def test_replace_catalog_attribute_rest_bad_request( def test_replace_catalog_attribute_rest_error(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CatalogServiceClient( @@ -7458,7 +7448,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7473,13 +7463,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CatalogServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CatalogServiceClient( @@ -7491,7 +7480,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CatalogServiceClient(transport=transport) assert client.transport is transport @@ -7500,13 +7489,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CatalogServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CatalogServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7523,7 +7512,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7537,7 +7526,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CatalogServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7545,7 +7534,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7557,7 +7546,7 @@ def test_catalog_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CatalogServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7569,7 +7558,7 @@ def test_catalog_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CatalogServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7614,7 +7603,7 @@ def test_catalog_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.catalog_service.transports.CatalogServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CatalogServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7633,7 +7622,7 @@ def test_catalog_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.catalog_service.transports.CatalogServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CatalogServiceTransport() adc.assert_called_once() @@ -7641,7 +7630,7 @@ def test_catalog_service_base_transport_with_adc(): def test_catalog_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CatalogServiceClient() adc.assert_called_once_with( scopes=None, @@ -7661,7 +7650,7 @@ def test_catalog_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7708,7 +7697,7 @@ def test_catalog_service_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7736,7 +7725,7 @@ def test_catalog_service_transport_create_channel(transport_class, grpc_helpers) ], ) def test_catalog_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7774,7 +7763,7 @@ def test_catalog_service_grpc_transport_client_cert_source_for_mtls(transport_cl def test_catalog_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7794,7 +7783,7 @@ def test_catalog_service_http_transport_client_cert_source_for_mtls(): ) def test_catalog_service_host_no_port(transport_name): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -7817,7 +7806,7 @@ def test_catalog_service_host_no_port(transport_name): ) def test_catalog_service_host_with_port(transport_name): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -7837,8 +7826,8 @@ def test_catalog_service_host_with_port(transport_name): ], ) def test_catalog_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CatalogServiceClient( credentials=creds1, transport=transport_name, @@ -7935,7 +7924,7 @@ def test_catalog_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -8228,7 +8217,7 @@ def test_client_with_default_client_info(): transports.CatalogServiceTransport, "_prep_wrapped_messages" ) as prep: client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8238,7 +8227,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CatalogServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8247,7 +8236,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -8262,7 +8251,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8295,7 +8284,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -8325,7 +8314,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8355,7 +8344,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -8381,7 +8370,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8406,7 +8395,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8432,7 +8421,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8461,7 +8450,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8490,7 +8479,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8508,7 +8497,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8526,7 +8515,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8551,7 +8540,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8577,7 +8566,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8606,7 +8595,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8635,7 +8624,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8653,7 +8642,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = CatalogServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8677,7 +8666,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8694,7 +8683,7 @@ def test_client_ctx(): ] for transport in transports: client = CatalogServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_completion_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_completion_service.py index 6fc26d5e4f90..b5530292738d 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_completion_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_completion_service.py @@ -88,18 +88,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -335,7 +323,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -362,42 +350,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -410,7 +405,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_completion_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -464,7 +459,7 @@ def test_completion_service_client_service_account_always_use_jwt( def test_completion_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -527,9 +522,7 @@ def test_completion_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CompletionServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -948,20 +941,20 @@ def test_completion_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -973,13 +966,11 @@ def test_completion_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -995,8 +986,7 @@ def test_completion_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1154,8 +1144,8 @@ def test_completion_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1184,7 +1174,7 @@ def test_completion_service_client_create_channel_credentials_file( ) def test_complete_query(request_type, transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1214,7 +1204,7 @@ def test_complete_query_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1232,7 +1222,7 @@ async def test_complete_query_async( request_type=completion_service.CompleteQueryRequest, ): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1267,7 +1257,7 @@ async def test_complete_query_async_from_dict(): def test_complete_query_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1297,7 +1287,7 @@ def test_complete_query_field_headers(): @pytest.mark.asyncio async def test_complete_query_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1335,7 +1325,7 @@ async def test_complete_query_field_headers_async(): ) def test_import_completion_data(request_type, transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1364,7 +1354,7 @@ def test_import_completion_data_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1384,7 +1374,7 @@ async def test_import_completion_data_async( request_type=import_config.ImportCompletionDataRequest, ): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1418,7 +1408,7 @@ async def test_import_completion_data_async_from_dict(): def test_import_completion_data_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1450,7 +1440,7 @@ def test_import_completion_data_field_headers(): @pytest.mark.asyncio async def test_import_completion_data_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1490,7 +1480,7 @@ async def test_import_completion_data_field_headers_async(): ) def test_complete_query_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1543,7 +1533,7 @@ def test_complete_query_rest_required_fields( assert "query" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).complete_query._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1555,7 +1545,7 @@ def test_complete_query_rest_required_fields( jsonified_request["query"] = "query_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).complete_query._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -1578,7 +1568,7 @@ def test_complete_query_rest_required_fields( assert jsonified_request["query"] == "query_value" client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1626,7 +1616,7 @@ def test_complete_query_rest_required_fields( def test_complete_query_rest_unset_required_fields(): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.complete_query._get_unset_required_fields({}) @@ -1654,7 +1644,7 @@ def test_complete_query_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_complete_query_rest_interceptors(null_interceptor): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CompletionServiceRestInterceptor(), @@ -1712,7 +1702,7 @@ def test_complete_query_rest_bad_request( transport: str = "rest", request_type=completion_service.CompleteQueryRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1734,7 +1724,7 @@ def test_complete_query_rest_bad_request( def test_complete_query_rest_error(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -1747,7 +1737,7 @@ def test_complete_query_rest_error(): ) def test_import_completion_data_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1793,7 +1783,7 @@ def test_import_completion_data_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_completion_data._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1802,7 +1792,7 @@ def test_import_completion_data_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_completion_data._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1811,7 +1801,7 @@ def test_import_completion_data_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1851,7 +1841,7 @@ def test_import_completion_data_rest_required_fields( def test_import_completion_data_rest_unset_required_fields(): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_completion_data._get_unset_required_fields({}) @@ -1869,7 +1859,7 @@ def test_import_completion_data_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_completion_data_rest_interceptors(null_interceptor): transport = transports.CompletionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CompletionServiceRestInterceptor(), @@ -1929,7 +1919,7 @@ def test_import_completion_data_rest_bad_request( transport: str = "rest", request_type=import_config.ImportCompletionDataRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1951,24 +1941,24 @@ def test_import_completion_data_rest_bad_request( def test_import_completion_data_rest_error(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CompletionServiceClient( @@ -1978,7 +1968,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1993,13 +1983,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CompletionServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CompletionServiceClient( @@ -2011,7 +2000,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CompletionServiceClient(transport=transport) assert client.transport is transport @@ -2020,13 +2009,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CompletionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CompletionServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -2043,7 +2032,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -2057,7 +2046,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CompletionServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -2065,7 +2054,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -2077,7 +2066,7 @@ def test_completion_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CompletionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -2089,7 +2078,7 @@ def test_completion_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CompletionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -2129,7 +2118,7 @@ def test_completion_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.completion_service.transports.CompletionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CompletionServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -2148,7 +2137,7 @@ def test_completion_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.completion_service.transports.CompletionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CompletionServiceTransport() adc.assert_called_once() @@ -2156,7 +2145,7 @@ def test_completion_service_base_transport_with_adc(): def test_completion_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CompletionServiceClient() adc.assert_called_once_with( scopes=None, @@ -2176,7 +2165,7 @@ def test_completion_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2223,7 +2212,7 @@ def test_completion_service_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2251,7 +2240,7 @@ def test_completion_service_transport_create_channel(transport_class, grpc_helpe ], ) def test_completion_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2289,7 +2278,7 @@ def test_completion_service_grpc_transport_client_cert_source_for_mtls(transport def test_completion_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2301,7 +2290,7 @@ def test_completion_service_http_transport_client_cert_source_for_mtls(): def test_completion_service_rest_lro_client(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -2326,7 +2315,7 @@ def test_completion_service_rest_lro_client(): ) def test_completion_service_host_no_port(transport_name): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -2349,7 +2338,7 @@ def test_completion_service_host_no_port(transport_name): ) def test_completion_service_host_with_port(transport_name): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -2369,8 +2358,8 @@ def test_completion_service_host_with_port(transport_name): ], ) def test_completion_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CompletionServiceClient( credentials=creds1, transport=transport_name, @@ -2437,7 +2426,7 @@ def test_completion_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2515,7 +2504,7 @@ def test_completion_service_transport_channel_mtls_with_adc(transport_class): def test_completion_service_grpc_lro_client(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -2532,7 +2521,7 @@ def test_completion_service_grpc_lro_client(): def test_completion_service_grpc_lro_async_client(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -2683,7 +2672,7 @@ def test_client_with_default_client_info(): transports.CompletionServiceTransport, "_prep_wrapped_messages" ) as prep: client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2693,7 +2682,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CompletionServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2702,7 +2691,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2717,7 +2706,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2750,7 +2739,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -2780,7 +2769,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2810,7 +2799,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -2836,7 +2825,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2861,7 +2850,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2887,7 +2876,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2916,7 +2905,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2945,7 +2934,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2963,7 +2952,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2981,7 +2970,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3006,7 +2995,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3032,7 +3021,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3061,7 +3050,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3090,7 +3079,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3108,7 +3097,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = CompletionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3132,7 +3121,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3149,7 +3138,7 @@ def test_client_ctx(): ] for transport in transports: client = CompletionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_control_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_control_service.py index 66d603d33f53..a58ae9718879 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_control_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_control_service.py @@ -84,18 +84,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -322,7 +310,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -349,42 +337,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -395,7 +390,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_control_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -447,7 +442,7 @@ def test_control_service_client_service_account_always_use_jwt( ], ) def test_control_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -510,9 +505,7 @@ def test_control_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ControlServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -911,20 +904,20 @@ def test_control_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -936,13 +929,11 @@ def test_control_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -958,8 +949,7 @@ def test_control_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1112,8 +1102,8 @@ def test_control_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1142,7 +1132,7 @@ def test_control_service_client_create_channel_credentials_file( ) def test_create_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1186,7 +1176,7 @@ def test_create_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1203,7 +1193,7 @@ async def test_create_control_async( transport: str = "grpc_asyncio", request_type=control_service.CreateControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1252,7 +1242,7 @@ async def test_create_control_async_from_dict(): def test_create_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1282,7 +1272,7 @@ def test_create_control_field_headers(): @pytest.mark.asyncio async def test_create_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1311,7 +1301,7 @@ async def test_create_control_field_headers_async(): def test_create_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1355,7 +1345,7 @@ def test_create_control_flattened(): def test_create_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1378,7 +1368,7 @@ def test_create_control_flattened_error(): @pytest.mark.asyncio async def test_create_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1425,7 +1415,7 @@ async def test_create_control_flattened_async(): @pytest.mark.asyncio async def test_create_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1454,7 +1444,7 @@ async def test_create_control_flattened_error_async(): ) def test_delete_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1481,7 +1471,7 @@ def test_delete_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1498,7 +1488,7 @@ async def test_delete_control_async( transport: str = "grpc_asyncio", request_type=control_service.DeleteControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1528,7 +1518,7 @@ async def test_delete_control_async_from_dict(): def test_delete_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1558,7 +1548,7 @@ def test_delete_control_field_headers(): @pytest.mark.asyncio async def test_delete_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1587,7 +1577,7 @@ async def test_delete_control_field_headers_async(): def test_delete_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1611,7 +1601,7 @@ def test_delete_control_flattened(): def test_delete_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1626,7 +1616,7 @@ def test_delete_control_flattened_error(): @pytest.mark.asyncio async def test_delete_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1653,7 +1643,7 @@ async def test_delete_control_flattened_async(): @pytest.mark.asyncio async def test_delete_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1674,7 +1664,7 @@ async def test_delete_control_flattened_error_async(): ) def test_update_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1718,7 +1708,7 @@ def test_update_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1735,7 +1725,7 @@ async def test_update_control_async( transport: str = "grpc_asyncio", request_type=control_service.UpdateControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1784,7 +1774,7 @@ async def test_update_control_async_from_dict(): def test_update_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1814,7 +1804,7 @@ def test_update_control_field_headers(): @pytest.mark.asyncio async def test_update_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1843,7 +1833,7 @@ async def test_update_control_field_headers_async(): def test_update_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1883,7 +1873,7 @@ def test_update_control_flattened(): def test_update_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1905,7 +1895,7 @@ def test_update_control_flattened_error(): @pytest.mark.asyncio async def test_update_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1948,7 +1938,7 @@ async def test_update_control_flattened_async(): @pytest.mark.asyncio async def test_update_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1976,7 +1966,7 @@ async def test_update_control_flattened_error_async(): ) def test_get_control(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2020,7 +2010,7 @@ def test_get_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2037,7 +2027,7 @@ async def test_get_control_async( transport: str = "grpc_asyncio", request_type=control_service.GetControlRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2086,7 +2076,7 @@ async def test_get_control_async_from_dict(): def test_get_control_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2116,7 +2106,7 @@ def test_get_control_field_headers(): @pytest.mark.asyncio async def test_get_control_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2145,7 +2135,7 @@ async def test_get_control_field_headers_async(): def test_get_control_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2169,7 +2159,7 @@ def test_get_control_flattened(): def test_get_control_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2184,7 +2174,7 @@ def test_get_control_flattened_error(): @pytest.mark.asyncio async def test_get_control_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2211,7 +2201,7 @@ async def test_get_control_flattened_async(): @pytest.mark.asyncio async def test_get_control_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2232,7 +2222,7 @@ async def test_get_control_flattened_error_async(): ) def test_list_controls(request_type, transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2262,7 +2252,7 @@ def test_list_controls_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2279,7 +2269,7 @@ async def test_list_controls_async( transport: str = "grpc_asyncio", request_type=control_service.ListControlsRequest ): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2314,7 +2304,7 @@ async def test_list_controls_async_from_dict(): def test_list_controls_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2344,7 +2334,7 @@ def test_list_controls_field_headers(): @pytest.mark.asyncio async def test_list_controls_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2375,7 +2365,7 @@ async def test_list_controls_field_headers_async(): def test_list_controls_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2399,7 +2389,7 @@ def test_list_controls_flattened(): def test_list_controls_flattened_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2414,7 +2404,7 @@ def test_list_controls_flattened_error(): @pytest.mark.asyncio async def test_list_controls_flattened_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2443,7 +2433,7 @@ async def test_list_controls_flattened_async(): @pytest.mark.asyncio async def test_list_controls_flattened_error_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2457,7 +2447,7 @@ async def test_list_controls_flattened_error_async(): def test_list_controls_pager(transport_name: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2507,7 +2497,7 @@ def test_list_controls_pager(transport_name: str = "grpc"): def test_list_controls_pages(transport_name: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2549,7 +2539,7 @@ def test_list_controls_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_controls_async_pager(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2599,7 +2589,7 @@ async def test_list_controls_async_pager(): @pytest.mark.asyncio async def test_list_controls_async_pages(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2654,7 +2644,7 @@ async def test_list_controls_async_pages(): ) def test_create_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2865,7 +2855,7 @@ def test_create_control_rest_required_fields( assert "controlId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2877,7 +2867,7 @@ def test_create_control_rest_required_fields( jsonified_request["controlId"] = "control_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_control._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("control_id",)) @@ -2890,7 +2880,7 @@ def test_create_control_rest_required_fields( assert jsonified_request["controlId"] == "control_id_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2939,7 +2929,7 @@ def test_create_control_rest_required_fields( def test_create_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_control._get_unset_required_fields({}) @@ -2958,7 +2948,7 @@ def test_create_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -3014,7 +3004,7 @@ def test_create_control_rest_bad_request( transport: str = "rest", request_type=control_service.CreateControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3036,7 +3026,7 @@ def test_create_control_rest_bad_request( def test_create_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3088,7 +3078,7 @@ def test_create_control_rest_flattened(): def test_create_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3111,7 +3101,7 @@ def test_create_control_rest_flattened_error(transport: str = "rest"): def test_create_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3124,7 +3114,7 @@ def test_create_control_rest_error(): ) def test_delete_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3172,7 +3162,7 @@ def test_delete_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3181,7 +3171,7 @@ def test_delete_control_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3190,7 +3180,7 @@ def test_delete_control_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3229,7 +3219,7 @@ def test_delete_control_rest_required_fields( def test_delete_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_control._get_unset_required_fields({}) @@ -3239,7 +3229,7 @@ def test_delete_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -3289,7 +3279,7 @@ def test_delete_control_rest_bad_request( transport: str = "rest", request_type=control_service.DeleteControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3313,7 +3303,7 @@ def test_delete_control_rest_bad_request( def test_delete_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3355,7 +3345,7 @@ def test_delete_control_rest_flattened(): def test_delete_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3370,7 +3360,7 @@ def test_delete_control_rest_flattened_error(transport: str = "rest"): def test_delete_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3383,7 +3373,7 @@ def test_delete_control_rest_error(): ) def test_update_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3595,14 +3585,14 @@ def test_update_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_control._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -3611,7 +3601,7 @@ def test_update_control_rest_required_fields( # verify required fields with non-default values are left alone client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3654,7 +3644,7 @@ def test_update_control_rest_required_fields( def test_update_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_control._get_unset_required_fields({}) @@ -3664,7 +3654,7 @@ def test_update_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -3720,7 +3710,7 @@ def test_update_control_rest_bad_request( transport: str = "rest", request_type=control_service.UpdateControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3746,7 +3736,7 @@ def test_update_control_rest_bad_request( def test_update_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3799,7 +3789,7 @@ def test_update_control_rest_flattened(): def test_update_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3821,7 +3811,7 @@ def test_update_control_rest_flattened_error(transport: str = "rest"): def test_update_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3834,7 +3824,7 @@ def test_update_control_rest_error(): ) def test_get_control_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3901,7 +3891,7 @@ def test_get_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3910,7 +3900,7 @@ def test_get_control_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3919,7 +3909,7 @@ def test_get_control_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3961,7 +3951,7 @@ def test_get_control_rest_required_fields( def test_get_control_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_control._get_unset_required_fields({}) @@ -3971,7 +3961,7 @@ def test_get_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_control_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -4027,7 +4017,7 @@ def test_get_control_rest_bad_request( transport: str = "rest", request_type=control_service.GetControlRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4051,7 +4041,7 @@ def test_get_control_rest_bad_request( def test_get_control_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4095,7 +4085,7 @@ def test_get_control_rest_flattened(): def test_get_control_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4110,7 +4100,7 @@ def test_get_control_rest_flattened_error(transport: str = "rest"): def test_get_control_rest_error(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4123,7 +4113,7 @@ def test_get_control_rest_error(): ) def test_list_controls_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4174,7 +4164,7 @@ def test_list_controls_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_controls._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4183,7 +4173,7 @@ def test_list_controls_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_controls._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4200,7 +4190,7 @@ def test_list_controls_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4242,7 +4232,7 @@ def test_list_controls_rest_required_fields( def test_list_controls_rest_unset_required_fields(): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_controls._get_unset_required_fields({}) @@ -4261,7 +4251,7 @@ def test_list_controls_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_controls_rest_interceptors(null_interceptor): transport = transports.ControlServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ControlServiceRestInterceptor(), @@ -4319,7 +4309,7 @@ def test_list_controls_rest_bad_request( transport: str = "rest", request_type=control_service.ListControlsRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4341,7 +4331,7 @@ def test_list_controls_rest_bad_request( def test_list_controls_rest_flattened(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4385,7 +4375,7 @@ def test_list_controls_rest_flattened(): def test_list_controls_rest_flattened_error(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4400,7 +4390,7 @@ def test_list_controls_rest_flattened_error(transport: str = "rest"): def test_list_controls_rest_pager(transport: str = "rest"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4466,17 +4456,17 @@ def test_list_controls_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ControlServiceClient( @@ -4486,7 +4476,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -4501,13 +4491,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ControlServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ControlServiceClient( @@ -4519,7 +4508,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ControlServiceClient(transport=transport) assert client.transport is transport @@ -4528,13 +4517,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ControlServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ControlServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -4551,7 +4540,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -4565,7 +4554,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ControlServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -4573,7 +4562,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -4585,7 +4574,7 @@ def test_control_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ControlServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -4597,7 +4586,7 @@ def test_control_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ControlServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -4635,7 +4624,7 @@ def test_control_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.control_service.transports.ControlServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ControlServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -4654,7 +4643,7 @@ def test_control_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.control_service.transports.ControlServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ControlServiceTransport() adc.assert_called_once() @@ -4662,7 +4651,7 @@ def test_control_service_base_transport_with_adc(): def test_control_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ControlServiceClient() adc.assert_called_once_with( scopes=None, @@ -4682,7 +4671,7 @@ def test_control_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -4729,7 +4718,7 @@ def test_control_service_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -4757,7 +4746,7 @@ def test_control_service_transport_create_channel(transport_class, grpc_helpers) ], ) def test_control_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -4795,7 +4784,7 @@ def test_control_service_grpc_transport_client_cert_source_for_mtls(transport_cl def test_control_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -4815,7 +4804,7 @@ def test_control_service_http_transport_client_cert_source_for_mtls(): ) def test_control_service_host_no_port(transport_name): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -4838,7 +4827,7 @@ def test_control_service_host_no_port(transport_name): ) def test_control_service_host_with_port(transport_name): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -4858,8 +4847,8 @@ def test_control_service_host_with_port(transport_name): ], ) def test_control_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ControlServiceClient( credentials=creds1, transport=transport_name, @@ -4935,7 +4924,7 @@ def test_control_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -5176,7 +5165,7 @@ def test_client_with_default_client_info(): transports.ControlServiceTransport, "_prep_wrapped_messages" ) as prep: client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5186,7 +5175,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ControlServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5195,7 +5184,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -5210,7 +5199,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5243,7 +5232,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -5273,7 +5262,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5303,7 +5292,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -5329,7 +5318,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5354,7 +5343,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5380,7 +5369,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5409,7 +5398,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5438,7 +5427,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -5456,7 +5445,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -5474,7 +5463,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5499,7 +5488,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5525,7 +5514,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5554,7 +5543,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5583,7 +5572,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -5601,7 +5590,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ControlServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -5625,7 +5614,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -5642,7 +5631,7 @@ def test_client_ctx(): ] for transport in transports: client = ControlServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_model_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_model_service.py index 988cb7d76eab..9c3bdf75da98 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_model_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_model_service.py @@ -93,18 +93,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -316,7 +304,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -343,42 +331,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -389,7 +384,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_model_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -441,7 +436,7 @@ def test_model_service_client_service_account_always_use_jwt( ], ) def test_model_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -504,9 +499,7 @@ def test_model_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ModelServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -899,20 +892,20 @@ def test_model_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -924,13 +917,11 @@ def test_model_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -946,8 +937,7 @@ def test_model_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1098,8 +1088,8 @@ def test_model_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1128,7 +1118,7 @@ def test_model_service_client_create_channel_credentials_file( ) def test_create_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1155,7 +1145,7 @@ def test_create_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1172,7 +1162,7 @@ async def test_create_model_async( transport: str = "grpc_asyncio", request_type=model_service.CreateModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1204,7 +1194,7 @@ async def test_create_model_async_from_dict(): def test_create_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1234,7 +1224,7 @@ def test_create_model_field_headers(): @pytest.mark.asyncio async def test_create_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1265,7 +1255,7 @@ async def test_create_model_field_headers_async(): def test_create_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1293,7 +1283,7 @@ def test_create_model_flattened(): def test_create_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1309,7 +1299,7 @@ def test_create_model_flattened_error(): @pytest.mark.asyncio async def test_create_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1342,7 +1332,7 @@ async def test_create_model_flattened_async(): @pytest.mark.asyncio async def test_create_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1364,7 +1354,7 @@ async def test_create_model_flattened_error_async(): ) def test_get_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1418,7 +1408,7 @@ def test_get_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1435,7 +1425,7 @@ async def test_get_model_async( transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1494,7 +1484,7 @@ async def test_get_model_async_from_dict(): def test_get_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1524,7 +1514,7 @@ def test_get_model_field_headers(): @pytest.mark.asyncio async def test_get_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1553,7 +1543,7 @@ async def test_get_model_field_headers_async(): def test_get_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1577,7 +1567,7 @@ def test_get_model_flattened(): def test_get_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1592,7 +1582,7 @@ def test_get_model_flattened_error(): @pytest.mark.asyncio async def test_get_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1619,7 +1609,7 @@ async def test_get_model_flattened_async(): @pytest.mark.asyncio async def test_get_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1640,7 +1630,7 @@ async def test_get_model_flattened_error_async(): ) def test_pause_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1694,7 +1684,7 @@ def test_pause_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1711,7 +1701,7 @@ async def test_pause_model_async( transport: str = "grpc_asyncio", request_type=model_service.PauseModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1770,7 +1760,7 @@ async def test_pause_model_async_from_dict(): def test_pause_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1800,7 +1790,7 @@ def test_pause_model_field_headers(): @pytest.mark.asyncio async def test_pause_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1829,7 +1819,7 @@ async def test_pause_model_field_headers_async(): def test_pause_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1853,7 +1843,7 @@ def test_pause_model_flattened(): def test_pause_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1868,7 +1858,7 @@ def test_pause_model_flattened_error(): @pytest.mark.asyncio async def test_pause_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1895,7 +1885,7 @@ async def test_pause_model_flattened_async(): @pytest.mark.asyncio async def test_pause_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1916,7 +1906,7 @@ async def test_pause_model_flattened_error_async(): ) def test_resume_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1970,7 +1960,7 @@ def test_resume_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1987,7 +1977,7 @@ async def test_resume_model_async( transport: str = "grpc_asyncio", request_type=model_service.ResumeModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2046,7 +2036,7 @@ async def test_resume_model_async_from_dict(): def test_resume_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2076,7 +2066,7 @@ def test_resume_model_field_headers(): @pytest.mark.asyncio async def test_resume_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2105,7 +2095,7 @@ async def test_resume_model_field_headers_async(): def test_resume_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2129,7 +2119,7 @@ def test_resume_model_flattened(): def test_resume_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2144,7 +2134,7 @@ def test_resume_model_flattened_error(): @pytest.mark.asyncio async def test_resume_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2171,7 +2161,7 @@ async def test_resume_model_flattened_async(): @pytest.mark.asyncio async def test_resume_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2192,7 +2182,7 @@ async def test_resume_model_flattened_error_async(): ) def test_delete_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2219,7 +2209,7 @@ def test_delete_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2236,7 +2226,7 @@ async def test_delete_model_async( transport: str = "grpc_asyncio", request_type=model_service.DeleteModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2266,7 +2256,7 @@ async def test_delete_model_async_from_dict(): def test_delete_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2296,7 +2286,7 @@ def test_delete_model_field_headers(): @pytest.mark.asyncio async def test_delete_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2325,7 +2315,7 @@ async def test_delete_model_field_headers_async(): def test_delete_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2349,7 +2339,7 @@ def test_delete_model_flattened(): def test_delete_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2364,7 +2354,7 @@ def test_delete_model_flattened_error(): @pytest.mark.asyncio async def test_delete_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2391,7 +2381,7 @@ async def test_delete_model_flattened_async(): @pytest.mark.asyncio async def test_delete_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2412,7 +2402,7 @@ async def test_delete_model_flattened_error_async(): ) def test_list_models(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2442,7 +2432,7 @@ def test_list_models_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2459,7 +2449,7 @@ async def test_list_models_async( transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2494,7 +2484,7 @@ async def test_list_models_async_from_dict(): def test_list_models_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2524,7 +2514,7 @@ def test_list_models_field_headers(): @pytest.mark.asyncio async def test_list_models_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2555,7 +2545,7 @@ async def test_list_models_field_headers_async(): def test_list_models_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2579,7 +2569,7 @@ def test_list_models_flattened(): def test_list_models_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2594,7 +2584,7 @@ def test_list_models_flattened_error(): @pytest.mark.asyncio async def test_list_models_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2623,7 +2613,7 @@ async def test_list_models_flattened_async(): @pytest.mark.asyncio async def test_list_models_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2637,7 +2627,7 @@ async def test_list_models_flattened_error_async(): def test_list_models_pager(transport_name: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2687,7 +2677,7 @@ def test_list_models_pager(transport_name: str = "grpc"): def test_list_models_pages(transport_name: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2729,7 +2719,7 @@ def test_list_models_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_models_async_pager(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2779,7 +2769,7 @@ async def test_list_models_async_pager(): @pytest.mark.asyncio async def test_list_models_async_pages(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2834,7 +2824,7 @@ async def test_list_models_async_pages(): ) def test_update_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2888,7 +2878,7 @@ def test_update_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2905,7 +2895,7 @@ async def test_update_model_async( transport: str = "grpc_asyncio", request_type=model_service.UpdateModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2964,7 +2954,7 @@ async def test_update_model_async_from_dict(): def test_update_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2994,7 +2984,7 @@ def test_update_model_field_headers(): @pytest.mark.asyncio async def test_update_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3023,7 +3013,7 @@ async def test_update_model_field_headers_async(): def test_update_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3051,7 +3041,7 @@ def test_update_model_flattened(): def test_update_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3067,7 +3057,7 @@ def test_update_model_flattened_error(): @pytest.mark.asyncio async def test_update_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3098,7 +3088,7 @@ async def test_update_model_flattened_async(): @pytest.mark.asyncio async def test_update_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3120,7 +3110,7 @@ async def test_update_model_flattened_error_async(): ) def test_tune_model(request_type, transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3147,7 +3137,7 @@ def test_tune_model_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3164,7 +3154,7 @@ async def test_tune_model_async( transport: str = "grpc_asyncio", request_type=model_service.TuneModelRequest ): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3196,7 +3186,7 @@ async def test_tune_model_async_from_dict(): def test_tune_model_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3226,7 +3216,7 @@ def test_tune_model_field_headers(): @pytest.mark.asyncio async def test_tune_model_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3257,7 +3247,7 @@ async def test_tune_model_field_headers_async(): def test_tune_model_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3281,7 +3271,7 @@ def test_tune_model_flattened(): def test_tune_model_flattened_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3296,7 +3286,7 @@ def test_tune_model_flattened_error(): @pytest.mark.asyncio async def test_tune_model_flattened_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3325,7 +3315,7 @@ async def test_tune_model_flattened_async(): @pytest.mark.asyncio async def test_tune_model_flattened_error_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3346,7 +3336,7 @@ async def test_tune_model_flattened_error_async(): ) def test_create_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3482,7 +3472,7 @@ def test_create_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3491,7 +3481,7 @@ def test_create_model_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_model._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("dry_run",)) @@ -3502,7 +3492,7 @@ def test_create_model_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3542,7 +3532,7 @@ def test_create_model_rest_required_fields( def test_create_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_model._get_unset_required_fields({}) @@ -3560,7 +3550,7 @@ def test_create_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -3620,7 +3610,7 @@ def test_create_model_rest_bad_request( transport: str = "rest", request_type=model_service.CreateModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3642,7 +3632,7 @@ def test_create_model_rest_bad_request( def test_create_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3685,7 +3675,7 @@ def test_create_model_rest_flattened(): def test_create_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3701,7 +3691,7 @@ def test_create_model_rest_flattened_error(transport: str = "rest"): def test_create_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3714,7 +3704,7 @@ def test_create_model_rest_error(): ) def test_get_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3789,7 +3779,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3798,7 +3788,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3807,7 +3797,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3849,7 +3839,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque def test_get_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_model._get_unset_required_fields({}) @@ -3859,7 +3849,7 @@ def test_get_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -3913,7 +3903,7 @@ def test_get_model_rest_bad_request( transport: str = "rest", request_type=model_service.GetModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3937,7 +3927,7 @@ def test_get_model_rest_bad_request( def test_get_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3981,7 +3971,7 @@ def test_get_model_rest_flattened(): def test_get_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3996,7 +3986,7 @@ def test_get_model_rest_flattened_error(transport: str = "rest"): def test_get_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4009,7 +3999,7 @@ def test_get_model_rest_error(): ) def test_pause_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4084,7 +4074,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4093,7 +4083,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4102,7 +4092,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4145,7 +4135,7 @@ def test_pause_model_rest_required_fields(request_type=model_service.PauseModelR def test_pause_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.pause_model._get_unset_required_fields({}) @@ -4155,7 +4145,7 @@ def test_pause_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_pause_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -4211,7 +4201,7 @@ def test_pause_model_rest_bad_request( transport: str = "rest", request_type=model_service.PauseModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4235,7 +4225,7 @@ def test_pause_model_rest_bad_request( def test_pause_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4279,7 +4269,7 @@ def test_pause_model_rest_flattened(): def test_pause_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4294,7 +4284,7 @@ def test_pause_model_rest_flattened_error(transport: str = "rest"): def test_pause_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4307,7 +4297,7 @@ def test_pause_model_rest_error(): ) def test_resume_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4384,7 +4374,7 @@ def test_resume_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4393,7 +4383,7 @@ def test_resume_model_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4402,7 +4392,7 @@ def test_resume_model_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4445,7 +4435,7 @@ def test_resume_model_rest_required_fields( def test_resume_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.resume_model._get_unset_required_fields({}) @@ -4455,7 +4445,7 @@ def test_resume_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_resume_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -4511,7 +4501,7 @@ def test_resume_model_rest_bad_request( transport: str = "rest", request_type=model_service.ResumeModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4535,7 +4525,7 @@ def test_resume_model_rest_bad_request( def test_resume_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4579,7 +4569,7 @@ def test_resume_model_rest_flattened(): def test_resume_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4594,7 +4584,7 @@ def test_resume_model_rest_flattened_error(transport: str = "rest"): def test_resume_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4607,7 +4597,7 @@ def test_resume_model_rest_error(): ) def test_delete_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4655,7 +4645,7 @@ def test_delete_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4664,7 +4654,7 @@ def test_delete_model_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4673,7 +4663,7 @@ def test_delete_model_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4712,7 +4702,7 @@ def test_delete_model_rest_required_fields( def test_delete_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_model._get_unset_required_fields({}) @@ -4722,7 +4712,7 @@ def test_delete_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -4772,7 +4762,7 @@ def test_delete_model_rest_bad_request( transport: str = "rest", request_type=model_service.DeleteModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4796,7 +4786,7 @@ def test_delete_model_rest_bad_request( def test_delete_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4838,7 +4828,7 @@ def test_delete_model_rest_flattened(): def test_delete_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4853,7 +4843,7 @@ def test_delete_model_rest_flattened_error(transport: str = "rest"): def test_delete_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4866,7 +4856,7 @@ def test_delete_model_rest_error(): ) def test_list_models_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4915,7 +4905,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_models._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4924,7 +4914,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_models._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4940,7 +4930,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR assert jsonified_request["parent"] == "parent_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4982,7 +4972,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR def test_list_models_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_models._get_unset_required_fields({}) @@ -5000,7 +4990,7 @@ def test_list_models_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_models_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -5058,7 +5048,7 @@ def test_list_models_rest_bad_request( transport: str = "rest", request_type=model_service.ListModelsRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5080,7 +5070,7 @@ def test_list_models_rest_bad_request( def test_list_models_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5124,7 +5114,7 @@ def test_list_models_rest_flattened(): def test_list_models_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5139,7 +5129,7 @@ def test_list_models_rest_flattened_error(transport: str = "rest"): def test_list_models_rest_pager(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5209,7 +5199,7 @@ def test_list_models_rest_pager(transport: str = "rest"): ) def test_update_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5377,14 +5367,14 @@ def test_update_model_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_model._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5393,7 +5383,7 @@ def test_update_model_rest_required_fields( # verify required fields with non-default values are left alone client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5436,7 +5426,7 @@ def test_update_model_rest_required_fields( def test_update_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_model._get_unset_required_fields({}) @@ -5446,7 +5436,7 @@ def test_update_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -5502,7 +5492,7 @@ def test_update_model_rest_bad_request( transport: str = "rest", request_type=model_service.UpdateModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5528,7 +5518,7 @@ def test_update_model_rest_bad_request( def test_update_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5575,7 +5565,7 @@ def test_update_model_rest_flattened(): def test_update_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5591,7 +5581,7 @@ def test_update_model_rest_flattened_error(transport: str = "rest"): def test_update_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5604,7 +5594,7 @@ def test_update_model_rest_error(): ) def test_tune_model_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5650,7 +5640,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).tune_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5659,7 +5649,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).tune_model._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5668,7 +5658,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq assert jsonified_request["name"] == "name_value" client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5708,7 +5698,7 @@ def test_tune_model_rest_required_fields(request_type=model_service.TuneModelReq def test_tune_model_rest_unset_required_fields(): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.tune_model._get_unset_required_fields({}) @@ -5718,7 +5708,7 @@ def test_tune_model_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_tune_model_rest_interceptors(null_interceptor): transport = transports.ModelServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ModelServiceRestInterceptor(), @@ -5776,7 +5766,7 @@ def test_tune_model_rest_bad_request( transport: str = "rest", request_type=model_service.TuneModelRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5800,7 +5790,7 @@ def test_tune_model_rest_bad_request( def test_tune_model_rest_flattened(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5842,7 +5832,7 @@ def test_tune_model_rest_flattened(): def test_tune_model_rest_flattened_error(transport: str = "rest"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5857,24 +5847,24 @@ def test_tune_model_rest_flattened_error(transport: str = "rest"): def test_tune_model_rest_error(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ModelServiceClient( @@ -5884,7 +5874,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5899,13 +5889,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ModelServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ModelServiceClient( @@ -5917,7 +5906,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ModelServiceClient(transport=transport) assert client.transport is transport @@ -5926,13 +5915,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ModelServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ModelServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -5949,7 +5938,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -5963,7 +5952,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ModelServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -5971,7 +5960,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -5983,7 +5972,7 @@ def test_model_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ModelServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -5995,7 +5984,7 @@ def test_model_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ModelServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -6041,7 +6030,7 @@ def test_model_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.model_service.transports.ModelServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ModelServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -6060,7 +6049,7 @@ def test_model_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.model_service.transports.ModelServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ModelServiceTransport() adc.assert_called_once() @@ -6068,7 +6057,7 @@ def test_model_service_base_transport_with_adc(): def test_model_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ModelServiceClient() adc.assert_called_once_with( scopes=None, @@ -6088,7 +6077,7 @@ def test_model_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6135,7 +6124,7 @@ def test_model_service_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6160,7 +6149,7 @@ def test_model_service_transport_create_channel(transport_class, grpc_helpers): [transports.ModelServiceGrpcTransport, transports.ModelServiceGrpcAsyncIOTransport], ) def test_model_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6198,7 +6187,7 @@ def test_model_service_grpc_transport_client_cert_source_for_mtls(transport_clas def test_model_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6210,7 +6199,7 @@ def test_model_service_http_transport_client_cert_source_for_mtls(): def test_model_service_rest_lro_client(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -6235,7 +6224,7 @@ def test_model_service_rest_lro_client(): ) def test_model_service_host_no_port(transport_name): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -6258,7 +6247,7 @@ def test_model_service_host_no_port(transport_name): ) def test_model_service_host_with_port(transport_name): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -6278,8 +6267,8 @@ def test_model_service_host_with_port(transport_name): ], ) def test_model_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ModelServiceClient( credentials=creds1, transport=transport_name, @@ -6359,7 +6348,7 @@ def test_model_service_transport_channel_mtls_with_client_cert_source(transport_ mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6434,7 +6423,7 @@ def test_model_service_transport_channel_mtls_with_adc(transport_class): def test_model_service_grpc_lro_client(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -6451,7 +6440,7 @@ def test_model_service_grpc_lro_client(): def test_model_service_grpc_lro_async_client(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -6631,7 +6620,7 @@ def test_client_with_default_client_info(): transports.ModelServiceTransport, "_prep_wrapped_messages" ) as prep: client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6641,7 +6630,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ModelServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6650,7 +6639,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6665,7 +6654,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6698,7 +6687,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -6728,7 +6717,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6758,7 +6747,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -6784,7 +6773,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6809,7 +6798,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6835,7 +6824,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6864,7 +6853,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6893,7 +6882,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6911,7 +6900,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6929,7 +6918,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6954,7 +6943,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6980,7 +6969,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7009,7 +6998,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7038,7 +7027,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7056,7 +7045,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ModelServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7080,7 +7069,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -7097,7 +7086,7 @@ def test_client_ctx(): ] for transport in transports: client = ModelServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_prediction_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_prediction_service.py index 447d997f1f62..373acae16c68 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_prediction_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_prediction_service.py @@ -89,18 +89,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -336,7 +324,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -363,42 +351,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -411,7 +406,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_prediction_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -465,7 +460,7 @@ def test_prediction_service_client_service_account_always_use_jwt( def test_prediction_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -528,9 +523,7 @@ def test_prediction_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(PredictionServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -949,20 +942,20 @@ def test_prediction_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -974,13 +967,11 @@ def test_prediction_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -996,8 +987,7 @@ def test_prediction_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1155,8 +1145,8 @@ def test_prediction_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1185,7 +1175,7 @@ def test_prediction_service_client_create_channel_credentials_file( ) def test_predict(request_type, transport: str = "grpc"): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1219,7 +1209,7 @@ def test_predict_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1236,7 +1226,7 @@ async def test_predict_async( transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest ): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1275,7 +1265,7 @@ async def test_predict_async_from_dict(): def test_predict_field_headers(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1305,7 +1295,7 @@ def test_predict_field_headers(): @pytest.mark.asyncio async def test_predict_field_headers_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1343,7 +1333,7 @@ async def test_predict_field_headers_async(): ) def test_predict_rest(request_type): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1398,7 +1388,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).predict._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1407,7 +1397,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq jsonified_request["placement"] = "placement_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).predict._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1416,7 +1406,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq assert jsonified_request["placement"] == "placement_value" client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1459,7 +1449,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq def test_predict_rest_unset_required_fields(): transport = transports.PredictionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.predict._get_unset_required_fields({}) @@ -1477,7 +1467,7 @@ def test_predict_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_predict_rest_interceptors(null_interceptor): transport = transports.PredictionServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.PredictionServiceRestInterceptor(), @@ -1535,7 +1525,7 @@ def test_predict_rest_bad_request( transport: str = "rest", request_type=prediction_service.PredictRequest ): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1559,24 +1549,24 @@ def test_predict_rest_bad_request( def test_predict_rest_error(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = PredictionServiceClient( @@ -1586,7 +1576,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1601,13 +1591,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = PredictionServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = PredictionServiceClient( @@ -1619,7 +1608,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = PredictionServiceClient(transport=transport) assert client.transport is transport @@ -1628,13 +1617,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.PredictionServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.PredictionServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1651,7 +1640,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1665,7 +1654,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = PredictionServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1673,7 +1662,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1685,7 +1674,7 @@ def test_prediction_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.PredictionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1697,7 +1686,7 @@ def test_prediction_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.PredictionServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1731,7 +1720,7 @@ def test_prediction_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.prediction_service.transports.PredictionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PredictionServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1750,7 +1739,7 @@ def test_prediction_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.prediction_service.transports.PredictionServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PredictionServiceTransport() adc.assert_called_once() @@ -1758,7 +1747,7 @@ def test_prediction_service_base_transport_with_adc(): def test_prediction_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) PredictionServiceClient() adc.assert_called_once_with( scopes=None, @@ -1778,7 +1767,7 @@ def test_prediction_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -1825,7 +1814,7 @@ def test_prediction_service_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -1853,7 +1842,7 @@ def test_prediction_service_transport_create_channel(transport_class, grpc_helpe ], ) def test_prediction_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1891,7 +1880,7 @@ def test_prediction_service_grpc_transport_client_cert_source_for_mtls(transport def test_prediction_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -1911,7 +1900,7 @@ def test_prediction_service_http_transport_client_cert_source_for_mtls(): ) def test_prediction_service_host_no_port(transport_name): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -1934,7 +1923,7 @@ def test_prediction_service_host_no_port(transport_name): ) def test_prediction_service_host_with_port(transport_name): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -1954,8 +1943,8 @@ def test_prediction_service_host_with_port(transport_name): ], ) def test_prediction_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = PredictionServiceClient( credentials=creds1, transport=transport_name, @@ -2019,7 +2008,7 @@ def test_prediction_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2239,7 +2228,7 @@ def test_client_with_default_client_info(): transports.PredictionServiceTransport, "_prep_wrapped_messages" ) as prep: client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2249,7 +2238,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = PredictionServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2258,7 +2247,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2273,7 +2262,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2306,7 +2295,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -2336,7 +2325,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2366,7 +2355,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -2392,7 +2381,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2417,7 +2406,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2443,7 +2432,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2472,7 +2461,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2501,7 +2490,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2519,7 +2508,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2537,7 +2526,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2562,7 +2551,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2588,7 +2577,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2617,7 +2606,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2646,7 +2635,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2664,7 +2653,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = PredictionServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2688,7 +2677,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2705,7 +2694,7 @@ def test_client_ctx(): ] for transport in transports: client = PredictionServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_product_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_product_service.py index e5c8c373446c..e3229bc9dae0 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_product_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_product_service.py @@ -96,18 +96,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -334,7 +322,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -361,42 +349,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -407,7 +402,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_product_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -459,7 +454,7 @@ def test_product_service_client_service_account_always_use_jwt( ], ) def test_product_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -522,9 +517,7 @@ def test_product_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ProductServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -923,20 +916,20 @@ def test_product_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -948,13 +941,11 @@ def test_product_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -970,8 +961,7 @@ def test_product_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1124,8 +1114,8 @@ def test_product_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1154,7 +1144,7 @@ def test_product_service_client_create_channel_credentials_file( ) def test_create_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1218,7 +1208,7 @@ def test_create_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1235,7 +1225,7 @@ async def test_create_product_async( transport: str = "grpc_asyncio", request_type=product_service.CreateProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1304,7 +1294,7 @@ async def test_create_product_async_from_dict(): def test_create_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1334,7 +1324,7 @@ def test_create_product_field_headers(): @pytest.mark.asyncio async def test_create_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1363,7 +1353,7 @@ async def test_create_product_field_headers_async(): def test_create_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1397,7 +1387,7 @@ def test_create_product_flattened(): def test_create_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1416,7 +1406,7 @@ def test_create_product_flattened_error(): @pytest.mark.asyncio async def test_create_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1453,7 +1443,7 @@ async def test_create_product_flattened_async(): @pytest.mark.asyncio async def test_create_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1478,7 +1468,7 @@ async def test_create_product_flattened_error_async(): ) def test_get_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1542,7 +1532,7 @@ def test_get_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1559,7 +1549,7 @@ async def test_get_product_async( transport: str = "grpc_asyncio", request_type=product_service.GetProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1628,7 +1618,7 @@ async def test_get_product_async_from_dict(): def test_get_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1658,7 +1648,7 @@ def test_get_product_field_headers(): @pytest.mark.asyncio async def test_get_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1687,7 +1677,7 @@ async def test_get_product_field_headers_async(): def test_get_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1711,7 +1701,7 @@ def test_get_product_flattened(): def test_get_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1726,7 +1716,7 @@ def test_get_product_flattened_error(): @pytest.mark.asyncio async def test_get_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1753,7 +1743,7 @@ async def test_get_product_flattened_async(): @pytest.mark.asyncio async def test_get_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1774,7 +1764,7 @@ async def test_get_product_flattened_error_async(): ) def test_list_products(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1804,7 +1794,7 @@ def test_list_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1821,7 +1811,7 @@ async def test_list_products_async( transport: str = "grpc_asyncio", request_type=product_service.ListProductsRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1856,7 +1846,7 @@ async def test_list_products_async_from_dict(): def test_list_products_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1886,7 +1876,7 @@ def test_list_products_field_headers(): @pytest.mark.asyncio async def test_list_products_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1917,7 +1907,7 @@ async def test_list_products_field_headers_async(): def test_list_products_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1941,7 +1931,7 @@ def test_list_products_flattened(): def test_list_products_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1956,7 +1946,7 @@ def test_list_products_flattened_error(): @pytest.mark.asyncio async def test_list_products_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1985,7 +1975,7 @@ async def test_list_products_flattened_async(): @pytest.mark.asyncio async def test_list_products_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1999,7 +1989,7 @@ async def test_list_products_flattened_error_async(): def test_list_products_pager(transport_name: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2049,7 +2039,7 @@ def test_list_products_pager(transport_name: str = "grpc"): def test_list_products_pages(transport_name: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2091,7 +2081,7 @@ def test_list_products_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_products_async_pager(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2141,7 +2131,7 @@ async def test_list_products_async_pager(): @pytest.mark.asyncio async def test_list_products_async_pages(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2196,7 +2186,7 @@ async def test_list_products_async_pages(): ) def test_update_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2260,7 +2250,7 @@ def test_update_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2277,7 +2267,7 @@ async def test_update_product_async( transport: str = "grpc_asyncio", request_type=product_service.UpdateProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2346,7 +2336,7 @@ async def test_update_product_async_from_dict(): def test_update_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2376,7 +2366,7 @@ def test_update_product_field_headers(): @pytest.mark.asyncio async def test_update_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2405,7 +2395,7 @@ async def test_update_product_field_headers_async(): def test_update_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2435,7 +2425,7 @@ def test_update_product_flattened(): def test_update_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2453,7 +2443,7 @@ def test_update_product_flattened_error(): @pytest.mark.asyncio async def test_update_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2486,7 +2476,7 @@ async def test_update_product_flattened_async(): @pytest.mark.asyncio async def test_update_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2510,7 +2500,7 @@ async def test_update_product_flattened_error_async(): ) def test_delete_product(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2537,7 +2527,7 @@ def test_delete_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2554,7 +2544,7 @@ async def test_delete_product_async( transport: str = "grpc_asyncio", request_type=product_service.DeleteProductRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2584,7 +2574,7 @@ async def test_delete_product_async_from_dict(): def test_delete_product_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2614,7 +2604,7 @@ def test_delete_product_field_headers(): @pytest.mark.asyncio async def test_delete_product_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2643,7 +2633,7 @@ async def test_delete_product_field_headers_async(): def test_delete_product_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2667,7 +2657,7 @@ def test_delete_product_flattened(): def test_delete_product_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2682,7 +2672,7 @@ def test_delete_product_flattened_error(): @pytest.mark.asyncio async def test_delete_product_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2709,7 +2699,7 @@ async def test_delete_product_flattened_async(): @pytest.mark.asyncio async def test_delete_product_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2730,7 +2720,7 @@ async def test_delete_product_flattened_error_async(): ) def test_import_products(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2757,7 +2747,7 @@ def test_import_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2774,7 +2764,7 @@ async def test_import_products_async( transport: str = "grpc_asyncio", request_type=import_config.ImportProductsRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2806,7 +2796,7 @@ async def test_import_products_async_from_dict(): def test_import_products_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2836,7 +2826,7 @@ def test_import_products_field_headers(): @pytest.mark.asyncio async def test_import_products_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2874,7 +2864,7 @@ async def test_import_products_field_headers_async(): ) def test_set_inventory(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2901,7 +2891,7 @@ def test_set_inventory_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2918,7 +2908,7 @@ async def test_set_inventory_async( transport: str = "grpc_asyncio", request_type=product_service.SetInventoryRequest ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2950,7 +2940,7 @@ async def test_set_inventory_async_from_dict(): def test_set_inventory_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2980,7 +2970,7 @@ def test_set_inventory_field_headers(): @pytest.mark.asyncio async def test_set_inventory_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3011,7 +3001,7 @@ async def test_set_inventory_field_headers_async(): def test_set_inventory_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3039,7 +3029,7 @@ def test_set_inventory_flattened(): def test_set_inventory_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3055,7 +3045,7 @@ def test_set_inventory_flattened_error(): @pytest.mark.asyncio async def test_set_inventory_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3088,7 +3078,7 @@ async def test_set_inventory_flattened_async(): @pytest.mark.asyncio async def test_set_inventory_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3110,7 +3100,7 @@ async def test_set_inventory_flattened_error_async(): ) def test_add_fulfillment_places(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3139,7 +3129,7 @@ def test_add_fulfillment_places_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3159,7 +3149,7 @@ async def test_add_fulfillment_places_async( request_type=product_service.AddFulfillmentPlacesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3193,7 +3183,7 @@ async def test_add_fulfillment_places_async_from_dict(): def test_add_fulfillment_places_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3225,7 +3215,7 @@ def test_add_fulfillment_places_field_headers(): @pytest.mark.asyncio async def test_add_fulfillment_places_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3258,7 +3248,7 @@ async def test_add_fulfillment_places_field_headers_async(): def test_add_fulfillment_places_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3284,7 +3274,7 @@ def test_add_fulfillment_places_flattened(): def test_add_fulfillment_places_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3299,7 +3289,7 @@ def test_add_fulfillment_places_flattened_error(): @pytest.mark.asyncio async def test_add_fulfillment_places_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3330,7 +3320,7 @@ async def test_add_fulfillment_places_flattened_async(): @pytest.mark.asyncio async def test_add_fulfillment_places_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3351,7 +3341,7 @@ async def test_add_fulfillment_places_flattened_error_async(): ) def test_remove_fulfillment_places(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3380,7 +3370,7 @@ def test_remove_fulfillment_places_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3400,7 +3390,7 @@ async def test_remove_fulfillment_places_async( request_type=product_service.RemoveFulfillmentPlacesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3434,7 +3424,7 @@ async def test_remove_fulfillment_places_async_from_dict(): def test_remove_fulfillment_places_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3466,7 +3456,7 @@ def test_remove_fulfillment_places_field_headers(): @pytest.mark.asyncio async def test_remove_fulfillment_places_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3499,7 +3489,7 @@ async def test_remove_fulfillment_places_field_headers_async(): def test_remove_fulfillment_places_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3525,7 +3515,7 @@ def test_remove_fulfillment_places_flattened(): def test_remove_fulfillment_places_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3540,7 +3530,7 @@ def test_remove_fulfillment_places_flattened_error(): @pytest.mark.asyncio async def test_remove_fulfillment_places_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3571,7 +3561,7 @@ async def test_remove_fulfillment_places_flattened_async(): @pytest.mark.asyncio async def test_remove_fulfillment_places_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3592,7 +3582,7 @@ async def test_remove_fulfillment_places_flattened_error_async(): ) def test_add_local_inventories(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3621,7 +3611,7 @@ def test_add_local_inventories_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3641,7 +3631,7 @@ async def test_add_local_inventories_async( request_type=product_service.AddLocalInventoriesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3675,7 +3665,7 @@ async def test_add_local_inventories_async_from_dict(): def test_add_local_inventories_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3707,7 +3697,7 @@ def test_add_local_inventories_field_headers(): @pytest.mark.asyncio async def test_add_local_inventories_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3740,7 +3730,7 @@ async def test_add_local_inventories_field_headers_async(): def test_add_local_inventories_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3766,7 +3756,7 @@ def test_add_local_inventories_flattened(): def test_add_local_inventories_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3781,7 +3771,7 @@ def test_add_local_inventories_flattened_error(): @pytest.mark.asyncio async def test_add_local_inventories_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3812,7 +3802,7 @@ async def test_add_local_inventories_flattened_async(): @pytest.mark.asyncio async def test_add_local_inventories_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3833,7 +3823,7 @@ async def test_add_local_inventories_flattened_error_async(): ) def test_remove_local_inventories(request_type, transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3862,7 +3852,7 @@ def test_remove_local_inventories_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3882,7 +3872,7 @@ async def test_remove_local_inventories_async( request_type=product_service.RemoveLocalInventoriesRequest, ): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3916,7 +3906,7 @@ async def test_remove_local_inventories_async_from_dict(): def test_remove_local_inventories_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3948,7 +3938,7 @@ def test_remove_local_inventories_field_headers(): @pytest.mark.asyncio async def test_remove_local_inventories_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3981,7 +3971,7 @@ async def test_remove_local_inventories_field_headers_async(): def test_remove_local_inventories_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4007,7 +3997,7 @@ def test_remove_local_inventories_flattened(): def test_remove_local_inventories_flattened_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4022,7 +4012,7 @@ def test_remove_local_inventories_flattened_error(): @pytest.mark.asyncio async def test_remove_local_inventories_flattened_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4053,7 +4043,7 @@ async def test_remove_local_inventories_flattened_async(): @pytest.mark.asyncio async def test_remove_local_inventories_flattened_error_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4074,7 +4064,7 @@ async def test_remove_local_inventories_flattened_error_async(): ) def test_create_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4310,7 +4300,7 @@ def test_create_product_rest_required_fields( assert "productId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4322,7 +4312,7 @@ def test_create_product_rest_required_fields( jsonified_request["productId"] = "product_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_product._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("product_id",)) @@ -4335,7 +4325,7 @@ def test_create_product_rest_required_fields( assert jsonified_request["productId"] == "product_id_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4384,7 +4374,7 @@ def test_create_product_rest_required_fields( def test_create_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_product._get_unset_required_fields({}) @@ -4403,7 +4393,7 @@ def test_create_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -4459,7 +4449,7 @@ def test_create_product_rest_bad_request( transport: str = "rest", request_type=product_service.CreateProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4483,7 +4473,7 @@ def test_create_product_rest_bad_request( def test_create_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4531,7 +4521,7 @@ def test_create_product_rest_flattened(): def test_create_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4550,7 +4540,7 @@ def test_create_product_rest_flattened_error(transport: str = "rest"): def test_create_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4563,7 +4553,7 @@ def test_create_product_rest_error(): ) def test_get_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4650,7 +4640,7 @@ def test_get_product_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4659,7 +4649,7 @@ def test_get_product_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4668,7 +4658,7 @@ def test_get_product_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4710,7 +4700,7 @@ def test_get_product_rest_required_fields( def test_get_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_product._get_unset_required_fields({}) @@ -4720,7 +4710,7 @@ def test_get_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -4776,7 +4766,7 @@ def test_get_product_rest_bad_request( transport: str = "rest", request_type=product_service.GetProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4800,7 +4790,7 @@ def test_get_product_rest_bad_request( def test_get_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4844,7 +4834,7 @@ def test_get_product_rest_flattened(): def test_get_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4859,7 +4849,7 @@ def test_get_product_rest_flattened_error(transport: str = "rest"): def test_get_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4872,7 +4862,7 @@ def test_get_product_rest_error(): ) def test_list_products_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4925,7 +4915,7 @@ def test_list_products_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4934,7 +4924,7 @@ def test_list_products_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_products._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4952,7 +4942,7 @@ def test_list_products_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4994,7 +4984,7 @@ def test_list_products_rest_required_fields( def test_list_products_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_products._get_unset_required_fields({}) @@ -5014,7 +5004,7 @@ def test_list_products_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_products_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -5072,7 +5062,7 @@ def test_list_products_rest_bad_request( transport: str = "rest", request_type=product_service.ListProductsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5096,7 +5086,7 @@ def test_list_products_rest_bad_request( def test_list_products_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5140,7 +5130,7 @@ def test_list_products_rest_flattened(): def test_list_products_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5155,7 +5145,7 @@ def test_list_products_rest_flattened_error(transport: str = "rest"): def test_list_products_rest_pager(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5227,7 +5217,7 @@ def test_list_products_rest_pager(transport: str = "rest"): ) def test_update_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5462,14 +5452,14 @@ def test_update_product_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_product._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5483,7 +5473,7 @@ def test_update_product_rest_required_fields( # verify required fields with non-default values are left alone client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5526,7 +5516,7 @@ def test_update_product_rest_required_fields( def test_update_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_product._get_unset_required_fields({}) @@ -5544,7 +5534,7 @@ def test_update_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -5600,7 +5590,7 @@ def test_update_product_rest_bad_request( transport: str = "rest", request_type=product_service.UpdateProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5626,7 +5616,7 @@ def test_update_product_rest_bad_request( def test_update_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5675,7 +5665,7 @@ def test_update_product_rest_flattened(): def test_update_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5693,7 +5683,7 @@ def test_update_product_rest_flattened_error(transport: str = "rest"): def test_update_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5706,7 +5696,7 @@ def test_update_product_rest_error(): ) def test_delete_product_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5754,7 +5744,7 @@ def test_delete_product_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5763,7 +5753,7 @@ def test_delete_product_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_product._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5772,7 +5762,7 @@ def test_delete_product_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5811,7 +5801,7 @@ def test_delete_product_rest_required_fields( def test_delete_product_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_product._get_unset_required_fields({}) @@ -5821,7 +5811,7 @@ def test_delete_product_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_product_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -5871,7 +5861,7 @@ def test_delete_product_rest_bad_request( transport: str = "rest", request_type=product_service.DeleteProductRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5895,7 +5885,7 @@ def test_delete_product_rest_bad_request( def test_delete_product_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5937,7 +5927,7 @@ def test_delete_product_rest_flattened(): def test_delete_product_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5952,7 +5942,7 @@ def test_delete_product_rest_flattened_error(transport: str = "rest"): def test_delete_product_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5965,7 +5955,7 @@ def test_delete_product_rest_error(): ) def test_import_products_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6013,7 +6003,7 @@ def test_import_products_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6022,7 +6012,7 @@ def test_import_products_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_products._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6031,7 +6021,7 @@ def test_import_products_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6071,7 +6061,7 @@ def test_import_products_rest_required_fields( def test_import_products_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_products._get_unset_required_fields({}) @@ -6089,7 +6079,7 @@ def test_import_products_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_products_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6149,7 +6139,7 @@ def test_import_products_rest_bad_request( transport: str = "rest", request_type=import_config.ImportProductsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6173,7 +6163,7 @@ def test_import_products_rest_bad_request( def test_import_products_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6186,7 +6176,7 @@ def test_import_products_rest_error(): ) def test_set_inventory_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6235,21 +6225,21 @@ def test_set_inventory_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_inventory._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_inventory._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6289,7 +6279,7 @@ def test_set_inventory_rest_required_fields( def test_set_inventory_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_inventory._get_unset_required_fields({}) @@ -6299,7 +6289,7 @@ def test_set_inventory_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_inventory_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6359,7 +6349,7 @@ def test_set_inventory_rest_bad_request( transport: str = "rest", request_type=product_service.SetInventoryRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6385,7 +6375,7 @@ def test_set_inventory_rest_bad_request( def test_set_inventory_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6430,7 +6420,7 @@ def test_set_inventory_rest_flattened(): def test_set_inventory_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6446,7 +6436,7 @@ def test_set_inventory_rest_flattened_error(transport: str = "rest"): def test_set_inventory_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6459,7 +6449,7 @@ def test_set_inventory_rest_error(): ) def test_add_fulfillment_places_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6509,7 +6499,7 @@ def test_add_fulfillment_places_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6520,7 +6510,7 @@ def test_add_fulfillment_places_rest_required_fields( jsonified_request["placeIds"] = "place_ids_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6533,7 +6523,7 @@ def test_add_fulfillment_places_rest_required_fields( assert jsonified_request["placeIds"] == "place_ids_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6573,7 +6563,7 @@ def test_add_fulfillment_places_rest_required_fields( def test_add_fulfillment_places_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_fulfillment_places._get_unset_required_fields({}) @@ -6592,7 +6582,7 @@ def test_add_fulfillment_places_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_fulfillment_places_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6652,7 +6642,7 @@ def test_add_fulfillment_places_rest_bad_request( transport: str = "rest", request_type=product_service.AddFulfillmentPlacesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6676,7 +6666,7 @@ def test_add_fulfillment_places_rest_bad_request( def test_add_fulfillment_places_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6718,7 +6708,7 @@ def test_add_fulfillment_places_rest_flattened(): def test_add_fulfillment_places_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6733,7 +6723,7 @@ def test_add_fulfillment_places_rest_flattened_error(transport: str = "rest"): def test_add_fulfillment_places_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6746,7 +6736,7 @@ def test_add_fulfillment_places_rest_error(): ) def test_remove_fulfillment_places_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6796,7 +6786,7 @@ def test_remove_fulfillment_places_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6807,7 +6797,7 @@ def test_remove_fulfillment_places_rest_required_fields( jsonified_request["placeIds"] = "place_ids_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_fulfillment_places._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6820,7 +6810,7 @@ def test_remove_fulfillment_places_rest_required_fields( assert jsonified_request["placeIds"] == "place_ids_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6860,7 +6850,7 @@ def test_remove_fulfillment_places_rest_required_fields( def test_remove_fulfillment_places_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_fulfillment_places._get_unset_required_fields({}) @@ -6879,7 +6869,7 @@ def test_remove_fulfillment_places_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_fulfillment_places_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -6939,7 +6929,7 @@ def test_remove_fulfillment_places_rest_bad_request( transport: str = "rest", request_type=product_service.RemoveFulfillmentPlacesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6963,7 +6953,7 @@ def test_remove_fulfillment_places_rest_bad_request( def test_remove_fulfillment_places_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7005,7 +6995,7 @@ def test_remove_fulfillment_places_rest_flattened(): def test_remove_fulfillment_places_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7020,7 +7010,7 @@ def test_remove_fulfillment_places_rest_flattened_error(transport: str = "rest") def test_remove_fulfillment_places_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7033,7 +7023,7 @@ def test_remove_fulfillment_places_rest_error(): ) def test_add_local_inventories_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7081,7 +7071,7 @@ def test_add_local_inventories_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7090,7 +7080,7 @@ def test_add_local_inventories_rest_required_fields( jsonified_request["product"] = "product_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7099,7 +7089,7 @@ def test_add_local_inventories_rest_required_fields( assert jsonified_request["product"] == "product_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7139,7 +7129,7 @@ def test_add_local_inventories_rest_required_fields( def test_add_local_inventories_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_local_inventories._get_unset_required_fields({}) @@ -7157,7 +7147,7 @@ def test_add_local_inventories_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_local_inventories_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -7217,7 +7207,7 @@ def test_add_local_inventories_rest_bad_request( transport: str = "rest", request_type=product_service.AddLocalInventoriesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7241,7 +7231,7 @@ def test_add_local_inventories_rest_bad_request( def test_add_local_inventories_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7283,7 +7273,7 @@ def test_add_local_inventories_rest_flattened(): def test_add_local_inventories_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7298,7 +7288,7 @@ def test_add_local_inventories_rest_flattened_error(transport: str = "rest"): def test_add_local_inventories_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7311,7 +7301,7 @@ def test_add_local_inventories_rest_error(): ) def test_remove_local_inventories_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7360,7 +7350,7 @@ def test_remove_local_inventories_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7370,7 +7360,7 @@ def test_remove_local_inventories_rest_required_fields( jsonified_request["placeIds"] = "place_ids_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_local_inventories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7381,7 +7371,7 @@ def test_remove_local_inventories_rest_required_fields( assert jsonified_request["placeIds"] == "place_ids_value" client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7421,7 +7411,7 @@ def test_remove_local_inventories_rest_required_fields( def test_remove_local_inventories_rest_unset_required_fields(): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_local_inventories._get_unset_required_fields({}) @@ -7439,7 +7429,7 @@ def test_remove_local_inventories_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_local_inventories_rest_interceptors(null_interceptor): transport = transports.ProductServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ProductServiceRestInterceptor(), @@ -7499,7 +7489,7 @@ def test_remove_local_inventories_rest_bad_request( transport: str = "rest", request_type=product_service.RemoveLocalInventoriesRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7523,7 +7513,7 @@ def test_remove_local_inventories_rest_bad_request( def test_remove_local_inventories_rest_flattened(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7565,7 +7555,7 @@ def test_remove_local_inventories_rest_flattened(): def test_remove_local_inventories_rest_flattened_error(transport: str = "rest"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7580,24 +7570,24 @@ def test_remove_local_inventories_rest_flattened_error(transport: str = "rest"): def test_remove_local_inventories_rest_error(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProductServiceClient( @@ -7607,7 +7597,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7622,13 +7612,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ProductServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ProductServiceClient( @@ -7640,7 +7629,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ProductServiceClient(transport=transport) assert client.transport is transport @@ -7649,13 +7638,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ProductServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ProductServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7672,7 +7661,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7686,7 +7675,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ProductServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7694,7 +7683,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7706,7 +7695,7 @@ def test_product_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ProductServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7718,7 +7707,7 @@ def test_product_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ProductServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7767,7 +7756,7 @@ def test_product_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.product_service.transports.ProductServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProductServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7786,7 +7775,7 @@ def test_product_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.product_service.transports.ProductServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProductServiceTransport() adc.assert_called_once() @@ -7794,7 +7783,7 @@ def test_product_service_base_transport_with_adc(): def test_product_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ProductServiceClient() adc.assert_called_once_with( scopes=None, @@ -7814,7 +7803,7 @@ def test_product_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7861,7 +7850,7 @@ def test_product_service_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7889,7 +7878,7 @@ def test_product_service_transport_create_channel(transport_class, grpc_helpers) ], ) def test_product_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7927,7 +7916,7 @@ def test_product_service_grpc_transport_client_cert_source_for_mtls(transport_cl def test_product_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7939,7 +7928,7 @@ def test_product_service_http_transport_client_cert_source_for_mtls(): def test_product_service_rest_lro_client(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -7964,7 +7953,7 @@ def test_product_service_rest_lro_client(): ) def test_product_service_host_no_port(transport_name): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -7987,7 +7976,7 @@ def test_product_service_host_no_port(transport_name): ) def test_product_service_host_with_port(transport_name): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -8007,8 +7996,8 @@ def test_product_service_host_with_port(transport_name): ], ) def test_product_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ProductServiceClient( credentials=creds1, transport=transport_name, @@ -8102,7 +8091,7 @@ def test_product_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -8180,7 +8169,7 @@ def test_product_service_transport_channel_mtls_with_adc(transport_class): def test_product_service_grpc_lro_client(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -8197,7 +8186,7 @@ def test_product_service_grpc_lro_client(): def test_product_service_grpc_lro_async_client(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -8385,7 +8374,7 @@ def test_client_with_default_client_info(): transports.ProductServiceTransport, "_prep_wrapped_messages" ) as prep: client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8395,7 +8384,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ProductServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8404,7 +8393,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -8419,7 +8408,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8452,7 +8441,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -8482,7 +8471,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8512,7 +8501,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -8538,7 +8527,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8563,7 +8552,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8589,7 +8578,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8618,7 +8607,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8647,7 +8636,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8665,7 +8654,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8683,7 +8672,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8708,7 +8697,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8734,7 +8723,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8763,7 +8752,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8792,7 +8781,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8810,7 +8799,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ProductServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8834,7 +8823,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8851,7 +8840,7 @@ def test_client_ctx(): ] for transport in transports: client = ProductServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_search_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_search_service.py index b449ef71a85f..f4cffe3176ee 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_search_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_search_service.py @@ -79,18 +79,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -313,7 +301,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -340,42 +328,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -386,7 +381,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_search_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -438,7 +433,7 @@ def test_search_service_client_service_account_always_use_jwt( ], ) def test_search_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -501,9 +496,7 @@ def test_search_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(SearchServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -902,20 +895,20 @@ def test_search_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -927,13 +920,11 @@ def test_search_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -949,8 +940,7 @@ def test_search_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1103,8 +1093,8 @@ def test_search_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1133,7 +1123,7 @@ def test_search_service_client_create_channel_credentials_file( ) def test_search(request_type, transport: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1173,7 +1163,7 @@ def test_search_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1190,7 +1180,7 @@ async def test_search_async( transport: str = "grpc_asyncio", request_type=search_service.SearchRequest ): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1235,7 +1225,7 @@ async def test_search_async_from_dict(): def test_search_field_headers(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1265,7 +1255,7 @@ def test_search_field_headers(): @pytest.mark.asyncio async def test_search_field_headers_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1296,7 +1286,7 @@ async def test_search_field_headers_async(): def test_search_pager(transport_name: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1348,7 +1338,7 @@ def test_search_pager(transport_name: str = "grpc"): def test_search_pages(transport_name: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1390,7 +1380,7 @@ def test_search_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_async_pager(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1442,7 +1432,7 @@ async def test_search_async_pager(): @pytest.mark.asyncio async def test_search_async_pages(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1495,7 +1485,7 @@ async def test_search_async_pages(): ) def test_search_rest(request_type): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1557,7 +1547,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).search._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1567,7 +1557,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): jsonified_request["visitorId"] = "visitor_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).search._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1578,7 +1568,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): assert jsonified_request["visitorId"] == "visitor_id_value" client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1621,7 +1611,7 @@ def test_search_rest_required_fields(request_type=search_service.SearchRequest): def test_search_rest_unset_required_fields(): transport = transports.SearchServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.search._get_unset_required_fields({}) @@ -1639,7 +1629,7 @@ def test_search_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_search_rest_interceptors(null_interceptor): transport = transports.SearchServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SearchServiceRestInterceptor(), @@ -1695,7 +1685,7 @@ def test_search_rest_bad_request( transport: str = "rest", request_type=search_service.SearchRequest ): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1719,7 +1709,7 @@ def test_search_rest_bad_request( def test_search_rest_pager(transport: str = "rest"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1785,17 +1775,17 @@ def test_search_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SearchServiceClient( @@ -1805,7 +1795,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1820,13 +1810,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SearchServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SearchServiceClient( @@ -1838,7 +1827,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SearchServiceClient(transport=transport) assert client.transport is transport @@ -1847,13 +1836,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SearchServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SearchServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1870,7 +1859,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1884,7 +1873,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SearchServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1892,7 +1881,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1904,7 +1893,7 @@ def test_search_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SearchServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1916,7 +1905,7 @@ def test_search_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SearchServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1950,7 +1939,7 @@ def test_search_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.search_service.transports.SearchServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SearchServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1969,7 +1958,7 @@ def test_search_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.search_service.transports.SearchServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SearchServiceTransport() adc.assert_called_once() @@ -1977,7 +1966,7 @@ def test_search_service_base_transport_with_adc(): def test_search_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SearchServiceClient() adc.assert_called_once_with( scopes=None, @@ -1997,7 +1986,7 @@ def test_search_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2044,7 +2033,7 @@ def test_search_service_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2072,7 +2061,7 @@ def test_search_service_transport_create_channel(transport_class, grpc_helpers): ], ) def test_search_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2110,7 +2099,7 @@ def test_search_service_grpc_transport_client_cert_source_for_mtls(transport_cla def test_search_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2130,7 +2119,7 @@ def test_search_service_http_transport_client_cert_source_for_mtls(): ) def test_search_service_host_no_port(transport_name): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -2153,7 +2142,7 @@ def test_search_service_host_no_port(transport_name): ) def test_search_service_host_with_port(transport_name): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -2173,8 +2162,8 @@ def test_search_service_host_with_port(transport_name): ], ) def test_search_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SearchServiceClient( credentials=creds1, transport=transport_name, @@ -2236,7 +2225,7 @@ def test_search_service_transport_channel_mtls_with_client_cert_source(transport mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2545,7 +2534,7 @@ def test_client_with_default_client_info(): transports.SearchServiceTransport, "_prep_wrapped_messages" ) as prep: client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2555,7 +2544,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SearchServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2564,7 +2553,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2579,7 +2568,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2612,7 +2601,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -2642,7 +2631,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2672,7 +2661,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -2698,7 +2687,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2723,7 +2712,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2749,7 +2738,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2778,7 +2767,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2807,7 +2796,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2825,7 +2814,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -2843,7 +2832,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2868,7 +2857,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2894,7 +2883,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2923,7 +2912,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2952,7 +2941,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2970,7 +2959,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = SearchServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -2994,7 +2983,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3011,7 +3000,7 @@ def test_client_ctx(): ] for transport in transports: client = SearchServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_serving_config_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_serving_config_service.py index d8b00c357013..d8945a84ca84 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_serving_config_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_serving_config_service.py @@ -83,18 +83,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -344,7 +332,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -371,42 +359,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -419,7 +414,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_serving_config_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -473,7 +468,7 @@ def test_serving_config_service_client_service_account_always_use_jwt( def test_serving_config_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -544,9 +539,7 @@ def test_serving_config_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ServingConfigServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -965,20 +958,20 @@ def test_serving_config_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -990,13 +983,11 @@ def test_serving_config_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1012,8 +1003,7 @@ def test_serving_config_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1179,8 +1169,8 @@ def test_serving_config_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1209,7 +1199,7 @@ def test_serving_config_service_client_create_channel_credentials_file( ) def test_create_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1278,7 +1268,7 @@ def test_create_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1298,7 +1288,7 @@ async def test_create_serving_config_async( request_type=serving_config_service.CreateServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1372,7 +1362,7 @@ async def test_create_serving_config_async_from_dict(): def test_create_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1404,7 +1394,7 @@ def test_create_serving_config_field_headers(): @pytest.mark.asyncio async def test_create_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1437,7 +1427,7 @@ async def test_create_serving_config_field_headers_async(): def test_create_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1471,7 +1461,7 @@ def test_create_serving_config_flattened(): def test_create_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1488,7 +1478,7 @@ def test_create_serving_config_flattened_error(): @pytest.mark.asyncio async def test_create_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1527,7 +1517,7 @@ async def test_create_serving_config_flattened_async(): @pytest.mark.asyncio async def test_create_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1550,7 +1540,7 @@ async def test_create_serving_config_flattened_error_async(): ) def test_delete_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1579,7 +1569,7 @@ def test_delete_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1599,7 +1589,7 @@ async def test_delete_serving_config_async( request_type=serving_config_service.DeleteServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1631,7 +1621,7 @@ async def test_delete_serving_config_async_from_dict(): def test_delete_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1663,7 +1653,7 @@ def test_delete_serving_config_field_headers(): @pytest.mark.asyncio async def test_delete_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1694,7 +1684,7 @@ async def test_delete_serving_config_field_headers_async(): def test_delete_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1720,7 +1710,7 @@ def test_delete_serving_config_flattened(): def test_delete_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1735,7 +1725,7 @@ def test_delete_serving_config_flattened_error(): @pytest.mark.asyncio async def test_delete_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1764,7 +1754,7 @@ async def test_delete_serving_config_flattened_async(): @pytest.mark.asyncio async def test_delete_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1785,7 +1775,7 @@ async def test_delete_serving_config_flattened_error_async(): ) def test_update_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1854,7 +1844,7 @@ def test_update_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1874,7 +1864,7 @@ async def test_update_serving_config_async( request_type=serving_config_service.UpdateServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1948,7 +1938,7 @@ async def test_update_serving_config_async_from_dict(): def test_update_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1980,7 +1970,7 @@ def test_update_serving_config_field_headers(): @pytest.mark.asyncio async def test_update_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2013,7 +2003,7 @@ async def test_update_serving_config_field_headers_async(): def test_update_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2043,7 +2033,7 @@ def test_update_serving_config_flattened(): def test_update_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2059,7 +2049,7 @@ def test_update_serving_config_flattened_error(): @pytest.mark.asyncio async def test_update_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2094,7 +2084,7 @@ async def test_update_serving_config_flattened_async(): @pytest.mark.asyncio async def test_update_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2116,7 +2106,7 @@ async def test_update_serving_config_flattened_error_async(): ) def test_get_serving_config(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2185,7 +2175,7 @@ def test_get_serving_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2205,7 +2195,7 @@ async def test_get_serving_config_async( request_type=serving_config_service.GetServingConfigRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2279,7 +2269,7 @@ async def test_get_serving_config_async_from_dict(): def test_get_serving_config_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2311,7 +2301,7 @@ def test_get_serving_config_field_headers(): @pytest.mark.asyncio async def test_get_serving_config_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2344,7 +2334,7 @@ async def test_get_serving_config_field_headers_async(): def test_get_serving_config_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2370,7 +2360,7 @@ def test_get_serving_config_flattened(): def test_get_serving_config_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2385,7 +2375,7 @@ def test_get_serving_config_flattened_error(): @pytest.mark.asyncio async def test_get_serving_config_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2416,7 +2406,7 @@ async def test_get_serving_config_flattened_async(): @pytest.mark.asyncio async def test_get_serving_config_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2437,7 +2427,7 @@ async def test_get_serving_config_flattened_error_async(): ) def test_list_serving_configs(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2469,7 +2459,7 @@ def test_list_serving_configs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2489,7 +2479,7 @@ async def test_list_serving_configs_async( request_type=serving_config_service.ListServingConfigsRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2526,7 +2516,7 @@ async def test_list_serving_configs_async_from_dict(): def test_list_serving_configs_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2558,7 +2548,7 @@ def test_list_serving_configs_field_headers(): @pytest.mark.asyncio async def test_list_serving_configs_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2591,7 +2581,7 @@ async def test_list_serving_configs_field_headers_async(): def test_list_serving_configs_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2617,7 +2607,7 @@ def test_list_serving_configs_flattened(): def test_list_serving_configs_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2632,7 +2622,7 @@ def test_list_serving_configs_flattened_error(): @pytest.mark.asyncio async def test_list_serving_configs_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2663,7 +2653,7 @@ async def test_list_serving_configs_flattened_async(): @pytest.mark.asyncio async def test_list_serving_configs_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2677,7 +2667,7 @@ async def test_list_serving_configs_flattened_error_async(): def test_list_serving_configs_pager(transport_name: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2729,7 +2719,7 @@ def test_list_serving_configs_pager(transport_name: str = "grpc"): def test_list_serving_configs_pages(transport_name: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2773,7 +2763,7 @@ def test_list_serving_configs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_serving_configs_async_pager(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2825,7 +2815,7 @@ async def test_list_serving_configs_async_pager(): @pytest.mark.asyncio async def test_list_serving_configs_async_pages(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2882,7 +2872,7 @@ async def test_list_serving_configs_async_pages(): ) def test_add_control(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2949,7 +2939,7 @@ def test_add_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2967,7 +2957,7 @@ async def test_add_control_async( request_type=serving_config_service.AddControlRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3039,7 +3029,7 @@ async def test_add_control_async_from_dict(): def test_add_control_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3069,7 +3059,7 @@ def test_add_control_field_headers(): @pytest.mark.asyncio async def test_add_control_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3100,7 +3090,7 @@ async def test_add_control_field_headers_async(): def test_add_control_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3124,7 +3114,7 @@ def test_add_control_flattened(): def test_add_control_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3139,7 +3129,7 @@ def test_add_control_flattened_error(): @pytest.mark.asyncio async def test_add_control_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3168,7 +3158,7 @@ async def test_add_control_flattened_async(): @pytest.mark.asyncio async def test_add_control_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3189,7 +3179,7 @@ async def test_add_control_flattened_error_async(): ) def test_remove_control(request_type, transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3256,7 +3246,7 @@ def test_remove_control_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3274,7 +3264,7 @@ async def test_remove_control_async( request_type=serving_config_service.RemoveControlRequest, ): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3346,7 +3336,7 @@ async def test_remove_control_async_from_dict(): def test_remove_control_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3376,7 +3366,7 @@ def test_remove_control_field_headers(): @pytest.mark.asyncio async def test_remove_control_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3407,7 +3397,7 @@ async def test_remove_control_field_headers_async(): def test_remove_control_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3431,7 +3421,7 @@ def test_remove_control_flattened(): def test_remove_control_flattened_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3446,7 +3436,7 @@ def test_remove_control_flattened_error(): @pytest.mark.asyncio async def test_remove_control_flattened_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3475,7 +3465,7 @@ async def test_remove_control_flattened_async(): @pytest.mark.asyncio async def test_remove_control_flattened_error_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3496,7 +3486,7 @@ async def test_remove_control_flattened_error_async(): ) def test_create_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3697,7 +3687,7 @@ def test_create_serving_config_rest_required_fields( assert "servingConfigId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3709,7 +3699,7 @@ def test_create_serving_config_rest_required_fields( jsonified_request["servingConfigId"] = "serving_config_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_serving_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("serving_config_id",)) @@ -3722,7 +3712,7 @@ def test_create_serving_config_rest_required_fields( assert jsonified_request["servingConfigId"] == "serving_config_id_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3771,7 +3761,7 @@ def test_create_serving_config_rest_required_fields( def test_create_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_serving_config._get_unset_required_fields({}) @@ -3790,7 +3780,7 @@ def test_create_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -3849,7 +3839,7 @@ def test_create_serving_config_rest_bad_request( request_type=serving_config_service.CreateServingConfigRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3871,7 +3861,7 @@ def test_create_serving_config_rest_bad_request( def test_create_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3917,7 +3907,7 @@ def test_create_serving_config_rest_flattened(): def test_create_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3934,7 +3924,7 @@ def test_create_serving_config_rest_flattened_error(transport: str = "rest"): def test_create_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3947,7 +3937,7 @@ def test_create_serving_config_rest_error(): ) def test_delete_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3995,7 +3985,7 @@ def test_delete_serving_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4004,7 +3994,7 @@ def test_delete_serving_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4013,7 +4003,7 @@ def test_delete_serving_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4052,7 +4042,7 @@ def test_delete_serving_config_rest_required_fields( def test_delete_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_serving_config._get_unset_required_fields({}) @@ -4062,7 +4052,7 @@ def test_delete_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -4113,7 +4103,7 @@ def test_delete_serving_config_rest_bad_request( request_type=serving_config_service.DeleteServingConfigRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4137,7 +4127,7 @@ def test_delete_serving_config_rest_bad_request( def test_delete_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4179,7 +4169,7 @@ def test_delete_serving_config_rest_flattened(): def test_delete_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4194,7 +4184,7 @@ def test_delete_serving_config_rest_flattened_error(transport: str = "rest"): def test_delete_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4207,7 +4197,7 @@ def test_delete_serving_config_rest_error(): ) def test_update_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4409,14 +4399,14 @@ def test_update_serving_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_serving_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -4425,7 +4415,7 @@ def test_update_serving_config_rest_required_fields( # verify required fields with non-default values are left alone client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4468,7 +4458,7 @@ def test_update_serving_config_rest_required_fields( def test_update_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_serving_config._get_unset_required_fields({}) @@ -4478,7 +4468,7 @@ def test_update_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -4537,7 +4527,7 @@ def test_update_serving_config_rest_bad_request( request_type=serving_config_service.UpdateServingConfigRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4563,7 +4553,7 @@ def test_update_serving_config_rest_bad_request( def test_update_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4610,7 +4600,7 @@ def test_update_serving_config_rest_flattened(): def test_update_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4626,7 +4616,7 @@ def test_update_serving_config_rest_flattened_error(transport: str = "rest"): def test_update_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4639,7 +4629,7 @@ def test_update_serving_config_rest_error(): ) def test_get_serving_config_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4729,7 +4719,7 @@ def test_get_serving_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4738,7 +4728,7 @@ def test_get_serving_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_serving_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4747,7 +4737,7 @@ def test_get_serving_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4789,7 +4779,7 @@ def test_get_serving_config_rest_required_fields( def test_get_serving_config_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_serving_config._get_unset_required_fields({}) @@ -4799,7 +4789,7 @@ def test_get_serving_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_serving_config_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -4857,7 +4847,7 @@ def test_get_serving_config_rest_bad_request( transport: str = "rest", request_type=serving_config_service.GetServingConfigRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4881,7 +4871,7 @@ def test_get_serving_config_rest_bad_request( def test_get_serving_config_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4925,7 +4915,7 @@ def test_get_serving_config_rest_flattened(): def test_get_serving_config_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4940,7 +4930,7 @@ def test_get_serving_config_rest_flattened_error(transport: str = "rest"): def test_get_serving_config_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4953,7 +4943,7 @@ def test_get_serving_config_rest_error(): ) def test_list_serving_configs_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5006,7 +4996,7 @@ def test_list_serving_configs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_serving_configs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5015,7 +5005,7 @@ def test_list_serving_configs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_serving_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5031,7 +5021,7 @@ def test_list_serving_configs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5075,7 +5065,7 @@ def test_list_serving_configs_rest_required_fields( def test_list_serving_configs_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_serving_configs._get_unset_required_fields({}) @@ -5093,7 +5083,7 @@ def test_list_serving_configs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_serving_configs_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -5154,7 +5144,7 @@ def test_list_serving_configs_rest_bad_request( request_type=serving_config_service.ListServingConfigsRequest, ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5176,7 +5166,7 @@ def test_list_serving_configs_rest_bad_request( def test_list_serving_configs_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5222,7 +5212,7 @@ def test_list_serving_configs_rest_flattened(): def test_list_serving_configs_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5237,7 +5227,7 @@ def test_list_serving_configs_rest_flattened_error(transport: str = "rest"): def test_list_serving_configs_rest_pager(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5310,7 +5300,7 @@ def test_list_serving_configs_rest_pager(transport: str = "rest"): ) def test_add_control_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5401,7 +5391,7 @@ def test_add_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5411,7 +5401,7 @@ def test_add_control_rest_required_fields( jsonified_request["controlId"] = "control_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5422,7 +5412,7 @@ def test_add_control_rest_required_fields( assert jsonified_request["controlId"] == "control_id_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5465,7 +5455,7 @@ def test_add_control_rest_required_fields( def test_add_control_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_control._get_unset_required_fields({}) @@ -5483,7 +5473,7 @@ def test_add_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_control_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -5541,7 +5531,7 @@ def test_add_control_rest_bad_request( transport: str = "rest", request_type=serving_config_service.AddControlRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5565,7 +5555,7 @@ def test_add_control_rest_bad_request( def test_add_control_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5609,7 +5599,7 @@ def test_add_control_rest_flattened(): def test_add_control_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5624,7 +5614,7 @@ def test_add_control_rest_flattened_error(transport: str = "rest"): def test_add_control_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5637,7 +5627,7 @@ def test_add_control_rest_error(): ) def test_remove_control_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5728,7 +5718,7 @@ def test_remove_control_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5738,7 +5728,7 @@ def test_remove_control_rest_required_fields( jsonified_request["controlId"] = "control_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).remove_control._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5749,7 +5739,7 @@ def test_remove_control_rest_required_fields( assert jsonified_request["controlId"] == "control_id_value" client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5792,7 +5782,7 @@ def test_remove_control_rest_required_fields( def test_remove_control_rest_unset_required_fields(): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.remove_control._get_unset_required_fields({}) @@ -5810,7 +5800,7 @@ def test_remove_control_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_control_rest_interceptors(null_interceptor): transport = transports.ServingConfigServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServingConfigServiceRestInterceptor(), @@ -5868,7 +5858,7 @@ def test_remove_control_rest_bad_request( transport: str = "rest", request_type=serving_config_service.RemoveControlRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5892,7 +5882,7 @@ def test_remove_control_rest_bad_request( def test_remove_control_rest_flattened(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5936,7 +5926,7 @@ def test_remove_control_rest_flattened(): def test_remove_control_rest_flattened_error(transport: str = "rest"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5951,24 +5941,24 @@ def test_remove_control_rest_flattened_error(transport: str = "rest"): def test_remove_control_rest_error(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServingConfigServiceClient( @@ -5978,7 +5968,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5993,13 +5983,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ServingConfigServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServingConfigServiceClient( @@ -6011,7 +6000,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServingConfigServiceClient(transport=transport) assert client.transport is transport @@ -6020,13 +6009,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServingConfigServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServingConfigServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -6043,7 +6032,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -6057,7 +6046,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ServingConfigServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -6065,7 +6054,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -6077,7 +6066,7 @@ def test_serving_config_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServingConfigServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -6089,7 +6078,7 @@ def test_serving_config_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServingConfigServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -6129,7 +6118,7 @@ def test_serving_config_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.serving_config_service.transports.ServingConfigServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServingConfigServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -6148,7 +6137,7 @@ def test_serving_config_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.serving_config_service.transports.ServingConfigServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServingConfigServiceTransport() adc.assert_called_once() @@ -6156,7 +6145,7 @@ def test_serving_config_service_base_transport_with_adc(): def test_serving_config_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ServingConfigServiceClient() adc.assert_called_once_with( scopes=None, @@ -6176,7 +6165,7 @@ def test_serving_config_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6223,7 +6212,7 @@ def test_serving_config_service_transport_create_channel(transport_class, grpc_h ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6253,7 +6242,7 @@ def test_serving_config_service_transport_create_channel(transport_class, grpc_h def test_serving_config_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6291,7 +6280,7 @@ def test_serving_config_service_grpc_transport_client_cert_source_for_mtls( def test_serving_config_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6311,7 +6300,7 @@ def test_serving_config_service_http_transport_client_cert_source_for_mtls(): ) def test_serving_config_service_host_no_port(transport_name): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -6334,7 +6323,7 @@ def test_serving_config_service_host_no_port(transport_name): ) def test_serving_config_service_host_with_port(transport_name): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -6354,8 +6343,8 @@ def test_serving_config_service_host_with_port(transport_name): ], ) def test_serving_config_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ServingConfigServiceClient( credentials=creds1, transport=transport_name, @@ -6437,7 +6426,7 @@ def test_serving_config_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6680,7 +6669,7 @@ def test_client_with_default_client_info(): transports.ServingConfigServiceTransport, "_prep_wrapped_messages" ) as prep: client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6690,7 +6679,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServingConfigServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6699,7 +6688,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6714,7 +6703,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6747,7 +6736,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -6777,7 +6766,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6807,7 +6796,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -6833,7 +6822,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6858,7 +6847,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6884,7 +6873,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6913,7 +6902,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6942,7 +6931,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6960,7 +6949,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6978,7 +6967,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7003,7 +6992,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7029,7 +7018,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7058,7 +7047,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7087,7 +7076,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7105,7 +7094,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ServingConfigServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7129,7 +7118,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -7146,7 +7135,7 @@ def test_client_ctx(): ] for transport in transports: client = ServingConfigServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_user_event_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_user_event_service.py index 66e156259b82..6a098203d1b4 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_user_event_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_user_event_service.py @@ -102,18 +102,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -341,7 +329,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -368,42 +356,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -416,7 +411,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_user_event_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -470,7 +465,7 @@ def test_user_event_service_client_service_account_always_use_jwt( def test_user_event_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -533,9 +528,7 @@ def test_user_event_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(UserEventServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -954,20 +947,20 @@ def test_user_event_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -979,13 +972,11 @@ def test_user_event_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1001,8 +992,7 @@ def test_user_event_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1160,8 +1150,8 @@ def test_user_event_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1190,7 +1180,7 @@ def test_user_event_service_client_create_channel_credentials_file( ) def test_write_user_event(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1248,7 +1238,7 @@ def test_write_user_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1266,7 +1256,7 @@ async def test_write_user_event_async( request_type=user_event_service.WriteUserEventRequest, ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1329,7 +1319,7 @@ async def test_write_user_event_async_from_dict(): def test_write_user_event_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1359,7 +1349,7 @@ def test_write_user_event_field_headers(): @pytest.mark.asyncio async def test_write_user_event_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1397,7 +1387,7 @@ async def test_write_user_event_field_headers_async(): ) def test_collect_user_event(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1431,7 +1421,7 @@ def test_collect_user_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1451,7 +1441,7 @@ async def test_collect_user_event_async( request_type=user_event_service.CollectUserEventRequest, ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1490,7 +1480,7 @@ async def test_collect_user_event_async_from_dict(): def test_collect_user_event_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1522,7 +1512,7 @@ def test_collect_user_event_field_headers(): @pytest.mark.asyncio async def test_collect_user_event_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1562,7 +1552,7 @@ async def test_collect_user_event_field_headers_async(): ) def test_purge_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1591,7 +1581,7 @@ def test_purge_user_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1610,7 +1600,7 @@ async def test_purge_user_events_async( transport: str = "grpc_asyncio", request_type=purge_config.PurgeUserEventsRequest ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1644,7 +1634,7 @@ async def test_purge_user_events_async_from_dict(): def test_purge_user_events_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1676,7 +1666,7 @@ def test_purge_user_events_field_headers(): @pytest.mark.asyncio async def test_purge_user_events_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1716,7 +1706,7 @@ async def test_purge_user_events_field_headers_async(): ) def test_import_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1745,7 +1735,7 @@ def test_import_user_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1764,7 +1754,7 @@ async def test_import_user_events_async( transport: str = "grpc_asyncio", request_type=import_config.ImportUserEventsRequest ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1798,7 +1788,7 @@ async def test_import_user_events_async_from_dict(): def test_import_user_events_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1830,7 +1820,7 @@ def test_import_user_events_field_headers(): @pytest.mark.asyncio async def test_import_user_events_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1870,7 +1860,7 @@ async def test_import_user_events_field_headers_async(): ) def test_rejoin_user_events(request_type, transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1899,7 +1889,7 @@ def test_rejoin_user_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1919,7 +1909,7 @@ async def test_rejoin_user_events_async( request_type=user_event_service.RejoinUserEventsRequest, ): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1953,7 +1943,7 @@ async def test_rejoin_user_events_async_from_dict(): def test_rejoin_user_events_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1985,7 +1975,7 @@ def test_rejoin_user_events_field_headers(): @pytest.mark.asyncio async def test_rejoin_user_events_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2025,7 +2015,7 @@ async def test_rejoin_user_events_field_headers_async(): ) def test_write_user_event_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2296,7 +2286,7 @@ def test_write_user_event_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).write_user_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2305,7 +2295,7 @@ def test_write_user_event_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).write_user_event._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("write_async",)) @@ -2316,7 +2306,7 @@ def test_write_user_event_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2359,7 +2349,7 @@ def test_write_user_event_rest_required_fields( def test_write_user_event_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.write_user_event._get_unset_required_fields({}) @@ -2377,7 +2367,7 @@ def test_write_user_event_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_write_user_event_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -2433,7 +2423,7 @@ def test_write_user_event_rest_bad_request( transport: str = "rest", request_type=user_event_service.WriteUserEventRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2455,7 +2445,7 @@ def test_write_user_event_rest_bad_request( def test_write_user_event_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2468,7 +2458,7 @@ def test_write_user_event_rest_error(): ) def test_collect_user_event_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2521,7 +2511,7 @@ def test_collect_user_event_rest_required_fields( assert "userEvent" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).collect_user_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2533,7 +2523,7 @@ def test_collect_user_event_rest_required_fields( jsonified_request["userEvent"] = "user_event_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).collect_user_event._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2554,7 +2544,7 @@ def test_collect_user_event_rest_required_fields( assert jsonified_request["userEvent"] == "user_event_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2600,7 +2590,7 @@ def test_collect_user_event_rest_required_fields( def test_collect_user_event_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.collect_user_event._get_unset_required_fields({}) @@ -2626,7 +2616,7 @@ def test_collect_user_event_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_collect_user_event_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -2682,7 +2672,7 @@ def test_collect_user_event_rest_bad_request( transport: str = "rest", request_type=user_event_service.CollectUserEventRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2704,7 +2694,7 @@ def test_collect_user_event_rest_bad_request( def test_collect_user_event_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2717,7 +2707,7 @@ def test_collect_user_event_rest_error(): ) def test_purge_user_events_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2764,7 +2754,7 @@ def test_purge_user_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).purge_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2774,7 +2764,7 @@ def test_purge_user_events_rest_required_fields( jsonified_request["filter"] = "filter_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).purge_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2785,7 +2775,7 @@ def test_purge_user_events_rest_required_fields( assert jsonified_request["filter"] == "filter_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2825,7 +2815,7 @@ def test_purge_user_events_rest_required_fields( def test_purge_user_events_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.purge_user_events._get_unset_required_fields({}) @@ -2843,7 +2833,7 @@ def test_purge_user_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_purge_user_events_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -2903,7 +2893,7 @@ def test_purge_user_events_rest_bad_request( transport: str = "rest", request_type=purge_config.PurgeUserEventsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2925,7 +2915,7 @@ def test_purge_user_events_rest_bad_request( def test_purge_user_events_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2938,7 +2928,7 @@ def test_purge_user_events_rest_error(): ) def test_import_user_events_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2984,7 +2974,7 @@ def test_import_user_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2993,7 +2983,7 @@ def test_import_user_events_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).import_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3002,7 +2992,7 @@ def test_import_user_events_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3042,7 +3032,7 @@ def test_import_user_events_rest_required_fields( def test_import_user_events_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.import_user_events._get_unset_required_fields({}) @@ -3060,7 +3050,7 @@ def test_import_user_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_import_user_events_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -3120,7 +3110,7 @@ def test_import_user_events_rest_bad_request( transport: str = "rest", request_type=import_config.ImportUserEventsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3142,7 +3132,7 @@ def test_import_user_events_rest_bad_request( def test_import_user_events_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3155,7 +3145,7 @@ def test_import_user_events_rest_error(): ) def test_rejoin_user_events_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3201,7 +3191,7 @@ def test_rejoin_user_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).rejoin_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3210,7 +3200,7 @@ def test_rejoin_user_events_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).rejoin_user_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3219,7 +3209,7 @@ def test_rejoin_user_events_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3259,7 +3249,7 @@ def test_rejoin_user_events_rest_required_fields( def test_rejoin_user_events_rest_unset_required_fields(): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.rejoin_user_events._get_unset_required_fields({}) @@ -3269,7 +3259,7 @@ def test_rejoin_user_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_rejoin_user_events_rest_interceptors(null_interceptor): transport = transports.UserEventServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.UserEventServiceRestInterceptor(), @@ -3329,7 +3319,7 @@ def test_rejoin_user_events_rest_bad_request( transport: str = "rest", request_type=user_event_service.RejoinUserEventsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3351,24 +3341,24 @@ def test_rejoin_user_events_rest_bad_request( def test_rejoin_user_events_rest_error(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = UserEventServiceClient( @@ -3378,7 +3368,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -3393,13 +3383,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = UserEventServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = UserEventServiceClient( @@ -3411,7 +3400,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = UserEventServiceClient(transport=transport) assert client.transport is transport @@ -3420,13 +3409,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.UserEventServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.UserEventServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -3443,7 +3432,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3457,7 +3446,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = UserEventServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3465,7 +3454,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3477,7 +3466,7 @@ def test_user_event_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.UserEventServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3489,7 +3478,7 @@ def test_user_event_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.UserEventServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3532,7 +3521,7 @@ def test_user_event_service_base_transport_with_credentials_file(): "google.cloud.retail_v2beta.services.user_event_service.transports.UserEventServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.UserEventServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3551,7 +3540,7 @@ def test_user_event_service_base_transport_with_adc(): "google.cloud.retail_v2beta.services.user_event_service.transports.UserEventServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.UserEventServiceTransport() adc.assert_called_once() @@ -3559,7 +3548,7 @@ def test_user_event_service_base_transport_with_adc(): def test_user_event_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) UserEventServiceClient() adc.assert_called_once_with( scopes=None, @@ -3579,7 +3568,7 @@ def test_user_event_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3626,7 +3615,7 @@ def test_user_event_service_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3654,7 +3643,7 @@ def test_user_event_service_transport_create_channel(transport_class, grpc_helpe ], ) def test_user_event_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3692,7 +3681,7 @@ def test_user_event_service_grpc_transport_client_cert_source_for_mtls(transport def test_user_event_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3704,7 +3693,7 @@ def test_user_event_service_http_transport_client_cert_source_for_mtls(): def test_user_event_service_rest_lro_client(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3729,7 +3718,7 @@ def test_user_event_service_rest_lro_client(): ) def test_user_event_service_host_no_port(transport_name): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com" ), @@ -3752,7 +3741,7 @@ def test_user_event_service_host_no_port(transport_name): ) def test_user_event_service_host_with_port(transport_name): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="retail.googleapis.com:8000" ), @@ -3772,8 +3761,8 @@ def test_user_event_service_host_with_port(transport_name): ], ) def test_user_event_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = UserEventServiceClient( credentials=creds1, transport=transport_name, @@ -3849,7 +3838,7 @@ def test_user_event_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3927,7 +3916,7 @@ def test_user_event_service_transport_channel_mtls_with_adc(transport_class): def test_user_event_service_grpc_lro_client(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -3944,7 +3933,7 @@ def test_user_event_service_grpc_lro_client(): def test_user_event_service_grpc_lro_async_client(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -4129,7 +4118,7 @@ def test_client_with_default_client_info(): transports.UserEventServiceTransport, "_prep_wrapped_messages" ) as prep: client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4139,7 +4128,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = UserEventServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4148,7 +4137,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -4163,7 +4152,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4196,7 +4185,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = { @@ -4226,7 +4215,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4256,7 +4245,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/catalogs/sample3"} @@ -4282,7 +4271,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4307,7 +4296,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4333,7 +4322,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4362,7 +4351,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4391,7 +4380,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4409,7 +4398,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4427,7 +4416,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4452,7 +4441,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4478,7 +4467,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4507,7 +4496,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4536,7 +4525,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4554,7 +4543,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = UserEventServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4578,7 +4567,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -4595,7 +4584,7 @@ def test_client_ctx(): ] for transport in transports: client = UserEventServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-run/google/cloud/run/gapic_version.py b/packages/google-cloud-run/google/cloud/run/gapic_version.py index f9860b242785..360a0d13ebdd 100644 --- a/packages/google-cloud-run/google/cloud/run/gapic_version.py +++ b/packages/google-cloud-run/google/cloud/run/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.10.2" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-run/google/cloud/run_v2/gapic_version.py b/packages/google-cloud-run/google/cloud/run_v2/gapic_version.py index f9860b242785..360a0d13ebdd 100644 --- a/packages/google-cloud-run/google/cloud/run_v2/gapic_version.py +++ b/packages/google-cloud-run/google/cloud/run_v2/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.10.2" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-run/google/cloud/run_v2/services/executions/client.py b/packages/google-cloud-run/google/cloud/run_v2/services/executions/client.py index f64690423cf9..063b022442d9 100644 --- a/packages/google-cloud-run/google/cloud/run_v2/services/executions/client.py +++ b/packages/google-cloud-run/google/cloud/run_v2/services/executions/client.py @@ -496,6 +496,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -514,6 +515,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -588,17 +590,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ExecutionsClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ExecutionsClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-run/google/cloud/run_v2/services/jobs/client.py b/packages/google-cloud-run/google/cloud/run_v2/services/jobs/client.py index cb5e1c263dda..bc9b40a60ffd 100644 --- a/packages/google-cloud-run/google/cloud/run_v2/services/jobs/client.py +++ b/packages/google-cloud-run/google/cloud/run_v2/services/jobs/client.py @@ -501,6 +501,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -519,6 +520,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -593,17 +595,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = JobsClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = JobsClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-run/google/cloud/run_v2/services/revisions/client.py b/packages/google-cloud-run/google/cloud/run_v2/services/revisions/client.py index f3b7197e5398..37cd9c973513 100644 --- a/packages/google-cloud-run/google/cloud/run_v2/services/revisions/client.py +++ b/packages/google-cloud-run/google/cloud/run_v2/services/revisions/client.py @@ -497,6 +497,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -515,6 +516,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -589,17 +591,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = RevisionsClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = RevisionsClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-run/google/cloud/run_v2/services/services/client.py b/packages/google-cloud-run/google/cloud/run_v2/services/services/client.py index 3e01fdd2f271..6348bb5f07c9 100644 --- a/packages/google-cloud-run/google/cloud/run_v2/services/services/client.py +++ b/packages/google-cloud-run/google/cloud/run_v2/services/services/client.py @@ -501,6 +501,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -519,6 +520,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -593,17 +595,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ServicesClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ServicesClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-run/google/cloud/run_v2/services/tasks/client.py b/packages/google-cloud-run/google/cloud/run_v2/services/tasks/client.py index 6bbeffa03efc..99e6251222b0 100644 --- a/packages/google-cloud-run/google/cloud/run_v2/services/tasks/client.py +++ b/packages/google-cloud-run/google/cloud/run_v2/services/tasks/client.py @@ -520,6 +520,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -538,6 +539,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -612,17 +614,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = TasksClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = TasksClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-run/samples/generated_samples/snippet_metadata_google.cloud.run.v2.json b/packages/google-cloud-run/samples/generated_samples/snippet_metadata_google.cloud.run.v2.json index d43511d67dd2..796aa845823f 100644 --- a/packages/google-cloud-run/samples/generated_samples/snippet_metadata_google.cloud.run.v2.json +++ b/packages/google-cloud-run/samples/generated_samples/snippet_metadata_google.cloud.run.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-run", - "version": "0.10.2" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-run/setup.py b/packages/google-cloud-run/setup.py index 4d9649f106b0..41be0b5a53c0 100644 --- a/packages/google-cloud-run/setup.py +++ b/packages/google-cloud-run/setup.py @@ -40,6 +40,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", diff --git a/packages/google-cloud-run/testing/constraints-3.7.txt b/packages/google-cloud-run/testing/constraints-3.7.txt index 44ffd04543a8..712d45b4c5ea 100644 --- a/packages/google-cloud-run/testing/constraints-3.7.txt +++ b/packages/google-cloud-run/testing/constraints-3.7.txt @@ -5,6 +5,7 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 grpc-google-iam-v1==0.12.4 diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_executions.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_executions.py index 533e36aa1bca..ebe62c103095 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_executions.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_executions.py @@ -90,18 +90,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -305,7 +293,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -332,42 +320,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -378,7 +373,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_executions_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -430,7 +425,7 @@ def test_executions_client_service_account_always_use_jwt( ], ) def test_executions_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -493,9 +488,7 @@ def test_executions_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ExecutionsClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -888,20 +881,20 @@ def test_executions_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -913,13 +906,11 @@ def test_executions_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -935,8 +926,7 @@ def test_executions_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1077,8 +1067,8 @@ def test_executions_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1107,7 +1097,7 @@ def test_executions_client_create_channel_credentials_file( ) def test_get_execution(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1169,7 +1159,7 @@ def test_get_execution_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1186,7 +1176,7 @@ async def test_get_execution_async( transport: str = "grpc_asyncio", request_type=execution.GetExecutionRequest ): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1253,7 +1243,7 @@ async def test_get_execution_async_from_dict(): def test_get_execution_field_headers(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1283,7 +1273,7 @@ def test_get_execution_field_headers(): @pytest.mark.asyncio async def test_get_execution_field_headers_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1312,7 +1302,7 @@ async def test_get_execution_field_headers_async(): def test_get_execution_flattened(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1336,7 +1326,7 @@ def test_get_execution_flattened(): def test_get_execution_flattened_error(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1351,7 +1341,7 @@ def test_get_execution_flattened_error(): @pytest.mark.asyncio async def test_get_execution_flattened_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1378,7 +1368,7 @@ async def test_get_execution_flattened_async(): @pytest.mark.asyncio async def test_get_execution_flattened_error_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1399,7 +1389,7 @@ async def test_get_execution_flattened_error_async(): ) def test_list_executions(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1429,7 +1419,7 @@ def test_list_executions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1446,7 +1436,7 @@ async def test_list_executions_async( transport: str = "grpc_asyncio", request_type=execution.ListExecutionsRequest ): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1481,7 +1471,7 @@ async def test_list_executions_async_from_dict(): def test_list_executions_field_headers(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1511,7 +1501,7 @@ def test_list_executions_field_headers(): @pytest.mark.asyncio async def test_list_executions_field_headers_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1542,7 +1532,7 @@ async def test_list_executions_field_headers_async(): def test_list_executions_flattened(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1566,7 +1556,7 @@ def test_list_executions_flattened(): def test_list_executions_flattened_error(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1581,7 +1571,7 @@ def test_list_executions_flattened_error(): @pytest.mark.asyncio async def test_list_executions_flattened_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1610,7 +1600,7 @@ async def test_list_executions_flattened_async(): @pytest.mark.asyncio async def test_list_executions_flattened_error_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1624,7 +1614,7 @@ async def test_list_executions_flattened_error_async(): def test_list_executions_pager(transport_name: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1674,7 +1664,7 @@ def test_list_executions_pager(transport_name: str = "grpc"): def test_list_executions_pages(transport_name: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1716,7 +1706,7 @@ def test_list_executions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_executions_async_pager(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1766,7 +1756,7 @@ async def test_list_executions_async_pager(): @pytest.mark.asyncio async def test_list_executions_async_pages(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1821,7 +1811,7 @@ async def test_list_executions_async_pages(): ) def test_delete_execution(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1848,7 +1838,7 @@ def test_delete_execution_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1865,7 +1855,7 @@ async def test_delete_execution_async( transport: str = "grpc_asyncio", request_type=execution.DeleteExecutionRequest ): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1897,7 +1887,7 @@ async def test_delete_execution_async_from_dict(): def test_delete_execution_field_headers(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1927,7 +1917,7 @@ def test_delete_execution_field_headers(): @pytest.mark.asyncio async def test_delete_execution_field_headers_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1958,7 +1948,7 @@ async def test_delete_execution_field_headers_async(): def test_delete_execution_flattened(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1982,7 +1972,7 @@ def test_delete_execution_flattened(): def test_delete_execution_flattened_error(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1997,7 +1987,7 @@ def test_delete_execution_flattened_error(): @pytest.mark.asyncio async def test_delete_execution_flattened_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2026,7 +2016,7 @@ async def test_delete_execution_flattened_async(): @pytest.mark.asyncio async def test_delete_execution_flattened_error_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2047,7 +2037,7 @@ async def test_delete_execution_flattened_error_async(): ) def test_cancel_execution(request_type, transport: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2074,7 +2064,7 @@ def test_cancel_execution_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2091,7 +2081,7 @@ async def test_cancel_execution_async( transport: str = "grpc_asyncio", request_type=execution.CancelExecutionRequest ): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2123,7 +2113,7 @@ async def test_cancel_execution_async_from_dict(): def test_cancel_execution_field_headers(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2153,7 +2143,7 @@ def test_cancel_execution_field_headers(): @pytest.mark.asyncio async def test_cancel_execution_field_headers_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2184,7 +2174,7 @@ async def test_cancel_execution_field_headers_async(): def test_cancel_execution_flattened(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2208,7 +2198,7 @@ def test_cancel_execution_flattened(): def test_cancel_execution_flattened_error(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2223,7 +2213,7 @@ def test_cancel_execution_flattened_error(): @pytest.mark.asyncio async def test_cancel_execution_flattened_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2252,7 +2242,7 @@ async def test_cancel_execution_flattened_async(): @pytest.mark.asyncio async def test_cancel_execution_flattened_error_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2273,7 +2263,7 @@ async def test_cancel_execution_flattened_error_async(): ) def test_get_execution_rest(request_type): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2356,7 +2346,7 @@ def test_get_execution_rest_required_fields(request_type=execution.GetExecutionR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_execution._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2365,7 +2355,7 @@ def test_get_execution_rest_required_fields(request_type=execution.GetExecutionR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_execution._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2374,7 +2364,7 @@ def test_get_execution_rest_required_fields(request_type=execution.GetExecutionR assert jsonified_request["name"] == "name_value" client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2416,7 +2406,7 @@ def test_get_execution_rest_required_fields(request_type=execution.GetExecutionR def test_get_execution_rest_unset_required_fields(): transport = transports.ExecutionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_execution._get_unset_required_fields({}) @@ -2426,7 +2416,7 @@ def test_get_execution_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_execution_rest_interceptors(null_interceptor): transport = transports.ExecutionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ExecutionsRestInterceptor(), @@ -2480,7 +2470,7 @@ def test_get_execution_rest_bad_request( transport: str = "rest", request_type=execution.GetExecutionRequest ): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2504,7 +2494,7 @@ def test_get_execution_rest_bad_request( def test_get_execution_rest_flattened(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2548,7 +2538,7 @@ def test_get_execution_rest_flattened(): def test_get_execution_rest_flattened_error(transport: str = "rest"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2563,7 +2553,7 @@ def test_get_execution_rest_flattened_error(transport: str = "rest"): def test_get_execution_rest_error(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2576,7 +2566,7 @@ def test_get_execution_rest_error(): ) def test_list_executions_rest(request_type): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2627,7 +2617,7 @@ def test_list_executions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_executions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2636,7 +2626,7 @@ def test_list_executions_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_executions._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2653,7 +2643,7 @@ def test_list_executions_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2695,7 +2685,7 @@ def test_list_executions_rest_required_fields( def test_list_executions_rest_unset_required_fields(): transport = transports.ExecutionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_executions._get_unset_required_fields({}) @@ -2714,7 +2704,7 @@ def test_list_executions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_executions_rest_interceptors(null_interceptor): transport = transports.ExecutionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ExecutionsRestInterceptor(), @@ -2772,7 +2762,7 @@ def test_list_executions_rest_bad_request( transport: str = "rest", request_type=execution.ListExecutionsRequest ): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2794,7 +2784,7 @@ def test_list_executions_rest_bad_request( def test_list_executions_rest_flattened(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2836,7 +2826,7 @@ def test_list_executions_rest_flattened(): def test_list_executions_rest_flattened_error(transport: str = "rest"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2851,7 +2841,7 @@ def test_list_executions_rest_flattened_error(transport: str = "rest"): def test_list_executions_rest_pager(transport: str = "rest"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2919,7 +2909,7 @@ def test_list_executions_rest_pager(transport: str = "rest"): ) def test_delete_execution_rest(request_type): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2967,7 +2957,7 @@ def test_delete_execution_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_execution._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2976,7 +2966,7 @@ def test_delete_execution_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_execution._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2992,7 +2982,7 @@ def test_delete_execution_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3031,7 +3021,7 @@ def test_delete_execution_rest_required_fields( def test_delete_execution_rest_unset_required_fields(): transport = transports.ExecutionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_execution._get_unset_required_fields({}) @@ -3049,7 +3039,7 @@ def test_delete_execution_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_execution_rest_interceptors(null_interceptor): transport = transports.ExecutionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ExecutionsRestInterceptor(), @@ -3109,7 +3099,7 @@ def test_delete_execution_rest_bad_request( transport: str = "rest", request_type=execution.DeleteExecutionRequest ): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3133,7 +3123,7 @@ def test_delete_execution_rest_bad_request( def test_delete_execution_rest_flattened(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3175,7 +3165,7 @@ def test_delete_execution_rest_flattened(): def test_delete_execution_rest_flattened_error(transport: str = "rest"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3190,7 +3180,7 @@ def test_delete_execution_rest_flattened_error(transport: str = "rest"): def test_delete_execution_rest_error(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3203,7 +3193,7 @@ def test_delete_execution_rest_error(): ) def test_cancel_execution_rest(request_type): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3251,7 +3241,7 @@ def test_cancel_execution_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).cancel_execution._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3260,7 +3250,7 @@ def test_cancel_execution_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).cancel_execution._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3269,7 +3259,7 @@ def test_cancel_execution_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3309,7 +3299,7 @@ def test_cancel_execution_rest_required_fields( def test_cancel_execution_rest_unset_required_fields(): transport = transports.ExecutionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.cancel_execution._get_unset_required_fields({}) @@ -3319,7 +3309,7 @@ def test_cancel_execution_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_cancel_execution_rest_interceptors(null_interceptor): transport = transports.ExecutionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ExecutionsRestInterceptor(), @@ -3379,7 +3369,7 @@ def test_cancel_execution_rest_bad_request( transport: str = "rest", request_type=execution.CancelExecutionRequest ): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3403,7 +3393,7 @@ def test_cancel_execution_rest_bad_request( def test_cancel_execution_rest_flattened(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3445,7 +3435,7 @@ def test_cancel_execution_rest_flattened(): def test_cancel_execution_rest_flattened_error(transport: str = "rest"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3460,24 +3450,24 @@ def test_cancel_execution_rest_flattened_error(transport: str = "rest"): def test_cancel_execution_rest_error(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ExecutionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ExecutionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ExecutionsClient( @@ -3487,7 +3477,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ExecutionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -3502,13 +3492,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ExecutionsClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ExecutionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ExecutionsClient( @@ -3520,7 +3509,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ExecutionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ExecutionsClient(transport=transport) assert client.transport is transport @@ -3529,13 +3518,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ExecutionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ExecutionsGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -3552,7 +3541,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3566,7 +3555,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ExecutionsClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3574,7 +3563,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3586,7 +3575,7 @@ def test_executions_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ExecutionsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3598,7 +3587,7 @@ def test_executions_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ExecutionsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3642,7 +3631,7 @@ def test_executions_base_transport_with_credentials_file(): "google.cloud.run_v2.services.executions.transports.ExecutionsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ExecutionsTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3661,7 +3650,7 @@ def test_executions_base_transport_with_adc(): "google.cloud.run_v2.services.executions.transports.ExecutionsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ExecutionsTransport() adc.assert_called_once() @@ -3669,7 +3658,7 @@ def test_executions_base_transport_with_adc(): def test_executions_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ExecutionsClient() adc.assert_called_once_with( scopes=None, @@ -3689,7 +3678,7 @@ def test_executions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3736,7 +3725,7 @@ def test_executions_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3761,7 +3750,7 @@ def test_executions_transport_create_channel(transport_class, grpc_helpers): [transports.ExecutionsGrpcTransport, transports.ExecutionsGrpcAsyncIOTransport], ) def test_executions_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3799,7 +3788,7 @@ def test_executions_grpc_transport_client_cert_source_for_mtls(transport_class): def test_executions_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3811,7 +3800,7 @@ def test_executions_http_transport_client_cert_source_for_mtls(): def test_executions_rest_lro_client(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3836,7 +3825,7 @@ def test_executions_rest_lro_client(): ) def test_executions_host_no_port(transport_name): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions(api_endpoint="run.googleapis.com"), transport=transport_name, ) @@ -3857,7 +3846,7 @@ def test_executions_host_no_port(transport_name): ) def test_executions_host_with_port(transport_name): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="run.googleapis.com:8000" ), @@ -3877,8 +3866,8 @@ def test_executions_host_with_port(transport_name): ], ) def test_executions_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ExecutionsClient( credentials=creds1, transport=transport_name, @@ -3946,7 +3935,7 @@ def test_executions_transport_channel_mtls_with_client_cert_source(transport_cla mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -4021,7 +4010,7 @@ def test_executions_transport_channel_mtls_with_adc(transport_class): def test_executions_grpc_lro_client(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -4038,7 +4027,7 @@ def test_executions_grpc_lro_client(): def test_executions_grpc_lro_async_client(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -4322,7 +4311,7 @@ def test_client_with_default_client_info(): transports.ExecutionsTransport, "_prep_wrapped_messages" ) as prep: client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4332,7 +4321,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ExecutionsClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -4341,7 +4330,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -4356,7 +4345,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4386,7 +4375,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -4414,7 +4403,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4444,7 +4433,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -4472,7 +4461,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4502,7 +4491,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -4530,7 +4519,7 @@ def test_wait_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.WaitOperationRequest ): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4560,7 +4549,7 @@ def test_wait_operation_rest_bad_request( ) def test_wait_operation_rest(request_type): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -4586,7 +4575,7 @@ def test_wait_operation_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4611,7 +4600,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4635,7 +4624,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4664,7 +4653,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4691,7 +4680,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -4709,7 +4698,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -4725,7 +4714,7 @@ async def test_delete_operation_from_dict_async(): def test_wait_operation(transport: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4750,7 +4739,7 @@ def test_wait_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_wait_operation(transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4776,7 +4765,7 @@ async def test_wait_operation(transport: str = "grpc_asyncio"): def test_wait_operation_field_headers(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4805,7 +4794,7 @@ def test_wait_operation_field_headers(): @pytest.mark.asyncio async def test_wait_operation_field_headers_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4834,7 +4823,7 @@ async def test_wait_operation_field_headers_async(): def test_wait_operation_from_dict(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -4852,7 +4841,7 @@ def test_wait_operation_from_dict(): @pytest.mark.asyncio async def test_wait_operation_from_dict_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -4870,7 +4859,7 @@ async def test_wait_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4895,7 +4884,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4921,7 +4910,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4950,7 +4939,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4979,7 +4968,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4997,7 +4986,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -5015,7 +5004,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5040,7 +5029,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5066,7 +5055,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5095,7 +5084,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5124,7 +5113,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -5142,7 +5131,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ExecutionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -5166,7 +5155,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -5183,7 +5172,7 @@ def test_client_ctx(): ] for transport in transports: client = ExecutionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_jobs.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_jobs.py index 32bbb96a6eeb..07820fde0798 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_jobs.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_jobs.py @@ -99,18 +99,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -294,7 +282,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -321,42 +309,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -367,7 +362,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_jobs_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -417,7 +412,7 @@ def test_jobs_client_service_account_always_use_jwt(transport_class, transport_n ], ) def test_jobs_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -474,9 +469,7 @@ def test_jobs_client_get_transport_class(): def test_jobs_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(JobsClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -855,20 +848,20 @@ def test_jobs_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -880,13 +873,11 @@ def test_jobs_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -902,8 +893,7 @@ def test_jobs_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1040,8 +1030,8 @@ def test_jobs_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1070,7 +1060,7 @@ def test_jobs_client_create_channel_credentials_file( ) def test_create_job(request_type, transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1097,7 +1087,7 @@ def test_create_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1114,7 +1104,7 @@ async def test_create_job_async( transport: str = "grpc_asyncio", request_type=gcr_job.CreateJobRequest ): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1146,7 +1136,7 @@ async def test_create_job_async_from_dict(): def test_create_job_routing_parameters(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1172,7 +1162,7 @@ def test_create_job_routing_parameters(): def test_create_job_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1204,7 +1194,7 @@ def test_create_job_flattened(): def test_create_job_flattened_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1221,7 +1211,7 @@ def test_create_job_flattened_error(): @pytest.mark.asyncio async def test_create_job_flattened_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1258,7 +1248,7 @@ async def test_create_job_flattened_async(): @pytest.mark.asyncio async def test_create_job_flattened_error_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1281,7 +1271,7 @@ async def test_create_job_flattened_error_async(): ) def test_get_job(request_type, transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1335,7 +1325,7 @@ def test_get_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1352,7 +1342,7 @@ async def test_get_job_async( transport: str = "grpc_asyncio", request_type=job.GetJobRequest ): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1411,7 +1401,7 @@ async def test_get_job_async_from_dict(): def test_get_job_routing_parameters(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1437,7 +1427,7 @@ def test_get_job_routing_parameters(): def test_get_job_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1461,7 +1451,7 @@ def test_get_job_flattened(): def test_get_job_flattened_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1476,7 +1466,7 @@ def test_get_job_flattened_error(): @pytest.mark.asyncio async def test_get_job_flattened_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1503,7 +1493,7 @@ async def test_get_job_flattened_async(): @pytest.mark.asyncio async def test_get_job_flattened_error_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1524,7 +1514,7 @@ async def test_get_job_flattened_error_async(): ) def test_list_jobs(request_type, transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1554,7 +1544,7 @@ def test_list_jobs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1571,7 +1561,7 @@ async def test_list_jobs_async( transport: str = "grpc_asyncio", request_type=job.ListJobsRequest ): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1606,7 +1596,7 @@ async def test_list_jobs_async_from_dict(): def test_list_jobs_routing_parameters(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1630,7 +1620,7 @@ def test_list_jobs_routing_parameters(): def test_list_jobs_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1654,7 +1644,7 @@ def test_list_jobs_flattened(): def test_list_jobs_flattened_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1669,7 +1659,7 @@ def test_list_jobs_flattened_error(): @pytest.mark.asyncio async def test_list_jobs_flattened_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1698,7 +1688,7 @@ async def test_list_jobs_flattened_async(): @pytest.mark.asyncio async def test_list_jobs_flattened_error_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1712,7 +1702,7 @@ async def test_list_jobs_flattened_error_async(): def test_list_jobs_pager(transport_name: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1759,7 +1749,7 @@ def test_list_jobs_pager(transport_name: str = "grpc"): def test_list_jobs_pages(transport_name: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1801,7 +1791,7 @@ def test_list_jobs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_jobs_async_pager(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1851,7 +1841,7 @@ async def test_list_jobs_async_pager(): @pytest.mark.asyncio async def test_list_jobs_async_pages(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1906,7 +1896,7 @@ async def test_list_jobs_async_pages(): ) def test_update_job(request_type, transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1933,7 +1923,7 @@ def test_update_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1950,7 +1940,7 @@ async def test_update_job_async( transport: str = "grpc_asyncio", request_type=gcr_job.UpdateJobRequest ): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1982,7 +1972,7 @@ async def test_update_job_async_from_dict(): def test_update_job_routing_parameters(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2008,7 +1998,7 @@ def test_update_job_routing_parameters(): def test_update_job_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2032,7 +2022,7 @@ def test_update_job_flattened(): def test_update_job_flattened_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2047,7 +2037,7 @@ def test_update_job_flattened_error(): @pytest.mark.asyncio async def test_update_job_flattened_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2076,7 +2066,7 @@ async def test_update_job_flattened_async(): @pytest.mark.asyncio async def test_update_job_flattened_error_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2097,7 +2087,7 @@ async def test_update_job_flattened_error_async(): ) def test_delete_job(request_type, transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2124,7 +2114,7 @@ def test_delete_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2141,7 +2131,7 @@ async def test_delete_job_async( transport: str = "grpc_asyncio", request_type=job.DeleteJobRequest ): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2173,7 +2163,7 @@ async def test_delete_job_async_from_dict(): def test_delete_job_routing_parameters(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2199,7 +2189,7 @@ def test_delete_job_routing_parameters(): def test_delete_job_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2223,7 +2213,7 @@ def test_delete_job_flattened(): def test_delete_job_flattened_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2238,7 +2228,7 @@ def test_delete_job_flattened_error(): @pytest.mark.asyncio async def test_delete_job_flattened_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2267,7 +2257,7 @@ async def test_delete_job_flattened_async(): @pytest.mark.asyncio async def test_delete_job_flattened_error_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2288,7 +2278,7 @@ async def test_delete_job_flattened_error_async(): ) def test_run_job(request_type, transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2315,7 +2305,7 @@ def test_run_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2332,7 +2322,7 @@ async def test_run_job_async( transport: str = "grpc_asyncio", request_type=job.RunJobRequest ): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2364,7 +2354,7 @@ async def test_run_job_async_from_dict(): def test_run_job_routing_parameters(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2390,7 +2380,7 @@ def test_run_job_routing_parameters(): def test_run_job_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2414,7 +2404,7 @@ def test_run_job_flattened(): def test_run_job_flattened_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2429,7 +2419,7 @@ def test_run_job_flattened_error(): @pytest.mark.asyncio async def test_run_job_flattened_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2458,7 +2448,7 @@ async def test_run_job_flattened_async(): @pytest.mark.asyncio async def test_run_job_flattened_error_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2479,7 +2469,7 @@ async def test_run_job_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2511,7 +2501,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2528,7 +2518,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2565,7 +2555,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2595,7 +2585,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2624,7 +2614,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2648,7 +2638,7 @@ def test_get_iam_policy_from_dict_foreign(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2680,7 +2670,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2697,7 +2687,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2734,7 +2724,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2764,7 +2754,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2793,7 +2783,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -2818,7 +2808,7 @@ def test_set_iam_policy_from_dict_foreign(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2850,7 +2840,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2870,7 +2860,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2907,7 +2897,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2939,7 +2929,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2972,7 +2962,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2998,7 +2988,7 @@ def test_test_iam_permissions_from_dict_foreign(): ) def test_create_job_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3243,7 +3233,7 @@ def test_create_job_rest_required_fields(request_type=gcr_job.CreateJobRequest): assert "jobId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3255,7 +3245,7 @@ def test_create_job_rest_required_fields(request_type=gcr_job.CreateJobRequest): jsonified_request["jobId"] = "job_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_job._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3273,7 +3263,7 @@ def test_create_job_rest_required_fields(request_type=gcr_job.CreateJobRequest): assert jsonified_request["jobId"] == "job_id_value" client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3319,7 +3309,7 @@ def test_create_job_rest_required_fields(request_type=gcr_job.CreateJobRequest): def test_create_job_rest_unset_required_fields(): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_job._get_unset_required_fields({}) @@ -3343,7 +3333,7 @@ def test_create_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_job_rest_interceptors(null_interceptor): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.JobsRestInterceptor(), ) client = JobsClient(transport=transport) @@ -3399,7 +3389,7 @@ def test_create_job_rest_bad_request( transport: str = "rest", request_type=gcr_job.CreateJobRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3421,7 +3411,7 @@ def test_create_job_rest_bad_request( def test_create_job_rest_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3462,7 +3452,7 @@ def test_create_job_rest_flattened(): def test_create_job_rest_flattened_error(transport: str = "rest"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3479,7 +3469,7 @@ def test_create_job_rest_flattened_error(transport: str = "rest"): def test_create_job_rest_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3492,7 +3482,7 @@ def test_create_job_rest_error(): ) def test_get_job_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3565,7 +3555,7 @@ def test_get_job_rest_required_fields(request_type=job.GetJobRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3574,7 +3564,7 @@ def test_get_job_rest_required_fields(request_type=job.GetJobRequest): jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3583,7 +3573,7 @@ def test_get_job_rest_required_fields(request_type=job.GetJobRequest): assert jsonified_request["name"] == "name_value" client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3625,7 +3615,7 @@ def test_get_job_rest_required_fields(request_type=job.GetJobRequest): def test_get_job_rest_unset_required_fields(): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_job._get_unset_required_fields({}) @@ -3635,7 +3625,7 @@ def test_get_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_job_rest_interceptors(null_interceptor): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.JobsRestInterceptor(), ) client = JobsClient(transport=transport) @@ -3687,7 +3677,7 @@ def test_get_job_rest_bad_request( transport: str = "rest", request_type=job.GetJobRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3709,7 +3699,7 @@ def test_get_job_rest_bad_request( def test_get_job_rest_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3750,7 +3740,7 @@ def test_get_job_rest_flattened(): def test_get_job_rest_flattened_error(transport: str = "rest"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3765,7 +3755,7 @@ def test_get_job_rest_flattened_error(transport: str = "rest"): def test_get_job_rest_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3778,7 +3768,7 @@ def test_get_job_rest_error(): ) def test_list_jobs_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3827,7 +3817,7 @@ def test_list_jobs_rest_required_fields(request_type=job.ListJobsRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_jobs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3836,7 +3826,7 @@ def test_list_jobs_rest_required_fields(request_type=job.ListJobsRequest): jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_jobs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3853,7 +3843,7 @@ def test_list_jobs_rest_required_fields(request_type=job.ListJobsRequest): assert jsonified_request["parent"] == "parent_value" client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3895,7 +3885,7 @@ def test_list_jobs_rest_required_fields(request_type=job.ListJobsRequest): def test_list_jobs_rest_unset_required_fields(): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_jobs._get_unset_required_fields({}) @@ -3914,7 +3904,7 @@ def test_list_jobs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_jobs_rest_interceptors(null_interceptor): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.JobsRestInterceptor(), ) client = JobsClient(transport=transport) @@ -3966,7 +3956,7 @@ def test_list_jobs_rest_bad_request( transport: str = "rest", request_type=job.ListJobsRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3988,7 +3978,7 @@ def test_list_jobs_rest_bad_request( def test_list_jobs_rest_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4029,7 +4019,7 @@ def test_list_jobs_rest_flattened(): def test_list_jobs_rest_flattened_error(transport: str = "rest"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4044,7 +4034,7 @@ def test_list_jobs_rest_flattened_error(transport: str = "rest"): def test_list_jobs_rest_pager(transport: str = "rest"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4112,7 +4102,7 @@ def test_list_jobs_rest_pager(transport: str = "rest"): ) def test_update_job_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4354,14 +4344,14 @@ def test_update_job_rest_required_fields(request_type=gcr_job.UpdateJobRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_job._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4375,7 +4365,7 @@ def test_update_job_rest_required_fields(request_type=gcr_job.UpdateJobRequest): # verify required fields with non-default values are left alone client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4415,7 +4405,7 @@ def test_update_job_rest_required_fields(request_type=gcr_job.UpdateJobRequest): def test_update_job_rest_unset_required_fields(): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_job._get_unset_required_fields({}) @@ -4433,7 +4423,7 @@ def test_update_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_job_rest_interceptors(null_interceptor): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.JobsRestInterceptor(), ) client = JobsClient(transport=transport) @@ -4489,7 +4479,7 @@ def test_update_job_rest_bad_request( transport: str = "rest", request_type=gcr_job.UpdateJobRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4511,7 +4501,7 @@ def test_update_job_rest_bad_request( def test_update_job_rest_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4552,7 +4542,7 @@ def test_update_job_rest_flattened(): def test_update_job_rest_flattened_error(transport: str = "rest"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4567,7 +4557,7 @@ def test_update_job_rest_flattened_error(transport: str = "rest"): def test_update_job_rest_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4580,7 +4570,7 @@ def test_update_job_rest_error(): ) def test_delete_job_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4624,7 +4614,7 @@ def test_delete_job_rest_required_fields(request_type=job.DeleteJobRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4633,7 +4623,7 @@ def test_delete_job_rest_required_fields(request_type=job.DeleteJobRequest): jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_job._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4649,7 +4639,7 @@ def test_delete_job_rest_required_fields(request_type=job.DeleteJobRequest): assert jsonified_request["name"] == "name_value" client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4688,7 +4678,7 @@ def test_delete_job_rest_required_fields(request_type=job.DeleteJobRequest): def test_delete_job_rest_unset_required_fields(): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_job._get_unset_required_fields({}) @@ -4706,7 +4696,7 @@ def test_delete_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_job_rest_interceptors(null_interceptor): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.JobsRestInterceptor(), ) client = JobsClient(transport=transport) @@ -4762,7 +4752,7 @@ def test_delete_job_rest_bad_request( transport: str = "rest", request_type=job.DeleteJobRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4784,7 +4774,7 @@ def test_delete_job_rest_bad_request( def test_delete_job_rest_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4823,7 +4813,7 @@ def test_delete_job_rest_flattened(): def test_delete_job_rest_flattened_error(transport: str = "rest"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4838,7 +4828,7 @@ def test_delete_job_rest_flattened_error(transport: str = "rest"): def test_delete_job_rest_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4851,7 +4841,7 @@ def test_delete_job_rest_error(): ) def test_run_job_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4895,7 +4885,7 @@ def test_run_job_rest_required_fields(request_type=job.RunJobRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4904,7 +4894,7 @@ def test_run_job_rest_required_fields(request_type=job.RunJobRequest): jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4913,7 +4903,7 @@ def test_run_job_rest_required_fields(request_type=job.RunJobRequest): assert jsonified_request["name"] == "name_value" client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4953,7 +4943,7 @@ def test_run_job_rest_required_fields(request_type=job.RunJobRequest): def test_run_job_rest_unset_required_fields(): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.run_job._get_unset_required_fields({}) @@ -4963,7 +4953,7 @@ def test_run_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_run_job_rest_interceptors(null_interceptor): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.JobsRestInterceptor(), ) client = JobsClient(transport=transport) @@ -5019,7 +5009,7 @@ def test_run_job_rest_bad_request( transport: str = "rest", request_type=job.RunJobRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5041,7 +5031,7 @@ def test_run_job_rest_bad_request( def test_run_job_rest_flattened(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5080,7 +5070,7 @@ def test_run_job_rest_flattened(): def test_run_job_rest_flattened_error(transport: str = "rest"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5095,7 +5085,7 @@ def test_run_job_rest_flattened_error(transport: str = "rest"): def test_run_job_rest_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5108,7 +5098,7 @@ def test_run_job_rest_error(): ) def test_get_iam_policy_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5159,7 +5149,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5168,7 +5158,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("options",)) @@ -5179,7 +5169,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5219,7 +5209,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -5229,7 +5219,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.JobsRestInterceptor(), ) client = JobsClient(transport=transport) @@ -5281,7 +5271,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5303,7 +5293,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5316,7 +5306,7 @@ def test_get_iam_policy_rest_error(): ) def test_set_iam_policy_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5367,7 +5357,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5376,7 +5366,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5385,7 +5375,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5426,7 +5416,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -5444,7 +5434,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.JobsRestInterceptor(), ) client = JobsClient(transport=transport) @@ -5496,7 +5486,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5518,7 +5508,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5531,7 +5521,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5581,7 +5571,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5591,7 +5581,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5602,7 +5592,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5643,7 +5633,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -5661,7 +5651,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.JobsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.JobsRestInterceptor(), ) client = JobsClient(transport=transport) @@ -5715,7 +5705,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5737,24 +5727,24 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_error(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.JobsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.JobsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = JobsClient( @@ -5764,7 +5754,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.JobsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5779,13 +5769,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = JobsClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.JobsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = JobsClient( @@ -5797,7 +5786,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.JobsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = JobsClient(transport=transport) assert client.transport is transport @@ -5806,13 +5795,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.JobsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.JobsGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -5829,7 +5818,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -5843,7 +5832,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = JobsClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -5851,7 +5840,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -5863,7 +5852,7 @@ def test_jobs_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.JobsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -5875,7 +5864,7 @@ def test_jobs_base_transport(): ) as Transport: Transport.return_value = None transport = transports.JobsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -5924,7 +5913,7 @@ def test_jobs_base_transport_with_credentials_file(): "google.cloud.run_v2.services.jobs.transports.JobsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.JobsTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -5943,7 +5932,7 @@ def test_jobs_base_transport_with_adc(): "google.cloud.run_v2.services.jobs.transports.JobsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.JobsTransport() adc.assert_called_once() @@ -5951,7 +5940,7 @@ def test_jobs_base_transport_with_adc(): def test_jobs_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) JobsClient() adc.assert_called_once_with( scopes=None, @@ -5971,7 +5960,7 @@ def test_jobs_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6018,7 +6007,7 @@ def test_jobs_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6043,7 +6032,7 @@ def test_jobs_transport_create_channel(transport_class, grpc_helpers): [transports.JobsGrpcTransport, transports.JobsGrpcAsyncIOTransport], ) def test_jobs_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6081,7 +6070,7 @@ def test_jobs_grpc_transport_client_cert_source_for_mtls(transport_class): def test_jobs_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6093,7 +6082,7 @@ def test_jobs_http_transport_client_cert_source_for_mtls(): def test_jobs_rest_lro_client(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -6118,7 +6107,7 @@ def test_jobs_rest_lro_client(): ) def test_jobs_host_no_port(transport_name): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions(api_endpoint="run.googleapis.com"), transport=transport_name, ) @@ -6139,7 +6128,7 @@ def test_jobs_host_no_port(transport_name): ) def test_jobs_host_with_port(transport_name): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="run.googleapis.com:8000" ), @@ -6159,8 +6148,8 @@ def test_jobs_host_with_port(transport_name): ], ) def test_jobs_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = JobsClient( credentials=creds1, transport=transport_name, @@ -6243,7 +6232,7 @@ def test_jobs_transport_channel_mtls_with_client_cert_source(transport_class): mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6318,7 +6307,7 @@ def test_jobs_transport_channel_mtls_with_adc(transport_class): def test_jobs_grpc_lro_client(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -6335,7 +6324,7 @@ def test_jobs_grpc_lro_client(): def test_jobs_grpc_lro_async_client(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -6617,7 +6606,7 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.JobsTransport, "_prep_wrapped_messages") as prep: client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6625,7 +6614,7 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.JobsTransport, "_prep_wrapped_messages") as prep: transport_class = JobsClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6634,7 +6623,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6649,7 +6638,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6679,7 +6668,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6707,7 +6696,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6737,7 +6726,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6765,7 +6754,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6795,7 +6784,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -6823,7 +6812,7 @@ def test_wait_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.WaitOperationRequest ): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6853,7 +6842,7 @@ def test_wait_operation_rest_bad_request( ) def test_wait_operation_rest(request_type): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6879,7 +6868,7 @@ def test_wait_operation_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6904,7 +6893,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6928,7 +6917,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6957,7 +6946,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6984,7 +6973,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -7002,7 +6991,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -7018,7 +7007,7 @@ async def test_delete_operation_from_dict_async(): def test_wait_operation(transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7043,7 +7032,7 @@ def test_wait_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_wait_operation(transport: str = "grpc_asyncio"): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7069,7 +7058,7 @@ async def test_wait_operation(transport: str = "grpc_asyncio"): def test_wait_operation_field_headers(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7098,7 +7087,7 @@ def test_wait_operation_field_headers(): @pytest.mark.asyncio async def test_wait_operation_field_headers_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7127,7 +7116,7 @@ async def test_wait_operation_field_headers_async(): def test_wait_operation_from_dict(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -7145,7 +7134,7 @@ def test_wait_operation_from_dict(): @pytest.mark.asyncio async def test_wait_operation_from_dict_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -7163,7 +7152,7 @@ async def test_wait_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7188,7 +7177,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7214,7 +7203,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7243,7 +7232,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7272,7 +7261,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7290,7 +7279,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7308,7 +7297,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7333,7 +7322,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7359,7 +7348,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7388,7 +7377,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7417,7 +7406,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7435,7 +7424,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = JobsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7459,7 +7448,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -7476,7 +7465,7 @@ def test_client_ctx(): ] for transport in transports: client = JobsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_revisions.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_revisions.py index c76f3907a22c..f879447168dd 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_revisions.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_revisions.py @@ -91,18 +91,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -304,7 +292,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -331,42 +319,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -377,7 +372,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_revisions_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -429,7 +424,7 @@ def test_revisions_client_service_account_always_use_jwt( ], ) def test_revisions_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -490,9 +485,7 @@ def test_revisions_client_get_transport_class(): def test_revisions_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(RevisionsClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -885,20 +878,20 @@ def test_revisions_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -910,13 +903,11 @@ def test_revisions_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -932,8 +923,7 @@ def test_revisions_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1074,8 +1064,8 @@ def test_revisions_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1104,7 +1094,7 @@ def test_revisions_client_create_channel_credentials_file( ) def test_get_revision(request_type, transport: str = "grpc"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1170,7 +1160,7 @@ def test_get_revision_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1187,7 +1177,7 @@ async def test_get_revision_async( transport: str = "grpc_asyncio", request_type=revision.GetRevisionRequest ): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1258,7 +1248,7 @@ async def test_get_revision_async_from_dict(): def test_get_revision_routing_parameters(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1284,7 +1274,7 @@ def test_get_revision_routing_parameters(): def test_get_revision_flattened(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1308,7 +1298,7 @@ def test_get_revision_flattened(): def test_get_revision_flattened_error(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1323,7 +1313,7 @@ def test_get_revision_flattened_error(): @pytest.mark.asyncio async def test_get_revision_flattened_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1350,7 +1340,7 @@ async def test_get_revision_flattened_async(): @pytest.mark.asyncio async def test_get_revision_flattened_error_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1371,7 +1361,7 @@ async def test_get_revision_flattened_error_async(): ) def test_list_revisions(request_type, transport: str = "grpc"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1401,7 +1391,7 @@ def test_list_revisions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1418,7 +1408,7 @@ async def test_list_revisions_async( transport: str = "grpc_asyncio", request_type=revision.ListRevisionsRequest ): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1453,7 +1443,7 @@ async def test_list_revisions_async_from_dict(): def test_list_revisions_routing_parameters(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1479,7 +1469,7 @@ def test_list_revisions_routing_parameters(): def test_list_revisions_flattened(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1503,7 +1493,7 @@ def test_list_revisions_flattened(): def test_list_revisions_flattened_error(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1518,7 +1508,7 @@ def test_list_revisions_flattened_error(): @pytest.mark.asyncio async def test_list_revisions_flattened_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1547,7 +1537,7 @@ async def test_list_revisions_flattened_async(): @pytest.mark.asyncio async def test_list_revisions_flattened_error_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1561,7 +1551,7 @@ async def test_list_revisions_flattened_error_async(): def test_list_revisions_pager(transport_name: str = "grpc"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1608,7 +1598,7 @@ def test_list_revisions_pager(transport_name: str = "grpc"): def test_list_revisions_pages(transport_name: str = "grpc"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1650,7 +1640,7 @@ def test_list_revisions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_revisions_async_pager(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1700,7 +1690,7 @@ async def test_list_revisions_async_pager(): @pytest.mark.asyncio async def test_list_revisions_async_pages(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1755,7 +1745,7 @@ async def test_list_revisions_async_pages(): ) def test_delete_revision(request_type, transport: str = "grpc"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1782,7 +1772,7 @@ def test_delete_revision_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1799,7 +1789,7 @@ async def test_delete_revision_async( transport: str = "grpc_asyncio", request_type=revision.DeleteRevisionRequest ): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1831,7 +1821,7 @@ async def test_delete_revision_async_from_dict(): def test_delete_revision_routing_parameters(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1857,7 +1847,7 @@ def test_delete_revision_routing_parameters(): def test_delete_revision_flattened(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1881,7 +1871,7 @@ def test_delete_revision_flattened(): def test_delete_revision_flattened_error(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1896,7 +1886,7 @@ def test_delete_revision_flattened_error(): @pytest.mark.asyncio async def test_delete_revision_flattened_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1925,7 +1915,7 @@ async def test_delete_revision_flattened_async(): @pytest.mark.asyncio async def test_delete_revision_flattened_error_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1946,7 +1936,7 @@ async def test_delete_revision_flattened_error_async(): ) def test_get_revision_rest(request_type): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2033,7 +2023,7 @@ def test_get_revision_rest_required_fields(request_type=revision.GetRevisionRequ # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_revision._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2042,7 +2032,7 @@ def test_get_revision_rest_required_fields(request_type=revision.GetRevisionRequ jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_revision._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2051,7 +2041,7 @@ def test_get_revision_rest_required_fields(request_type=revision.GetRevisionRequ assert jsonified_request["name"] == "name_value" client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2093,7 +2083,7 @@ def test_get_revision_rest_required_fields(request_type=revision.GetRevisionRequ def test_get_revision_rest_unset_required_fields(): transport = transports.RevisionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_revision._get_unset_required_fields({}) @@ -2103,7 +2093,7 @@ def test_get_revision_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_revision_rest_interceptors(null_interceptor): transport = transports.RevisionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RevisionsRestInterceptor(), ) client = RevisionsClient(transport=transport) @@ -2155,7 +2145,7 @@ def test_get_revision_rest_bad_request( transport: str = "rest", request_type=revision.GetRevisionRequest ): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2179,7 +2169,7 @@ def test_get_revision_rest_bad_request( def test_get_revision_rest_flattened(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2223,7 +2213,7 @@ def test_get_revision_rest_flattened(): def test_get_revision_rest_flattened_error(transport: str = "rest"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2238,7 +2228,7 @@ def test_get_revision_rest_flattened_error(transport: str = "rest"): def test_get_revision_rest_error(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2251,7 +2241,7 @@ def test_get_revision_rest_error(): ) def test_list_revisions_rest(request_type): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2302,7 +2292,7 @@ def test_list_revisions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_revisions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2311,7 +2301,7 @@ def test_list_revisions_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_revisions._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2328,7 +2318,7 @@ def test_list_revisions_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2370,7 +2360,7 @@ def test_list_revisions_rest_required_fields( def test_list_revisions_rest_unset_required_fields(): transport = transports.RevisionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_revisions._get_unset_required_fields({}) @@ -2389,7 +2379,7 @@ def test_list_revisions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_revisions_rest_interceptors(null_interceptor): transport = transports.RevisionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RevisionsRestInterceptor(), ) client = RevisionsClient(transport=transport) @@ -2443,7 +2433,7 @@ def test_list_revisions_rest_bad_request( transport: str = "rest", request_type=revision.ListRevisionsRequest ): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2465,7 +2455,7 @@ def test_list_revisions_rest_bad_request( def test_list_revisions_rest_flattened(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2509,7 +2499,7 @@ def test_list_revisions_rest_flattened(): def test_list_revisions_rest_flattened_error(transport: str = "rest"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2524,7 +2514,7 @@ def test_list_revisions_rest_flattened_error(transport: str = "rest"): def test_list_revisions_rest_pager(transport: str = "rest"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2594,7 +2584,7 @@ def test_list_revisions_rest_pager(transport: str = "rest"): ) def test_delete_revision_rest(request_type): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2642,7 +2632,7 @@ def test_delete_revision_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_revision._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2651,7 +2641,7 @@ def test_delete_revision_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_revision._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2667,7 +2657,7 @@ def test_delete_revision_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2706,7 +2696,7 @@ def test_delete_revision_rest_required_fields( def test_delete_revision_rest_unset_required_fields(): transport = transports.RevisionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_revision._get_unset_required_fields({}) @@ -2724,7 +2714,7 @@ def test_delete_revision_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_revision_rest_interceptors(null_interceptor): transport = transports.RevisionsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RevisionsRestInterceptor(), ) client = RevisionsClient(transport=transport) @@ -2780,7 +2770,7 @@ def test_delete_revision_rest_bad_request( transport: str = "rest", request_type=revision.DeleteRevisionRequest ): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2804,7 +2794,7 @@ def test_delete_revision_rest_bad_request( def test_delete_revision_rest_flattened(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2846,7 +2836,7 @@ def test_delete_revision_rest_flattened(): def test_delete_revision_rest_flattened_error(transport: str = "rest"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2861,24 +2851,24 @@ def test_delete_revision_rest_flattened_error(transport: str = "rest"): def test_delete_revision_rest_error(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.RevisionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.RevisionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = RevisionsClient( @@ -2888,7 +2878,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.RevisionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -2903,13 +2893,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RevisionsClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.RevisionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = RevisionsClient( @@ -2921,7 +2910,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.RevisionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = RevisionsClient(transport=transport) assert client.transport is transport @@ -2930,13 +2919,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.RevisionsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.RevisionsGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -2953,7 +2942,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -2967,7 +2956,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = RevisionsClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -2975,7 +2964,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -2987,7 +2976,7 @@ def test_revisions_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.RevisionsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -2999,7 +2988,7 @@ def test_revisions_base_transport(): ) as Transport: Transport.return_value = None transport = transports.RevisionsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3042,7 +3031,7 @@ def test_revisions_base_transport_with_credentials_file(): "google.cloud.run_v2.services.revisions.transports.RevisionsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RevisionsTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3061,7 +3050,7 @@ def test_revisions_base_transport_with_adc(): "google.cloud.run_v2.services.revisions.transports.RevisionsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RevisionsTransport() adc.assert_called_once() @@ -3069,7 +3058,7 @@ def test_revisions_base_transport_with_adc(): def test_revisions_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) RevisionsClient() adc.assert_called_once_with( scopes=None, @@ -3089,7 +3078,7 @@ def test_revisions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3136,7 +3125,7 @@ def test_revisions_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3161,7 +3150,7 @@ def test_revisions_transport_create_channel(transport_class, grpc_helpers): [transports.RevisionsGrpcTransport, transports.RevisionsGrpcAsyncIOTransport], ) def test_revisions_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3199,7 +3188,7 @@ def test_revisions_grpc_transport_client_cert_source_for_mtls(transport_class): def test_revisions_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3211,7 +3200,7 @@ def test_revisions_http_transport_client_cert_source_for_mtls(): def test_revisions_rest_lro_client(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3236,7 +3225,7 @@ def test_revisions_rest_lro_client(): ) def test_revisions_host_no_port(transport_name): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions(api_endpoint="run.googleapis.com"), transport=transport_name, ) @@ -3257,7 +3246,7 @@ def test_revisions_host_no_port(transport_name): ) def test_revisions_host_with_port(transport_name): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="run.googleapis.com:8000" ), @@ -3277,8 +3266,8 @@ def test_revisions_host_with_port(transport_name): ], ) def test_revisions_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = RevisionsClient( credentials=creds1, transport=transport_name, @@ -3343,7 +3332,7 @@ def test_revisions_transport_channel_mtls_with_client_cert_source(transport_clas mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3418,7 +3407,7 @@ def test_revisions_transport_channel_mtls_with_adc(transport_class): def test_revisions_grpc_lro_client(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -3435,7 +3424,7 @@ def test_revisions_grpc_lro_client(): def test_revisions_grpc_lro_async_client(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -3719,7 +3708,7 @@ def test_client_with_default_client_info(): transports.RevisionsTransport, "_prep_wrapped_messages" ) as prep: client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3729,7 +3718,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RevisionsClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3738,7 +3727,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -3753,7 +3742,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3783,7 +3772,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -3811,7 +3800,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3841,7 +3830,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -3869,7 +3858,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3899,7 +3888,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -3927,7 +3916,7 @@ def test_wait_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.WaitOperationRequest ): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3957,7 +3946,7 @@ def test_wait_operation_rest_bad_request( ) def test_wait_operation_rest(request_type): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -3983,7 +3972,7 @@ def test_wait_operation_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4008,7 +3997,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4032,7 +4021,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4061,7 +4050,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4088,7 +4077,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -4106,7 +4095,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -4122,7 +4111,7 @@ async def test_delete_operation_from_dict_async(): def test_wait_operation(transport: str = "grpc"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4147,7 +4136,7 @@ def test_wait_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_wait_operation(transport: str = "grpc_asyncio"): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4173,7 +4162,7 @@ async def test_wait_operation(transport: str = "grpc_asyncio"): def test_wait_operation_field_headers(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4202,7 +4191,7 @@ def test_wait_operation_field_headers(): @pytest.mark.asyncio async def test_wait_operation_field_headers_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4231,7 +4220,7 @@ async def test_wait_operation_field_headers_async(): def test_wait_operation_from_dict(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -4249,7 +4238,7 @@ def test_wait_operation_from_dict(): @pytest.mark.asyncio async def test_wait_operation_from_dict_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -4267,7 +4256,7 @@ async def test_wait_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4292,7 +4281,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4318,7 +4307,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4347,7 +4336,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4376,7 +4365,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4394,7 +4383,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4412,7 +4401,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4437,7 +4426,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4463,7 +4452,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4492,7 +4481,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4521,7 +4510,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4539,7 +4528,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = RevisionsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4563,7 +4552,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -4580,7 +4569,7 @@ def test_client_ctx(): ] for transport in transports: client = RevisionsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_services.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_services.py index e03b5f4391ea..83a6f2c60285 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_services.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_services.py @@ -99,18 +99,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -309,7 +297,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -336,42 +324,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -382,7 +377,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_services_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -434,7 +429,7 @@ def test_services_client_service_account_always_use_jwt( ], ) def test_services_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -491,9 +486,7 @@ def test_services_client_get_transport_class(): def test_services_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(ServicesClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -886,20 +879,20 @@ def test_services_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -911,13 +904,11 @@ def test_services_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -933,8 +924,7 @@ def test_services_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1071,8 +1061,8 @@ def test_services_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1101,7 +1091,7 @@ def test_services_client_create_channel_credentials_file( ) def test_create_service(request_type, transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1128,7 +1118,7 @@ def test_create_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1145,7 +1135,7 @@ async def test_create_service_async( transport: str = "grpc_asyncio", request_type=gcr_service.CreateServiceRequest ): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1177,7 +1167,7 @@ async def test_create_service_async_from_dict(): def test_create_service_routing_parameters(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1203,7 +1193,7 @@ def test_create_service_routing_parameters(): def test_create_service_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1235,7 +1225,7 @@ def test_create_service_flattened(): def test_create_service_flattened_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1252,7 +1242,7 @@ def test_create_service_flattened_error(): @pytest.mark.asyncio async def test_create_service_flattened_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1289,7 +1279,7 @@ async def test_create_service_flattened_async(): @pytest.mark.asyncio async def test_create_service_flattened_error_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1312,7 +1302,7 @@ async def test_create_service_flattened_error_async(): ) def test_get_service(request_type, transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1376,7 +1366,7 @@ def test_get_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1393,7 +1383,7 @@ async def test_get_service_async( transport: str = "grpc_asyncio", request_type=service.GetServiceRequest ): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1462,7 +1452,7 @@ async def test_get_service_async_from_dict(): def test_get_service_routing_parameters(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1488,7 +1478,7 @@ def test_get_service_routing_parameters(): def test_get_service_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1512,7 +1502,7 @@ def test_get_service_flattened(): def test_get_service_flattened_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1527,7 +1517,7 @@ def test_get_service_flattened_error(): @pytest.mark.asyncio async def test_get_service_flattened_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1554,7 +1544,7 @@ async def test_get_service_flattened_async(): @pytest.mark.asyncio async def test_get_service_flattened_error_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1575,7 +1565,7 @@ async def test_get_service_flattened_error_async(): ) def test_list_services(request_type, transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1605,7 +1595,7 @@ def test_list_services_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1622,7 +1612,7 @@ async def test_list_services_async( transport: str = "grpc_asyncio", request_type=service.ListServicesRequest ): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1657,7 +1647,7 @@ async def test_list_services_async_from_dict(): def test_list_services_routing_parameters(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1683,7 +1673,7 @@ def test_list_services_routing_parameters(): def test_list_services_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1707,7 +1697,7 @@ def test_list_services_flattened(): def test_list_services_flattened_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1722,7 +1712,7 @@ def test_list_services_flattened_error(): @pytest.mark.asyncio async def test_list_services_flattened_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1751,7 +1741,7 @@ async def test_list_services_flattened_async(): @pytest.mark.asyncio async def test_list_services_flattened_error_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1765,7 +1755,7 @@ async def test_list_services_flattened_error_async(): def test_list_services_pager(transport_name: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1812,7 +1802,7 @@ def test_list_services_pager(transport_name: str = "grpc"): def test_list_services_pages(transport_name: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1854,7 +1844,7 @@ def test_list_services_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_services_async_pager(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1904,7 +1894,7 @@ async def test_list_services_async_pager(): @pytest.mark.asyncio async def test_list_services_async_pages(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1959,7 +1949,7 @@ async def test_list_services_async_pages(): ) def test_update_service(request_type, transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1986,7 +1976,7 @@ def test_update_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2003,7 +1993,7 @@ async def test_update_service_async( transport: str = "grpc_asyncio", request_type=gcr_service.UpdateServiceRequest ): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2035,7 +2025,7 @@ async def test_update_service_async_from_dict(): def test_update_service_routing_parameters(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2061,7 +2051,7 @@ def test_update_service_routing_parameters(): def test_update_service_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2085,7 +2075,7 @@ def test_update_service_flattened(): def test_update_service_flattened_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2100,7 +2090,7 @@ def test_update_service_flattened_error(): @pytest.mark.asyncio async def test_update_service_flattened_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2129,7 +2119,7 @@ async def test_update_service_flattened_async(): @pytest.mark.asyncio async def test_update_service_flattened_error_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2150,7 +2140,7 @@ async def test_update_service_flattened_error_async(): ) def test_delete_service(request_type, transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2177,7 +2167,7 @@ def test_delete_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2194,7 +2184,7 @@ async def test_delete_service_async( transport: str = "grpc_asyncio", request_type=service.DeleteServiceRequest ): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2226,7 +2216,7 @@ async def test_delete_service_async_from_dict(): def test_delete_service_routing_parameters(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2252,7 +2242,7 @@ def test_delete_service_routing_parameters(): def test_delete_service_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2276,7 +2266,7 @@ def test_delete_service_flattened(): def test_delete_service_flattened_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2291,7 +2281,7 @@ def test_delete_service_flattened_error(): @pytest.mark.asyncio async def test_delete_service_flattened_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2320,7 +2310,7 @@ async def test_delete_service_flattened_async(): @pytest.mark.asyncio async def test_delete_service_flattened_error_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2341,7 +2331,7 @@ async def test_delete_service_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2373,7 +2363,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2390,7 +2380,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2427,7 +2417,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2457,7 +2447,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2486,7 +2476,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2510,7 +2500,7 @@ def test_get_iam_policy_from_dict_foreign(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2542,7 +2532,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2559,7 +2549,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2596,7 +2586,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2626,7 +2616,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2655,7 +2645,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -2680,7 +2670,7 @@ def test_set_iam_policy_from_dict_foreign(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2712,7 +2702,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2732,7 +2722,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2769,7 +2759,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2801,7 +2791,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2834,7 +2824,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2860,7 +2850,7 @@ def test_test_iam_permissions_from_dict_foreign(): ) def test_create_service_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3123,7 +3113,7 @@ def test_create_service_rest_required_fields( assert "serviceId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3135,7 +3125,7 @@ def test_create_service_rest_required_fields( jsonified_request["serviceId"] = "service_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3153,7 +3143,7 @@ def test_create_service_rest_required_fields( assert jsonified_request["serviceId"] == "service_id_value" client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3199,7 +3189,7 @@ def test_create_service_rest_required_fields( def test_create_service_rest_unset_required_fields(): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_service._get_unset_required_fields({}) @@ -3223,7 +3213,7 @@ def test_create_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_service_rest_interceptors(null_interceptor): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), ) client = ServicesClient(transport=transport) @@ -3281,7 +3271,7 @@ def test_create_service_rest_bad_request( transport: str = "rest", request_type=gcr_service.CreateServiceRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3303,7 +3293,7 @@ def test_create_service_rest_bad_request( def test_create_service_rest_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3344,7 +3334,7 @@ def test_create_service_rest_flattened(): def test_create_service_rest_flattened_error(transport: str = "rest"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3361,7 +3351,7 @@ def test_create_service_rest_flattened_error(transport: str = "rest"): def test_create_service_rest_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3374,7 +3364,7 @@ def test_create_service_rest_error(): ) def test_get_service_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3457,7 +3447,7 @@ def test_get_service_rest_required_fields(request_type=service.GetServiceRequest # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3466,7 +3456,7 @@ def test_get_service_rest_required_fields(request_type=service.GetServiceRequest jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3475,7 +3465,7 @@ def test_get_service_rest_required_fields(request_type=service.GetServiceRequest assert jsonified_request["name"] == "name_value" client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3517,7 +3507,7 @@ def test_get_service_rest_required_fields(request_type=service.GetServiceRequest def test_get_service_rest_unset_required_fields(): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_service._get_unset_required_fields({}) @@ -3527,7 +3517,7 @@ def test_get_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_service_rest_interceptors(null_interceptor): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), ) client = ServicesClient(transport=transport) @@ -3579,7 +3569,7 @@ def test_get_service_rest_bad_request( transport: str = "rest", request_type=service.GetServiceRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3601,7 +3591,7 @@ def test_get_service_rest_bad_request( def test_get_service_rest_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3642,7 +3632,7 @@ def test_get_service_rest_flattened(): def test_get_service_rest_flattened_error(transport: str = "rest"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3657,7 +3647,7 @@ def test_get_service_rest_flattened_error(transport: str = "rest"): def test_get_service_rest_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3670,7 +3660,7 @@ def test_get_service_rest_error(): ) def test_list_services_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3719,7 +3709,7 @@ def test_list_services_rest_required_fields(request_type=service.ListServicesReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_services._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3728,7 +3718,7 @@ def test_list_services_rest_required_fields(request_type=service.ListServicesReq jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_services._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3745,7 +3735,7 @@ def test_list_services_rest_required_fields(request_type=service.ListServicesReq assert jsonified_request["parent"] == "parent_value" client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3787,7 +3777,7 @@ def test_list_services_rest_required_fields(request_type=service.ListServicesReq def test_list_services_rest_unset_required_fields(): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_services._get_unset_required_fields({}) @@ -3806,7 +3796,7 @@ def test_list_services_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_services_rest_interceptors(null_interceptor): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), ) client = ServicesClient(transport=transport) @@ -3860,7 +3850,7 @@ def test_list_services_rest_bad_request( transport: str = "rest", request_type=service.ListServicesRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3882,7 +3872,7 @@ def test_list_services_rest_bad_request( def test_list_services_rest_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3923,7 +3913,7 @@ def test_list_services_rest_flattened(): def test_list_services_rest_flattened_error(transport: str = "rest"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3938,7 +3928,7 @@ def test_list_services_rest_flattened_error(transport: str = "rest"): def test_list_services_rest_pager(transport: str = "rest"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4006,7 +3996,7 @@ def test_list_services_rest_pager(transport: str = "rest"): ) def test_update_service_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4268,14 +4258,14 @@ def test_update_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_service._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4289,7 +4279,7 @@ def test_update_service_rest_required_fields( # verify required fields with non-default values are left alone client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4329,7 +4319,7 @@ def test_update_service_rest_required_fields( def test_update_service_rest_unset_required_fields(): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_service._get_unset_required_fields({}) @@ -4347,7 +4337,7 @@ def test_update_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_service_rest_interceptors(null_interceptor): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), ) client = ServicesClient(transport=transport) @@ -4405,7 +4395,7 @@ def test_update_service_rest_bad_request( transport: str = "rest", request_type=gcr_service.UpdateServiceRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4429,7 +4419,7 @@ def test_update_service_rest_bad_request( def test_update_service_rest_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4471,7 +4461,7 @@ def test_update_service_rest_flattened(): def test_update_service_rest_flattened_error(transport: str = "rest"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4486,7 +4476,7 @@ def test_update_service_rest_flattened_error(transport: str = "rest"): def test_update_service_rest_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4499,7 +4489,7 @@ def test_update_service_rest_error(): ) def test_delete_service_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4543,7 +4533,7 @@ def test_delete_service_rest_required_fields(request_type=service.DeleteServiceR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4552,7 +4542,7 @@ def test_delete_service_rest_required_fields(request_type=service.DeleteServiceR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_service._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4568,7 +4558,7 @@ def test_delete_service_rest_required_fields(request_type=service.DeleteServiceR assert jsonified_request["name"] == "name_value" client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4607,7 +4597,7 @@ def test_delete_service_rest_required_fields(request_type=service.DeleteServiceR def test_delete_service_rest_unset_required_fields(): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_service._get_unset_required_fields({}) @@ -4625,7 +4615,7 @@ def test_delete_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_service_rest_interceptors(null_interceptor): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), ) client = ServicesClient(transport=transport) @@ -4681,7 +4671,7 @@ def test_delete_service_rest_bad_request( transport: str = "rest", request_type=service.DeleteServiceRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4703,7 +4693,7 @@ def test_delete_service_rest_bad_request( def test_delete_service_rest_flattened(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4742,7 +4732,7 @@ def test_delete_service_rest_flattened(): def test_delete_service_rest_flattened_error(transport: str = "rest"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4757,7 +4747,7 @@ def test_delete_service_rest_flattened_error(transport: str = "rest"): def test_delete_service_rest_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4770,7 +4760,7 @@ def test_delete_service_rest_error(): ) def test_get_iam_policy_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4821,7 +4811,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4830,7 +4820,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("options",)) @@ -4841,7 +4831,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4881,7 +4871,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -4891,7 +4881,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), ) client = ServicesClient(transport=transport) @@ -4943,7 +4933,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4965,7 +4955,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4978,7 +4968,7 @@ def test_get_iam_policy_rest_error(): ) def test_set_iam_policy_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5029,7 +5019,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5038,7 +5028,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5047,7 +5037,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5088,7 +5078,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -5106,7 +5096,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), ) client = ServicesClient(transport=transport) @@ -5158,7 +5148,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5180,7 +5170,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5193,7 +5183,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5243,7 +5233,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5253,7 +5243,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5264,7 +5254,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5305,7 +5295,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -5323,7 +5313,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.ServicesRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServicesRestInterceptor(), ) client = ServicesClient(transport=transport) @@ -5377,7 +5367,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5399,24 +5389,24 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_error(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServicesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServicesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServicesClient( @@ -5426,7 +5416,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ServicesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5441,13 +5431,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ServicesClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ServicesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServicesClient( @@ -5459,7 +5448,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServicesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServicesClient(transport=transport) assert client.transport is transport @@ -5468,13 +5457,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServicesGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServicesGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -5491,7 +5480,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -5505,7 +5494,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ServicesClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -5513,7 +5502,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -5525,7 +5514,7 @@ def test_services_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServicesTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -5537,7 +5526,7 @@ def test_services_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServicesTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -5585,7 +5574,7 @@ def test_services_base_transport_with_credentials_file(): "google.cloud.run_v2.services.services.transports.ServicesTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServicesTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -5604,7 +5593,7 @@ def test_services_base_transport_with_adc(): "google.cloud.run_v2.services.services.transports.ServicesTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServicesTransport() adc.assert_called_once() @@ -5612,7 +5601,7 @@ def test_services_base_transport_with_adc(): def test_services_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ServicesClient() adc.assert_called_once_with( scopes=None, @@ -5632,7 +5621,7 @@ def test_services_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -5679,7 +5668,7 @@ def test_services_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -5704,7 +5693,7 @@ def test_services_transport_create_channel(transport_class, grpc_helpers): [transports.ServicesGrpcTransport, transports.ServicesGrpcAsyncIOTransport], ) def test_services_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -5742,7 +5731,7 @@ def test_services_grpc_transport_client_cert_source_for_mtls(transport_class): def test_services_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -5754,7 +5743,7 @@ def test_services_http_transport_client_cert_source_for_mtls(): def test_services_rest_lro_client(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -5779,7 +5768,7 @@ def test_services_rest_lro_client(): ) def test_services_host_no_port(transport_name): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions(api_endpoint="run.googleapis.com"), transport=transport_name, ) @@ -5800,7 +5789,7 @@ def test_services_host_no_port(transport_name): ) def test_services_host_with_port(transport_name): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="run.googleapis.com:8000" ), @@ -5820,8 +5809,8 @@ def test_services_host_with_port(transport_name): ], ) def test_services_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ServicesClient( credentials=creds1, transport=transport_name, @@ -5901,7 +5890,7 @@ def test_services_transport_channel_mtls_with_client_cert_source(transport_class mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -5976,7 +5965,7 @@ def test_services_transport_channel_mtls_with_adc(transport_class): def test_services_grpc_lro_client(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -5993,7 +5982,7 @@ def test_services_grpc_lro_client(): def test_services_grpc_lro_async_client(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -6277,7 +6266,7 @@ def test_client_with_default_client_info(): transports.ServicesTransport, "_prep_wrapped_messages" ) as prep: client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6287,7 +6276,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServicesClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6296,7 +6285,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6311,7 +6300,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6341,7 +6330,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6369,7 +6358,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6399,7 +6388,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6427,7 +6416,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6457,7 +6446,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -6485,7 +6474,7 @@ def test_wait_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.WaitOperationRequest ): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6515,7 +6504,7 @@ def test_wait_operation_rest_bad_request( ) def test_wait_operation_rest(request_type): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6541,7 +6530,7 @@ def test_wait_operation_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6566,7 +6555,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6590,7 +6579,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6619,7 +6608,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6646,7 +6635,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -6664,7 +6653,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -6680,7 +6669,7 @@ async def test_delete_operation_from_dict_async(): def test_wait_operation(transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6705,7 +6694,7 @@ def test_wait_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_wait_operation(transport: str = "grpc_asyncio"): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6731,7 +6720,7 @@ async def test_wait_operation(transport: str = "grpc_asyncio"): def test_wait_operation_field_headers(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6760,7 +6749,7 @@ def test_wait_operation_field_headers(): @pytest.mark.asyncio async def test_wait_operation_field_headers_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6789,7 +6778,7 @@ async def test_wait_operation_field_headers_async(): def test_wait_operation_from_dict(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -6807,7 +6796,7 @@ def test_wait_operation_from_dict(): @pytest.mark.asyncio async def test_wait_operation_from_dict_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -6825,7 +6814,7 @@ async def test_wait_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6850,7 +6839,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6876,7 +6865,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6905,7 +6894,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6934,7 +6923,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6952,7 +6941,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -6970,7 +6959,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6995,7 +6984,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7021,7 +7010,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7050,7 +7039,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7079,7 +7068,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7097,7 +7086,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ServicesAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7121,7 +7110,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -7138,7 +7127,7 @@ def test_client_ctx(): ] for transport in transports: client = ServicesClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_tasks.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_tasks.py index 513125420155..592288addad9 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_tasks.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_tasks.py @@ -81,18 +81,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -279,7 +267,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -306,42 +294,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -352,7 +347,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_tasks_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -402,7 +397,7 @@ def test_tasks_client_service_account_always_use_jwt(transport_class, transport_ ], ) def test_tasks_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -459,9 +454,7 @@ def test_tasks_client_get_transport_class(): def test_tasks_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(TasksClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -852,20 +845,20 @@ def test_tasks_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -877,13 +870,11 @@ def test_tasks_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -899,8 +890,7 @@ def test_tasks_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1037,8 +1027,8 @@ def test_tasks_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1067,7 +1057,7 @@ def test_tasks_client_create_channel_credentials_file( ) def test_get_task(request_type, transport: str = "grpc"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1130,7 +1120,7 @@ def test_get_task_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1147,7 +1137,7 @@ async def test_get_task_async( transport: str = "grpc_asyncio", request_type=task.GetTaskRequest ): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1215,7 +1205,7 @@ async def test_get_task_async_from_dict(): def test_get_task_field_headers(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1245,7 +1235,7 @@ def test_get_task_field_headers(): @pytest.mark.asyncio async def test_get_task_field_headers_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1274,7 +1264,7 @@ async def test_get_task_field_headers_async(): def test_get_task_flattened(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1298,7 +1288,7 @@ def test_get_task_flattened(): def test_get_task_flattened_error(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1313,7 +1303,7 @@ def test_get_task_flattened_error(): @pytest.mark.asyncio async def test_get_task_flattened_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1340,7 +1330,7 @@ async def test_get_task_flattened_async(): @pytest.mark.asyncio async def test_get_task_flattened_error_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1361,7 +1351,7 @@ async def test_get_task_flattened_error_async(): ) def test_list_tasks(request_type, transport: str = "grpc"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1391,7 +1381,7 @@ def test_list_tasks_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1408,7 +1398,7 @@ async def test_list_tasks_async( transport: str = "grpc_asyncio", request_type=task.ListTasksRequest ): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1443,7 +1433,7 @@ async def test_list_tasks_async_from_dict(): def test_list_tasks_field_headers(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1473,7 +1463,7 @@ def test_list_tasks_field_headers(): @pytest.mark.asyncio async def test_list_tasks_field_headers_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1504,7 +1494,7 @@ async def test_list_tasks_field_headers_async(): def test_list_tasks_flattened(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1528,7 +1518,7 @@ def test_list_tasks_flattened(): def test_list_tasks_flattened_error(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1543,7 +1533,7 @@ def test_list_tasks_flattened_error(): @pytest.mark.asyncio async def test_list_tasks_flattened_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1572,7 +1562,7 @@ async def test_list_tasks_flattened_async(): @pytest.mark.asyncio async def test_list_tasks_flattened_error_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1586,7 +1576,7 @@ async def test_list_tasks_flattened_error_async(): def test_list_tasks_pager(transport_name: str = "grpc"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1636,7 +1626,7 @@ def test_list_tasks_pager(transport_name: str = "grpc"): def test_list_tasks_pages(transport_name: str = "grpc"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1678,7 +1668,7 @@ def test_list_tasks_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_tasks_async_pager(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1728,7 +1718,7 @@ async def test_list_tasks_async_pager(): @pytest.mark.asyncio async def test_list_tasks_async_pages(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1783,7 +1773,7 @@ async def test_list_tasks_async_pages(): ) def test_get_task_rest(request_type): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1867,7 +1857,7 @@ def test_get_task_rest_required_fields(request_type=task.GetTaskRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_task._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1876,7 +1866,7 @@ def test_get_task_rest_required_fields(request_type=task.GetTaskRequest): jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_task._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1885,7 +1875,7 @@ def test_get_task_rest_required_fields(request_type=task.GetTaskRequest): assert jsonified_request["name"] == "name_value" client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1927,7 +1917,7 @@ def test_get_task_rest_required_fields(request_type=task.GetTaskRequest): def test_get_task_rest_unset_required_fields(): transport = transports.TasksRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_task._get_unset_required_fields({}) @@ -1937,7 +1927,7 @@ def test_get_task_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_task_rest_interceptors(null_interceptor): transport = transports.TasksRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TasksRestInterceptor(), ) client = TasksClient(transport=transport) @@ -1989,7 +1979,7 @@ def test_get_task_rest_bad_request( transport: str = "rest", request_type=task.GetTaskRequest ): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2013,7 +2003,7 @@ def test_get_task_rest_bad_request( def test_get_task_rest_flattened(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2057,7 +2047,7 @@ def test_get_task_rest_flattened(): def test_get_task_rest_flattened_error(transport: str = "rest"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2072,7 +2062,7 @@ def test_get_task_rest_flattened_error(transport: str = "rest"): def test_get_task_rest_error(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2085,7 +2075,7 @@ def test_get_task_rest_error(): ) def test_list_tasks_rest(request_type): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2136,7 +2126,7 @@ def test_list_tasks_rest_required_fields(request_type=task.ListTasksRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tasks._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2145,7 +2135,7 @@ def test_list_tasks_rest_required_fields(request_type=task.ListTasksRequest): jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_tasks._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -2162,7 +2152,7 @@ def test_list_tasks_rest_required_fields(request_type=task.ListTasksRequest): assert jsonified_request["parent"] == "parent_value" client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2204,7 +2194,7 @@ def test_list_tasks_rest_required_fields(request_type=task.ListTasksRequest): def test_list_tasks_rest_unset_required_fields(): transport = transports.TasksRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_tasks._get_unset_required_fields({}) @@ -2223,7 +2213,7 @@ def test_list_tasks_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_tasks_rest_interceptors(null_interceptor): transport = transports.TasksRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.TasksRestInterceptor(), ) client = TasksClient(transport=transport) @@ -2277,7 +2267,7 @@ def test_list_tasks_rest_bad_request( transport: str = "rest", request_type=task.ListTasksRequest ): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2301,7 +2291,7 @@ def test_list_tasks_rest_bad_request( def test_list_tasks_rest_flattened(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2345,7 +2335,7 @@ def test_list_tasks_rest_flattened(): def test_list_tasks_rest_flattened_error(transport: str = "rest"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2360,7 +2350,7 @@ def test_list_tasks_rest_flattened_error(transport: str = "rest"): def test_list_tasks_rest_pager(transport: str = "rest"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2424,17 +2414,17 @@ def test_list_tasks_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.TasksGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.TasksGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TasksClient( @@ -2444,7 +2434,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.TasksGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -2459,13 +2449,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = TasksClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.TasksGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TasksClient( @@ -2477,7 +2466,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.TasksGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = TasksClient(transport=transport) assert client.transport is transport @@ -2486,13 +2475,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.TasksGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.TasksGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -2509,7 +2498,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -2523,7 +2512,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = TasksClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -2531,7 +2520,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -2543,7 +2532,7 @@ def test_tasks_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.TasksTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -2555,7 +2544,7 @@ def test_tasks_base_transport(): ) as Transport: Transport.return_value = None transport = transports.TasksTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -2592,7 +2581,7 @@ def test_tasks_base_transport_with_credentials_file(): "google.cloud.run_v2.services.tasks.transports.TasksTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TasksTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -2611,7 +2600,7 @@ def test_tasks_base_transport_with_adc(): "google.cloud.run_v2.services.tasks.transports.TasksTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TasksTransport() adc.assert_called_once() @@ -2619,7 +2608,7 @@ def test_tasks_base_transport_with_adc(): def test_tasks_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) TasksClient() adc.assert_called_once_with( scopes=None, @@ -2639,7 +2628,7 @@ def test_tasks_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2686,7 +2675,7 @@ def test_tasks_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2711,7 +2700,7 @@ def test_tasks_transport_create_channel(transport_class, grpc_helpers): [transports.TasksGrpcTransport, transports.TasksGrpcAsyncIOTransport], ) def test_tasks_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2749,7 +2738,7 @@ def test_tasks_grpc_transport_client_cert_source_for_mtls(transport_class): def test_tasks_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2769,7 +2758,7 @@ def test_tasks_http_transport_client_cert_source_for_mtls(): ) def test_tasks_host_no_port(transport_name): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions(api_endpoint="run.googleapis.com"), transport=transport_name, ) @@ -2790,7 +2779,7 @@ def test_tasks_host_no_port(transport_name): ) def test_tasks_host_with_port(transport_name): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="run.googleapis.com:8000" ), @@ -2810,8 +2799,8 @@ def test_tasks_host_with_port(transport_name): ], ) def test_tasks_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = TasksClient( credentials=creds1, transport=transport_name, @@ -2873,7 +2862,7 @@ def test_tasks_transport_channel_mtls_with_client_cert_source(transport_class): mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3245,7 +3234,7 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.TasksTransport, "_prep_wrapped_messages") as prep: client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3253,7 +3242,7 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.TasksTransport, "_prep_wrapped_messages") as prep: transport_class = TasksClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3262,7 +3251,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -3277,7 +3266,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3307,7 +3296,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -3335,7 +3324,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3365,7 +3354,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -3393,7 +3382,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3423,7 +3412,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -3451,7 +3440,7 @@ def test_wait_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.WaitOperationRequest ): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3481,7 +3470,7 @@ def test_wait_operation_rest_bad_request( ) def test_wait_operation_rest(request_type): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -3507,7 +3496,7 @@ def test_wait_operation_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3532,7 +3521,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3556,7 +3545,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3585,7 +3574,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3612,7 +3601,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -3630,7 +3619,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -3646,7 +3635,7 @@ async def test_delete_operation_from_dict_async(): def test_wait_operation(transport: str = "grpc"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3671,7 +3660,7 @@ def test_wait_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_wait_operation(transport: str = "grpc_asyncio"): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3697,7 +3686,7 @@ async def test_wait_operation(transport: str = "grpc_asyncio"): def test_wait_operation_field_headers(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3726,7 +3715,7 @@ def test_wait_operation_field_headers(): @pytest.mark.asyncio async def test_wait_operation_field_headers_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3755,7 +3744,7 @@ async def test_wait_operation_field_headers_async(): def test_wait_operation_from_dict(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -3773,7 +3762,7 @@ def test_wait_operation_from_dict(): @pytest.mark.asyncio async def test_wait_operation_from_dict_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.wait_operation), "__call__") as call: @@ -3791,7 +3780,7 @@ async def test_wait_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3816,7 +3805,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3842,7 +3831,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3871,7 +3860,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3900,7 +3889,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -3918,7 +3907,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -3936,7 +3925,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3961,7 +3950,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3987,7 +3976,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4016,7 +4005,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4045,7 +4034,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4063,7 +4052,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = TasksAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4087,7 +4076,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -4104,7 +4093,7 @@ def test_client_ctx(): ] for transport in transports: client = TasksClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler/gapic_version.py b/packages/google-cloud-scheduler/google/cloud/scheduler/gapic_version.py index 13e6df46e52c..360a0d13ebdd 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler/gapic_version.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.13.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1/gapic_version.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1/gapic_version.py index 13e6df46e52c..360a0d13ebdd 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1/gapic_version.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.13.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1/services/cloud_scheduler/client.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1/services/cloud_scheduler/client.py index 79fbecdcf2be..9bd4e1d84b14 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1/services/cloud_scheduler/client.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1/services/cloud_scheduler/client.py @@ -410,6 +410,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -428,6 +429,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -502,17 +504,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CloudSchedulerClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CloudSchedulerClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic_version.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic_version.py index 13e6df46e52c..360a0d13ebdd 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic_version.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.13.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/services/cloud_scheduler/client.py b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/services/cloud_scheduler/client.py index 493be265a25d..8316bddc622b 100644 --- a/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/services/cloud_scheduler/client.py +++ b/packages/google-cloud-scheduler/google/cloud/scheduler_v1beta1/services/cloud_scheduler/client.py @@ -410,6 +410,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -428,6 +429,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -502,17 +504,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CloudSchedulerClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CloudSchedulerClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-scheduler/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1.json b/packages/google-cloud-scheduler/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1.json index 8c3b216b2b39..4ab9d3e9fee8 100644 --- a/packages/google-cloud-scheduler/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1.json +++ b/packages/google-cloud-scheduler/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-scheduler", - "version": "2.13.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-scheduler/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1beta1.json b/packages/google-cloud-scheduler/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1beta1.json index 0c806d41a4c0..240bb08cb534 100644 --- a/packages/google-cloud-scheduler/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1beta1.json +++ b/packages/google-cloud-scheduler/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-scheduler", - "version": "2.13.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-scheduler/setup.py b/packages/google-cloud-scheduler/setup.py index fe21d2682c5e..f641bd58ce0f 100644 --- a/packages/google-cloud-scheduler/setup.py +++ b/packages/google-cloud-scheduler/setup.py @@ -40,6 +40,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-scheduler/testing/constraints-3.7.txt b/packages/google-cloud-scheduler/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-scheduler/testing/constraints-3.7.txt +++ b/packages/google-cloud-scheduler/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py b/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py index 2687e7e49501..80553e827b2a 100644 --- a/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py +++ b/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py @@ -86,18 +86,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -324,7 +312,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -351,42 +339,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -397,7 +392,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_cloud_scheduler_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -449,7 +444,7 @@ def test_cloud_scheduler_client_service_account_always_use_jwt( ], ) def test_cloud_scheduler_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -512,9 +507,7 @@ def test_cloud_scheduler_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CloudSchedulerClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -913,20 +906,20 @@ def test_cloud_scheduler_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -938,13 +931,11 @@ def test_cloud_scheduler_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -960,8 +951,7 @@ def test_cloud_scheduler_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1114,8 +1104,8 @@ def test_cloud_scheduler_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1144,7 +1134,7 @@ def test_cloud_scheduler_client_create_channel_credentials_file( ) def test_list_jobs(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1174,7 +1164,7 @@ def test_list_jobs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1191,7 +1181,7 @@ async def test_list_jobs_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.ListJobsRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1226,7 +1216,7 @@ async def test_list_jobs_async_from_dict(): def test_list_jobs_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1256,7 +1246,7 @@ def test_list_jobs_field_headers(): @pytest.mark.asyncio async def test_list_jobs_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1287,7 +1277,7 @@ async def test_list_jobs_field_headers_async(): def test_list_jobs_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1311,7 +1301,7 @@ def test_list_jobs_flattened(): def test_list_jobs_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1326,7 +1316,7 @@ def test_list_jobs_flattened_error(): @pytest.mark.asyncio async def test_list_jobs_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1355,7 +1345,7 @@ async def test_list_jobs_flattened_async(): @pytest.mark.asyncio async def test_list_jobs_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1369,7 +1359,7 @@ async def test_list_jobs_flattened_error_async(): def test_list_jobs_pager(transport_name: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1419,7 +1409,7 @@ def test_list_jobs_pager(transport_name: str = "grpc"): def test_list_jobs_pages(transport_name: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1461,7 +1451,7 @@ def test_list_jobs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_jobs_async_pager(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1511,7 +1501,7 @@ async def test_list_jobs_async_pager(): @pytest.mark.asyncio async def test_list_jobs_async_pages(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1566,7 +1556,7 @@ async def test_list_jobs_async_pages(): ) def test_get_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1604,7 +1594,7 @@ def test_get_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1621,7 +1611,7 @@ async def test_get_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.GetJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1664,7 +1654,7 @@ async def test_get_job_async_from_dict(): def test_get_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1694,7 +1684,7 @@ def test_get_job_field_headers(): @pytest.mark.asyncio async def test_get_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1723,7 +1713,7 @@ async def test_get_job_field_headers_async(): def test_get_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1747,7 +1737,7 @@ def test_get_job_flattened(): def test_get_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1762,7 +1752,7 @@ def test_get_job_flattened_error(): @pytest.mark.asyncio async def test_get_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1789,7 +1779,7 @@ async def test_get_job_flattened_async(): @pytest.mark.asyncio async def test_get_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1810,7 +1800,7 @@ async def test_get_job_flattened_error_async(): ) def test_create_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1848,7 +1838,7 @@ def test_create_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1865,7 +1855,7 @@ async def test_create_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.CreateJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1908,7 +1898,7 @@ async def test_create_job_async_from_dict(): def test_create_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1938,7 +1928,7 @@ def test_create_job_field_headers(): @pytest.mark.asyncio async def test_create_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1967,7 +1957,7 @@ async def test_create_job_field_headers_async(): def test_create_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1995,7 +1985,7 @@ def test_create_job_flattened(): def test_create_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2011,7 +2001,7 @@ def test_create_job_flattened_error(): @pytest.mark.asyncio async def test_create_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2042,7 +2032,7 @@ async def test_create_job_flattened_async(): @pytest.mark.asyncio async def test_create_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2064,7 +2054,7 @@ async def test_create_job_flattened_error_async(): ) def test_update_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2102,7 +2092,7 @@ def test_update_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2119,7 +2109,7 @@ async def test_update_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.UpdateJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2162,7 +2152,7 @@ async def test_update_job_async_from_dict(): def test_update_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2192,7 +2182,7 @@ def test_update_job_field_headers(): @pytest.mark.asyncio async def test_update_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2221,7 +2211,7 @@ async def test_update_job_field_headers_async(): def test_update_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2249,7 +2239,7 @@ def test_update_job_flattened(): def test_update_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2265,7 +2255,7 @@ def test_update_job_flattened_error(): @pytest.mark.asyncio async def test_update_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2296,7 +2286,7 @@ async def test_update_job_flattened_async(): @pytest.mark.asyncio async def test_update_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2318,7 +2308,7 @@ async def test_update_job_flattened_error_async(): ) def test_delete_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2345,7 +2335,7 @@ def test_delete_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2362,7 +2352,7 @@ async def test_delete_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.DeleteJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2392,7 +2382,7 @@ async def test_delete_job_async_from_dict(): def test_delete_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2422,7 +2412,7 @@ def test_delete_job_field_headers(): @pytest.mark.asyncio async def test_delete_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2451,7 +2441,7 @@ async def test_delete_job_field_headers_async(): def test_delete_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2475,7 +2465,7 @@ def test_delete_job_flattened(): def test_delete_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2490,7 +2480,7 @@ def test_delete_job_flattened_error(): @pytest.mark.asyncio async def test_delete_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2517,7 +2507,7 @@ async def test_delete_job_flattened_async(): @pytest.mark.asyncio async def test_delete_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2538,7 +2528,7 @@ async def test_delete_job_flattened_error_async(): ) def test_pause_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2576,7 +2566,7 @@ def test_pause_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2593,7 +2583,7 @@ async def test_pause_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.PauseJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2636,7 +2626,7 @@ async def test_pause_job_async_from_dict(): def test_pause_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2666,7 +2656,7 @@ def test_pause_job_field_headers(): @pytest.mark.asyncio async def test_pause_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2695,7 +2685,7 @@ async def test_pause_job_field_headers_async(): def test_pause_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2719,7 +2709,7 @@ def test_pause_job_flattened(): def test_pause_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2734,7 +2724,7 @@ def test_pause_job_flattened_error(): @pytest.mark.asyncio async def test_pause_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2761,7 +2751,7 @@ async def test_pause_job_flattened_async(): @pytest.mark.asyncio async def test_pause_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2782,7 +2772,7 @@ async def test_pause_job_flattened_error_async(): ) def test_resume_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2820,7 +2810,7 @@ def test_resume_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2837,7 +2827,7 @@ async def test_resume_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.ResumeJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2880,7 +2870,7 @@ async def test_resume_job_async_from_dict(): def test_resume_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2910,7 +2900,7 @@ def test_resume_job_field_headers(): @pytest.mark.asyncio async def test_resume_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2939,7 +2929,7 @@ async def test_resume_job_field_headers_async(): def test_resume_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2963,7 +2953,7 @@ def test_resume_job_flattened(): def test_resume_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2978,7 +2968,7 @@ def test_resume_job_flattened_error(): @pytest.mark.asyncio async def test_resume_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3005,7 +2995,7 @@ async def test_resume_job_flattened_async(): @pytest.mark.asyncio async def test_resume_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3026,7 +3016,7 @@ async def test_resume_job_flattened_error_async(): ) def test_run_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3064,7 +3054,7 @@ def test_run_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3081,7 +3071,7 @@ async def test_run_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.RunJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3124,7 +3114,7 @@ async def test_run_job_async_from_dict(): def test_run_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3154,7 +3144,7 @@ def test_run_job_field_headers(): @pytest.mark.asyncio async def test_run_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3183,7 +3173,7 @@ async def test_run_job_field_headers_async(): def test_run_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3207,7 +3197,7 @@ def test_run_job_flattened(): def test_run_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3222,7 +3212,7 @@ def test_run_job_flattened_error(): @pytest.mark.asyncio async def test_run_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3249,7 +3239,7 @@ async def test_run_job_flattened_async(): @pytest.mark.asyncio async def test_run_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3270,7 +3260,7 @@ async def test_run_job_flattened_error_async(): ) def test_list_jobs_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3319,7 +3309,7 @@ def test_list_jobs_rest_required_fields(request_type=cloudscheduler.ListJobsRequ # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_jobs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3328,7 +3318,7 @@ def test_list_jobs_rest_required_fields(request_type=cloudscheduler.ListJobsRequ jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_jobs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3344,7 +3334,7 @@ def test_list_jobs_rest_required_fields(request_type=cloudscheduler.ListJobsRequ assert jsonified_request["parent"] == "parent_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3386,7 +3376,7 @@ def test_list_jobs_rest_required_fields(request_type=cloudscheduler.ListJobsRequ def test_list_jobs_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_jobs._get_unset_required_fields({}) @@ -3404,7 +3394,7 @@ def test_list_jobs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_jobs_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -3460,7 +3450,7 @@ def test_list_jobs_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.ListJobsRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3482,7 +3472,7 @@ def test_list_jobs_rest_bad_request( def test_list_jobs_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3523,7 +3513,7 @@ def test_list_jobs_rest_flattened(): def test_list_jobs_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3538,7 +3528,7 @@ def test_list_jobs_rest_flattened_error(transport: str = "rest"): def test_list_jobs_rest_pager(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3606,7 +3596,7 @@ def test_list_jobs_rest_pager(transport: str = "rest"): ) def test_get_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3663,7 +3653,7 @@ def test_get_job_rest_required_fields(request_type=cloudscheduler.GetJobRequest) # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3672,7 +3662,7 @@ def test_get_job_rest_required_fields(request_type=cloudscheduler.GetJobRequest) jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3681,7 +3671,7 @@ def test_get_job_rest_required_fields(request_type=cloudscheduler.GetJobRequest) assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3723,7 +3713,7 @@ def test_get_job_rest_required_fields(request_type=cloudscheduler.GetJobRequest) def test_get_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_job._get_unset_required_fields({}) @@ -3733,7 +3723,7 @@ def test_get_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -3787,7 +3777,7 @@ def test_get_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.GetJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3809,7 +3799,7 @@ def test_get_job_rest_bad_request( def test_get_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3850,7 +3840,7 @@ def test_get_job_rest_flattened(): def test_get_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3865,7 +3855,7 @@ def test_get_job_rest_flattened_error(transport: str = "rest"): def test_get_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3878,7 +3868,7 @@ def test_get_job_rest_error(): ) def test_create_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4061,7 +4051,7 @@ def test_create_job_rest_required_fields(request_type=cloudscheduler.CreateJobRe # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4070,7 +4060,7 @@ def test_create_job_rest_required_fields(request_type=cloudscheduler.CreateJobRe jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4079,7 +4069,7 @@ def test_create_job_rest_required_fields(request_type=cloudscheduler.CreateJobRe assert jsonified_request["parent"] == "parent_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4122,7 +4112,7 @@ def test_create_job_rest_required_fields(request_type=cloudscheduler.CreateJobRe def test_create_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_job._get_unset_required_fields({}) @@ -4140,7 +4130,7 @@ def test_create_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -4196,7 +4186,7 @@ def test_create_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.CreateJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4218,7 +4208,7 @@ def test_create_job_rest_bad_request( def test_create_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4260,7 +4250,7 @@ def test_create_job_rest_flattened(): def test_create_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4276,7 +4266,7 @@ def test_create_job_rest_flattened_error(transport: str = "rest"): def test_create_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4289,7 +4279,7 @@ def test_create_job_rest_error(): ) def test_update_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4471,14 +4461,14 @@ def test_update_job_rest_required_fields(request_type=cloudscheduler.UpdateJobRe # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_job._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -4487,7 +4477,7 @@ def test_update_job_rest_required_fields(request_type=cloudscheduler.UpdateJobRe # verify required fields with non-default values are left alone client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4530,7 +4520,7 @@ def test_update_job_rest_required_fields(request_type=cloudscheduler.UpdateJobRe def test_update_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_job._get_unset_required_fields({}) @@ -4540,7 +4530,7 @@ def test_update_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -4596,7 +4586,7 @@ def test_update_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.UpdateJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4618,7 +4608,7 @@ def test_update_job_rest_bad_request( def test_update_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4662,7 +4652,7 @@ def test_update_job_rest_flattened(): def test_update_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4678,7 +4668,7 @@ def test_update_job_rest_flattened_error(transport: str = "rest"): def test_update_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4691,7 +4681,7 @@ def test_update_job_rest_error(): ) def test_delete_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4735,7 +4725,7 @@ def test_delete_job_rest_required_fields(request_type=cloudscheduler.DeleteJobRe # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4744,7 +4734,7 @@ def test_delete_job_rest_required_fields(request_type=cloudscheduler.DeleteJobRe jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4753,7 +4743,7 @@ def test_delete_job_rest_required_fields(request_type=cloudscheduler.DeleteJobRe assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4792,7 +4782,7 @@ def test_delete_job_rest_required_fields(request_type=cloudscheduler.DeleteJobRe def test_delete_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_job._get_unset_required_fields({}) @@ -4802,7 +4792,7 @@ def test_delete_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -4852,7 +4842,7 @@ def test_delete_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.DeleteJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4874,7 +4864,7 @@ def test_delete_job_rest_bad_request( def test_delete_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4913,7 +4903,7 @@ def test_delete_job_rest_flattened(): def test_delete_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4928,7 +4918,7 @@ def test_delete_job_rest_flattened_error(transport: str = "rest"): def test_delete_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4941,7 +4931,7 @@ def test_delete_job_rest_error(): ) def test_pause_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4998,7 +4988,7 @@ def test_pause_job_rest_required_fields(request_type=cloudscheduler.PauseJobRequ # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5007,7 +4997,7 @@ def test_pause_job_rest_required_fields(request_type=cloudscheduler.PauseJobRequ jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5016,7 +5006,7 @@ def test_pause_job_rest_required_fields(request_type=cloudscheduler.PauseJobRequ assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5059,7 +5049,7 @@ def test_pause_job_rest_required_fields(request_type=cloudscheduler.PauseJobRequ def test_pause_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.pause_job._get_unset_required_fields({}) @@ -5069,7 +5059,7 @@ def test_pause_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_pause_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -5123,7 +5113,7 @@ def test_pause_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.PauseJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5145,7 +5135,7 @@ def test_pause_job_rest_bad_request( def test_pause_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5186,7 +5176,7 @@ def test_pause_job_rest_flattened(): def test_pause_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5201,7 +5191,7 @@ def test_pause_job_rest_flattened_error(transport: str = "rest"): def test_pause_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5214,7 +5204,7 @@ def test_pause_job_rest_error(): ) def test_resume_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5271,7 +5261,7 @@ def test_resume_job_rest_required_fields(request_type=cloudscheduler.ResumeJobRe # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5280,7 +5270,7 @@ def test_resume_job_rest_required_fields(request_type=cloudscheduler.ResumeJobRe jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5289,7 +5279,7 @@ def test_resume_job_rest_required_fields(request_type=cloudscheduler.ResumeJobRe assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5332,7 +5322,7 @@ def test_resume_job_rest_required_fields(request_type=cloudscheduler.ResumeJobRe def test_resume_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.resume_job._get_unset_required_fields({}) @@ -5342,7 +5332,7 @@ def test_resume_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_resume_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -5398,7 +5388,7 @@ def test_resume_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.ResumeJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5420,7 +5410,7 @@ def test_resume_job_rest_bad_request( def test_resume_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5462,7 +5452,7 @@ def test_resume_job_rest_flattened(): def test_resume_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5477,7 +5467,7 @@ def test_resume_job_rest_flattened_error(transport: str = "rest"): def test_resume_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5490,7 +5480,7 @@ def test_resume_job_rest_error(): ) def test_run_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5547,7 +5537,7 @@ def test_run_job_rest_required_fields(request_type=cloudscheduler.RunJobRequest) # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5556,7 +5546,7 @@ def test_run_job_rest_required_fields(request_type=cloudscheduler.RunJobRequest) jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5565,7 +5555,7 @@ def test_run_job_rest_required_fields(request_type=cloudscheduler.RunJobRequest) assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5608,7 +5598,7 @@ def test_run_job_rest_required_fields(request_type=cloudscheduler.RunJobRequest) def test_run_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.run_job._get_unset_required_fields({}) @@ -5618,7 +5608,7 @@ def test_run_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_run_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -5672,7 +5662,7 @@ def test_run_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.RunJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5694,7 +5684,7 @@ def test_run_job_rest_bad_request( def test_run_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5735,7 +5725,7 @@ def test_run_job_rest_flattened(): def test_run_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5750,24 +5740,24 @@ def test_run_job_rest_flattened_error(transport: str = "rest"): def test_run_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudSchedulerClient( @@ -5777,7 +5767,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5792,13 +5782,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CloudSchedulerClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudSchedulerClient( @@ -5810,7 +5799,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CloudSchedulerClient(transport=transport) assert client.transport is transport @@ -5819,13 +5808,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CloudSchedulerGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -5842,7 +5831,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -5856,7 +5845,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CloudSchedulerClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -5864,7 +5853,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -5876,7 +5865,7 @@ def test_cloud_scheduler_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CloudSchedulerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -5888,7 +5877,7 @@ def test_cloud_scheduler_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CloudSchedulerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -5929,7 +5918,7 @@ def test_cloud_scheduler_base_transport_with_credentials_file(): "google.cloud.scheduler_v1.services.cloud_scheduler.transports.CloudSchedulerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudSchedulerTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -5948,7 +5937,7 @@ def test_cloud_scheduler_base_transport_with_adc(): "google.cloud.scheduler_v1.services.cloud_scheduler.transports.CloudSchedulerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudSchedulerTransport() adc.assert_called_once() @@ -5956,7 +5945,7 @@ def test_cloud_scheduler_base_transport_with_adc(): def test_cloud_scheduler_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CloudSchedulerClient() adc.assert_called_once_with( scopes=None, @@ -5976,7 +5965,7 @@ def test_cloud_scheduler_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6023,7 +6012,7 @@ def test_cloud_scheduler_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6051,7 +6040,7 @@ def test_cloud_scheduler_transport_create_channel(transport_class, grpc_helpers) ], ) def test_cloud_scheduler_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6089,7 +6078,7 @@ def test_cloud_scheduler_grpc_transport_client_cert_source_for_mtls(transport_cl def test_cloud_scheduler_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6109,7 +6098,7 @@ def test_cloud_scheduler_http_transport_client_cert_source_for_mtls(): ) def test_cloud_scheduler_host_no_port(transport_name): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudscheduler.googleapis.com" ), @@ -6132,7 +6121,7 @@ def test_cloud_scheduler_host_no_port(transport_name): ) def test_cloud_scheduler_host_with_port(transport_name): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudscheduler.googleapis.com:8000" ), @@ -6152,8 +6141,8 @@ def test_cloud_scheduler_host_with_port(transport_name): ], ) def test_cloud_scheduler_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CloudSchedulerClient( credentials=creds1, transport=transport_name, @@ -6238,7 +6227,7 @@ def test_cloud_scheduler_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6473,7 +6462,7 @@ def test_client_with_default_client_info(): transports.CloudSchedulerTransport, "_prep_wrapped_messages" ) as prep: client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6483,7 +6472,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CloudSchedulerClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6492,7 +6481,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6507,7 +6496,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6537,7 +6526,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -6565,7 +6554,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6593,7 +6582,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -6619,7 +6608,7 @@ def test_list_locations_rest(request_type): def test_list_locations(transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6644,7 +6633,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6670,7 +6659,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6699,7 +6688,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6728,7 +6717,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6746,7 +6735,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6764,7 +6753,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6789,7 +6778,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6814,7 +6803,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): - client = CloudSchedulerClient(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = CloudSchedulerClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -6842,7 +6831,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6871,7 +6860,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6889,7 +6878,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6913,7 +6902,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -6930,7 +6919,7 @@ def test_client_ctx(): ] for transport in transports: client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py b/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py index 2f978bb2a33e..49023cf5e8ab 100644 --- a/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py +++ b/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py @@ -86,18 +86,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -324,7 +312,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -351,42 +339,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -397,7 +392,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_cloud_scheduler_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -449,7 +444,7 @@ def test_cloud_scheduler_client_service_account_always_use_jwt( ], ) def test_cloud_scheduler_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -512,9 +507,7 @@ def test_cloud_scheduler_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CloudSchedulerClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -913,20 +906,20 @@ def test_cloud_scheduler_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -938,13 +931,11 @@ def test_cloud_scheduler_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -960,8 +951,7 @@ def test_cloud_scheduler_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1114,8 +1104,8 @@ def test_cloud_scheduler_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1144,7 +1134,7 @@ def test_cloud_scheduler_client_create_channel_credentials_file( ) def test_list_jobs(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1174,7 +1164,7 @@ def test_list_jobs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1191,7 +1181,7 @@ async def test_list_jobs_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.ListJobsRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1226,7 +1216,7 @@ async def test_list_jobs_async_from_dict(): def test_list_jobs_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1256,7 +1246,7 @@ def test_list_jobs_field_headers(): @pytest.mark.asyncio async def test_list_jobs_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1287,7 +1277,7 @@ async def test_list_jobs_field_headers_async(): def test_list_jobs_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1311,7 +1301,7 @@ def test_list_jobs_flattened(): def test_list_jobs_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1326,7 +1316,7 @@ def test_list_jobs_flattened_error(): @pytest.mark.asyncio async def test_list_jobs_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1355,7 +1345,7 @@ async def test_list_jobs_flattened_async(): @pytest.mark.asyncio async def test_list_jobs_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1369,7 +1359,7 @@ async def test_list_jobs_flattened_error_async(): def test_list_jobs_pager(transport_name: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1419,7 +1409,7 @@ def test_list_jobs_pager(transport_name: str = "grpc"): def test_list_jobs_pages(transport_name: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1461,7 +1451,7 @@ def test_list_jobs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_jobs_async_pager(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1511,7 +1501,7 @@ async def test_list_jobs_async_pager(): @pytest.mark.asyncio async def test_list_jobs_async_pages(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1566,7 +1556,7 @@ async def test_list_jobs_async_pages(): ) def test_get_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1606,7 +1596,7 @@ def test_get_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1623,7 +1613,7 @@ async def test_get_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.GetJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1668,7 +1658,7 @@ async def test_get_job_async_from_dict(): def test_get_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1698,7 +1688,7 @@ def test_get_job_field_headers(): @pytest.mark.asyncio async def test_get_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1727,7 +1717,7 @@ async def test_get_job_field_headers_async(): def test_get_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1751,7 +1741,7 @@ def test_get_job_flattened(): def test_get_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1766,7 +1756,7 @@ def test_get_job_flattened_error(): @pytest.mark.asyncio async def test_get_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1793,7 +1783,7 @@ async def test_get_job_flattened_async(): @pytest.mark.asyncio async def test_get_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1814,7 +1804,7 @@ async def test_get_job_flattened_error_async(): ) def test_create_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1854,7 +1844,7 @@ def test_create_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1871,7 +1861,7 @@ async def test_create_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.CreateJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1916,7 +1906,7 @@ async def test_create_job_async_from_dict(): def test_create_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1946,7 +1936,7 @@ def test_create_job_field_headers(): @pytest.mark.asyncio async def test_create_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1975,7 +1965,7 @@ async def test_create_job_field_headers_async(): def test_create_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2003,7 +1993,7 @@ def test_create_job_flattened(): def test_create_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2019,7 +2009,7 @@ def test_create_job_flattened_error(): @pytest.mark.asyncio async def test_create_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2050,7 +2040,7 @@ async def test_create_job_flattened_async(): @pytest.mark.asyncio async def test_create_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2072,7 +2062,7 @@ async def test_create_job_flattened_error_async(): ) def test_update_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2112,7 +2102,7 @@ def test_update_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2129,7 +2119,7 @@ async def test_update_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.UpdateJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2174,7 +2164,7 @@ async def test_update_job_async_from_dict(): def test_update_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2204,7 +2194,7 @@ def test_update_job_field_headers(): @pytest.mark.asyncio async def test_update_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2233,7 +2223,7 @@ async def test_update_job_field_headers_async(): def test_update_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2261,7 +2251,7 @@ def test_update_job_flattened(): def test_update_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2277,7 +2267,7 @@ def test_update_job_flattened_error(): @pytest.mark.asyncio async def test_update_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2308,7 +2298,7 @@ async def test_update_job_flattened_async(): @pytest.mark.asyncio async def test_update_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2330,7 +2320,7 @@ async def test_update_job_flattened_error_async(): ) def test_delete_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2357,7 +2347,7 @@ def test_delete_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2374,7 +2364,7 @@ async def test_delete_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.DeleteJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2404,7 +2394,7 @@ async def test_delete_job_async_from_dict(): def test_delete_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2434,7 +2424,7 @@ def test_delete_job_field_headers(): @pytest.mark.asyncio async def test_delete_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2463,7 +2453,7 @@ async def test_delete_job_field_headers_async(): def test_delete_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2487,7 +2477,7 @@ def test_delete_job_flattened(): def test_delete_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2502,7 +2492,7 @@ def test_delete_job_flattened_error(): @pytest.mark.asyncio async def test_delete_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2529,7 +2519,7 @@ async def test_delete_job_flattened_async(): @pytest.mark.asyncio async def test_delete_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2550,7 +2540,7 @@ async def test_delete_job_flattened_error_async(): ) def test_pause_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2590,7 +2580,7 @@ def test_pause_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2607,7 +2597,7 @@ async def test_pause_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.PauseJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2652,7 +2642,7 @@ async def test_pause_job_async_from_dict(): def test_pause_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2682,7 +2672,7 @@ def test_pause_job_field_headers(): @pytest.mark.asyncio async def test_pause_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2711,7 +2701,7 @@ async def test_pause_job_field_headers_async(): def test_pause_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2735,7 +2725,7 @@ def test_pause_job_flattened(): def test_pause_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2750,7 +2740,7 @@ def test_pause_job_flattened_error(): @pytest.mark.asyncio async def test_pause_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2777,7 +2767,7 @@ async def test_pause_job_flattened_async(): @pytest.mark.asyncio async def test_pause_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2798,7 +2788,7 @@ async def test_pause_job_flattened_error_async(): ) def test_resume_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2838,7 +2828,7 @@ def test_resume_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2855,7 +2845,7 @@ async def test_resume_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.ResumeJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2900,7 +2890,7 @@ async def test_resume_job_async_from_dict(): def test_resume_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2930,7 +2920,7 @@ def test_resume_job_field_headers(): @pytest.mark.asyncio async def test_resume_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2959,7 +2949,7 @@ async def test_resume_job_field_headers_async(): def test_resume_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2983,7 +2973,7 @@ def test_resume_job_flattened(): def test_resume_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2998,7 +2988,7 @@ def test_resume_job_flattened_error(): @pytest.mark.asyncio async def test_resume_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3025,7 +3015,7 @@ async def test_resume_job_flattened_async(): @pytest.mark.asyncio async def test_resume_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3046,7 +3036,7 @@ async def test_resume_job_flattened_error_async(): ) def test_run_job(request_type, transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3086,7 +3076,7 @@ def test_run_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3103,7 +3093,7 @@ async def test_run_job_async( transport: str = "grpc_asyncio", request_type=cloudscheduler.RunJobRequest ): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3148,7 +3138,7 @@ async def test_run_job_async_from_dict(): def test_run_job_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3178,7 +3168,7 @@ def test_run_job_field_headers(): @pytest.mark.asyncio async def test_run_job_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3207,7 +3197,7 @@ async def test_run_job_field_headers_async(): def test_run_job_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3231,7 +3221,7 @@ def test_run_job_flattened(): def test_run_job_flattened_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3246,7 +3236,7 @@ def test_run_job_flattened_error(): @pytest.mark.asyncio async def test_run_job_flattened_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3273,7 +3263,7 @@ async def test_run_job_flattened_async(): @pytest.mark.asyncio async def test_run_job_flattened_error_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3294,7 +3284,7 @@ async def test_run_job_flattened_error_async(): ) def test_list_jobs_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3343,7 +3333,7 @@ def test_list_jobs_rest_required_fields(request_type=cloudscheduler.ListJobsRequ # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_jobs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3352,7 +3342,7 @@ def test_list_jobs_rest_required_fields(request_type=cloudscheduler.ListJobsRequ jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_jobs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3370,7 +3360,7 @@ def test_list_jobs_rest_required_fields(request_type=cloudscheduler.ListJobsRequ assert jsonified_request["parent"] == "parent_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3412,7 +3402,7 @@ def test_list_jobs_rest_required_fields(request_type=cloudscheduler.ListJobsRequ def test_list_jobs_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_jobs._get_unset_required_fields({}) @@ -3432,7 +3422,7 @@ def test_list_jobs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_jobs_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -3488,7 +3478,7 @@ def test_list_jobs_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.ListJobsRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3510,7 +3500,7 @@ def test_list_jobs_rest_bad_request( def test_list_jobs_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3551,7 +3541,7 @@ def test_list_jobs_rest_flattened(): def test_list_jobs_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3566,7 +3556,7 @@ def test_list_jobs_rest_flattened_error(transport: str = "rest"): def test_list_jobs_rest_pager(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3634,7 +3624,7 @@ def test_list_jobs_rest_pager(transport: str = "rest"): ) def test_get_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3693,7 +3683,7 @@ def test_get_job_rest_required_fields(request_type=cloudscheduler.GetJobRequest) # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3702,7 +3692,7 @@ def test_get_job_rest_required_fields(request_type=cloudscheduler.GetJobRequest) jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3711,7 +3701,7 @@ def test_get_job_rest_required_fields(request_type=cloudscheduler.GetJobRequest) assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3753,7 +3743,7 @@ def test_get_job_rest_required_fields(request_type=cloudscheduler.GetJobRequest) def test_get_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_job._get_unset_required_fields({}) @@ -3763,7 +3753,7 @@ def test_get_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -3817,7 +3807,7 @@ def test_get_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.GetJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3839,7 +3829,7 @@ def test_get_job_rest_bad_request( def test_get_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3880,7 +3870,7 @@ def test_get_job_rest_flattened(): def test_get_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3895,7 +3885,7 @@ def test_get_job_rest_flattened_error(transport: str = "rest"): def test_get_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3908,7 +3898,7 @@ def test_get_job_rest_error(): ) def test_create_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4094,7 +4084,7 @@ def test_create_job_rest_required_fields(request_type=cloudscheduler.CreateJobRe # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4103,7 +4093,7 @@ def test_create_job_rest_required_fields(request_type=cloudscheduler.CreateJobRe jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4112,7 +4102,7 @@ def test_create_job_rest_required_fields(request_type=cloudscheduler.CreateJobRe assert jsonified_request["parent"] == "parent_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4155,7 +4145,7 @@ def test_create_job_rest_required_fields(request_type=cloudscheduler.CreateJobRe def test_create_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_job._get_unset_required_fields({}) @@ -4173,7 +4163,7 @@ def test_create_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -4229,7 +4219,7 @@ def test_create_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.CreateJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4251,7 +4241,7 @@ def test_create_job_rest_bad_request( def test_create_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4293,7 +4283,7 @@ def test_create_job_rest_flattened(): def test_create_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4309,7 +4299,7 @@ def test_create_job_rest_flattened_error(transport: str = "rest"): def test_create_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4322,7 +4312,7 @@ def test_create_job_rest_error(): ) def test_update_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4507,14 +4497,14 @@ def test_update_job_rest_required_fields(request_type=cloudscheduler.UpdateJobRe # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_job._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -4523,7 +4513,7 @@ def test_update_job_rest_required_fields(request_type=cloudscheduler.UpdateJobRe # verify required fields with non-default values are left alone client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4566,7 +4556,7 @@ def test_update_job_rest_required_fields(request_type=cloudscheduler.UpdateJobRe def test_update_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_job._get_unset_required_fields({}) @@ -4576,7 +4566,7 @@ def test_update_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -4632,7 +4622,7 @@ def test_update_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.UpdateJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4654,7 +4644,7 @@ def test_update_job_rest_bad_request( def test_update_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4699,7 +4689,7 @@ def test_update_job_rest_flattened(): def test_update_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4715,7 +4705,7 @@ def test_update_job_rest_flattened_error(transport: str = "rest"): def test_update_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4728,7 +4718,7 @@ def test_update_job_rest_error(): ) def test_delete_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4772,7 +4762,7 @@ def test_delete_job_rest_required_fields(request_type=cloudscheduler.DeleteJobRe # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4781,7 +4771,7 @@ def test_delete_job_rest_required_fields(request_type=cloudscheduler.DeleteJobRe jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_job._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("legacy_app_engine_cron",)) @@ -4792,7 +4782,7 @@ def test_delete_job_rest_required_fields(request_type=cloudscheduler.DeleteJobRe assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4831,7 +4821,7 @@ def test_delete_job_rest_required_fields(request_type=cloudscheduler.DeleteJobRe def test_delete_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_job._get_unset_required_fields({}) @@ -4841,7 +4831,7 @@ def test_delete_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -4891,7 +4881,7 @@ def test_delete_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.DeleteJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4913,7 +4903,7 @@ def test_delete_job_rest_bad_request( def test_delete_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4952,7 +4942,7 @@ def test_delete_job_rest_flattened(): def test_delete_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4967,7 +4957,7 @@ def test_delete_job_rest_flattened_error(transport: str = "rest"): def test_delete_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4980,7 +4970,7 @@ def test_delete_job_rest_error(): ) def test_pause_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5039,7 +5029,7 @@ def test_pause_job_rest_required_fields(request_type=cloudscheduler.PauseJobRequ # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5048,7 +5038,7 @@ def test_pause_job_rest_required_fields(request_type=cloudscheduler.PauseJobRequ jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5057,7 +5047,7 @@ def test_pause_job_rest_required_fields(request_type=cloudscheduler.PauseJobRequ assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5100,7 +5090,7 @@ def test_pause_job_rest_required_fields(request_type=cloudscheduler.PauseJobRequ def test_pause_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.pause_job._get_unset_required_fields({}) @@ -5110,7 +5100,7 @@ def test_pause_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_pause_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -5164,7 +5154,7 @@ def test_pause_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.PauseJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5186,7 +5176,7 @@ def test_pause_job_rest_bad_request( def test_pause_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5228,7 +5218,7 @@ def test_pause_job_rest_flattened(): def test_pause_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5243,7 +5233,7 @@ def test_pause_job_rest_flattened_error(transport: str = "rest"): def test_pause_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5256,7 +5246,7 @@ def test_pause_job_rest_error(): ) def test_resume_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5315,7 +5305,7 @@ def test_resume_job_rest_required_fields(request_type=cloudscheduler.ResumeJobRe # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5324,7 +5314,7 @@ def test_resume_job_rest_required_fields(request_type=cloudscheduler.ResumeJobRe jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5333,7 +5323,7 @@ def test_resume_job_rest_required_fields(request_type=cloudscheduler.ResumeJobRe assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5376,7 +5366,7 @@ def test_resume_job_rest_required_fields(request_type=cloudscheduler.ResumeJobRe def test_resume_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.resume_job._get_unset_required_fields({}) @@ -5386,7 +5376,7 @@ def test_resume_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_resume_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -5442,7 +5432,7 @@ def test_resume_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.ResumeJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5464,7 +5454,7 @@ def test_resume_job_rest_bad_request( def test_resume_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5506,7 +5496,7 @@ def test_resume_job_rest_flattened(): def test_resume_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5521,7 +5511,7 @@ def test_resume_job_rest_flattened_error(transport: str = "rest"): def test_resume_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5534,7 +5524,7 @@ def test_resume_job_rest_error(): ) def test_run_job_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5593,7 +5583,7 @@ def test_run_job_rest_required_fields(request_type=cloudscheduler.RunJobRequest) # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5602,7 +5592,7 @@ def test_run_job_rest_required_fields(request_type=cloudscheduler.RunJobRequest) jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5611,7 +5601,7 @@ def test_run_job_rest_required_fields(request_type=cloudscheduler.RunJobRequest) assert jsonified_request["name"] == "name_value" client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5654,7 +5644,7 @@ def test_run_job_rest_required_fields(request_type=cloudscheduler.RunJobRequest) def test_run_job_rest_unset_required_fields(): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.run_job._get_unset_required_fields({}) @@ -5664,7 +5654,7 @@ def test_run_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_run_job_rest_interceptors(null_interceptor): transport = transports.CloudSchedulerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudSchedulerRestInterceptor(), @@ -5718,7 +5708,7 @@ def test_run_job_rest_bad_request( transport: str = "rest", request_type=cloudscheduler.RunJobRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5740,7 +5730,7 @@ def test_run_job_rest_bad_request( def test_run_job_rest_flattened(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5782,7 +5772,7 @@ def test_run_job_rest_flattened(): def test_run_job_rest_flattened_error(transport: str = "rest"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5797,24 +5787,24 @@ def test_run_job_rest_flattened_error(transport: str = "rest"): def test_run_job_rest_error(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudSchedulerClient( @@ -5824,7 +5814,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5839,13 +5829,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CloudSchedulerClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudSchedulerClient( @@ -5857,7 +5846,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CloudSchedulerClient(transport=transport) assert client.transport is transport @@ -5866,13 +5855,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CloudSchedulerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CloudSchedulerGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -5889,7 +5878,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -5903,7 +5892,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CloudSchedulerClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -5911,7 +5900,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -5923,7 +5912,7 @@ def test_cloud_scheduler_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CloudSchedulerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -5935,7 +5924,7 @@ def test_cloud_scheduler_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CloudSchedulerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -5976,7 +5965,7 @@ def test_cloud_scheduler_base_transport_with_credentials_file(): "google.cloud.scheduler_v1beta1.services.cloud_scheduler.transports.CloudSchedulerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudSchedulerTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -5995,7 +5984,7 @@ def test_cloud_scheduler_base_transport_with_adc(): "google.cloud.scheduler_v1beta1.services.cloud_scheduler.transports.CloudSchedulerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudSchedulerTransport() adc.assert_called_once() @@ -6003,7 +5992,7 @@ def test_cloud_scheduler_base_transport_with_adc(): def test_cloud_scheduler_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CloudSchedulerClient() adc.assert_called_once_with( scopes=None, @@ -6023,7 +6012,7 @@ def test_cloud_scheduler_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -6070,7 +6059,7 @@ def test_cloud_scheduler_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -6098,7 +6087,7 @@ def test_cloud_scheduler_transport_create_channel(transport_class, grpc_helpers) ], ) def test_cloud_scheduler_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -6136,7 +6125,7 @@ def test_cloud_scheduler_grpc_transport_client_cert_source_for_mtls(transport_cl def test_cloud_scheduler_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -6156,7 +6145,7 @@ def test_cloud_scheduler_http_transport_client_cert_source_for_mtls(): ) def test_cloud_scheduler_host_no_port(transport_name): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudscheduler.googleapis.com" ), @@ -6179,7 +6168,7 @@ def test_cloud_scheduler_host_no_port(transport_name): ) def test_cloud_scheduler_host_with_port(transport_name): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudscheduler.googleapis.com:8000" ), @@ -6199,8 +6188,8 @@ def test_cloud_scheduler_host_with_port(transport_name): ], ) def test_cloud_scheduler_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CloudSchedulerClient( credentials=creds1, transport=transport_name, @@ -6285,7 +6274,7 @@ def test_cloud_scheduler_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6520,7 +6509,7 @@ def test_client_with_default_client_info(): transports.CloudSchedulerTransport, "_prep_wrapped_messages" ) as prep: client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6530,7 +6519,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CloudSchedulerClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6539,7 +6528,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6554,7 +6543,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6584,7 +6573,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -6612,7 +6601,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6640,7 +6629,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -6666,7 +6655,7 @@ def test_list_locations_rest(request_type): def test_list_locations(transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6691,7 +6680,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6717,7 +6706,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6746,7 +6735,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6775,7 +6764,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6793,7 +6782,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6811,7 +6800,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6836,7 +6825,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6861,7 +6850,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): - client = CloudSchedulerClient(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = CloudSchedulerClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -6889,7 +6878,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6918,7 +6907,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6936,7 +6925,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = CloudSchedulerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6960,7 +6949,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -6977,7 +6966,7 @@ def test_client_ctx(): ] for transport in transports: client = CloudSchedulerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-secret-manager/google/cloud/secretmanager/gapic_version.py b/packages/google-cloud-secret-manager/google/cloud/secretmanager/gapic_version.py index e718b6d93d2a..360a0d13ebdd 100644 --- a/packages/google-cloud-secret-manager/google/cloud/secretmanager/gapic_version.py +++ b/packages/google-cloud-secret-manager/google/cloud/secretmanager/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.18.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1/gapic_version.py b/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1/gapic_version.py index e718b6d93d2a..360a0d13ebdd 100644 --- a/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1/gapic_version.py +++ b/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.18.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1/services/secret_manager_service/client.py b/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1/services/secret_manager_service/client.py index 0c5dfa13756f..fa354ee1a464 100644 --- a/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1/services/secret_manager_service/client.py +++ b/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1/services/secret_manager_service/client.py @@ -429,6 +429,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -447,6 +448,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -521,17 +523,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SecretManagerServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SecretManagerServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/gapic_version.py b/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/gapic_version.py index e718b6d93d2a..360a0d13ebdd 100644 --- a/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/gapic_version.py +++ b/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.18.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/services/secret_manager_service/client.py b/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/services/secret_manager_service/client.py index aa47fa9d7cf1..f208e82fd891 100644 --- a/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/services/secret_manager_service/client.py +++ b/packages/google-cloud-secret-manager/google/cloud/secretmanager_v1beta1/services/secret_manager_service/client.py @@ -411,6 +411,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -429,6 +430,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -503,17 +505,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SecretManagerServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SecretManagerServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-secret-manager/samples/generated_samples/snippet_metadata_google.cloud.secretmanager.v1.json b/packages/google-cloud-secret-manager/samples/generated_samples/snippet_metadata_google.cloud.secretmanager.v1.json index fc645d2459d9..fb38dd2243a0 100644 --- a/packages/google-cloud-secret-manager/samples/generated_samples/snippet_metadata_google.cloud.secretmanager.v1.json +++ b/packages/google-cloud-secret-manager/samples/generated_samples/snippet_metadata_google.cloud.secretmanager.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-secret-manager", - "version": "2.18.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-secret-manager/samples/generated_samples/snippet_metadata_google.cloud.secrets.v1beta1.json b/packages/google-cloud-secret-manager/samples/generated_samples/snippet_metadata_google.cloud.secrets.v1beta1.json index ff666a73ef10..52f1d4e38bcf 100644 --- a/packages/google-cloud-secret-manager/samples/generated_samples/snippet_metadata_google.cloud.secrets.v1beta1.json +++ b/packages/google-cloud-secret-manager/samples/generated_samples/snippet_metadata_google.cloud.secrets.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-secretmanager", - "version": "2.18.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-secret-manager/setup.py b/packages/google-cloud-secret-manager/setup.py index 7f88ec8d8546..95754857427e 100644 --- a/packages/google-cloud-secret-manager/setup.py +++ b/packages/google-cloud-secret-manager/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", diff --git a/packages/google-cloud-secret-manager/testing/constraints-3.7.txt b/packages/google-cloud-secret-manager/testing/constraints-3.7.txt index 44ffd04543a8..712d45b4c5ea 100644 --- a/packages/google-cloud-secret-manager/testing/constraints-3.7.txt +++ b/packages/google-cloud-secret-manager/testing/constraints-3.7.txt @@ -5,6 +5,7 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 grpc-google-iam-v1==0.12.4 diff --git a/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py index dca55978d18f..a2b2ef14dabc 100644 --- a/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py +++ b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py @@ -84,18 +84,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -345,7 +333,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -372,42 +360,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -420,7 +415,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_secret_manager_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -474,7 +469,7 @@ def test_secret_manager_service_client_service_account_always_use_jwt( def test_secret_manager_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -545,9 +540,7 @@ def test_secret_manager_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(SecretManagerServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -966,20 +959,20 @@ def test_secret_manager_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -991,13 +984,11 @@ def test_secret_manager_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1013,8 +1004,7 @@ def test_secret_manager_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1180,8 +1170,8 @@ def test_secret_manager_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1210,7 +1200,7 @@ def test_secret_manager_service_client_create_channel_credentials_file( ) def test_list_secrets(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1242,7 +1232,7 @@ def test_list_secrets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1259,7 +1249,7 @@ async def test_list_secrets_async( transport: str = "grpc_asyncio", request_type=service.ListSecretsRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1296,7 +1286,7 @@ async def test_list_secrets_async_from_dict(): def test_list_secrets_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1326,7 +1316,7 @@ def test_list_secrets_field_headers(): @pytest.mark.asyncio async def test_list_secrets_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1357,7 +1347,7 @@ async def test_list_secrets_field_headers_async(): def test_list_secrets_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1381,7 +1371,7 @@ def test_list_secrets_flattened(): def test_list_secrets_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1396,7 +1386,7 @@ def test_list_secrets_flattened_error(): @pytest.mark.asyncio async def test_list_secrets_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1425,7 +1415,7 @@ async def test_list_secrets_flattened_async(): @pytest.mark.asyncio async def test_list_secrets_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1439,7 +1429,7 @@ async def test_list_secrets_flattened_error_async(): def test_list_secrets_pager(transport_name: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1489,7 +1479,7 @@ def test_list_secrets_pager(transport_name: str = "grpc"): def test_list_secrets_pages(transport_name: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1531,7 +1521,7 @@ def test_list_secrets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_secrets_async_pager(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1581,7 +1571,7 @@ async def test_list_secrets_async_pager(): @pytest.mark.asyncio async def test_list_secrets_async_pages(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1636,7 +1626,7 @@ async def test_list_secrets_async_pages(): ) def test_create_secret(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1668,7 +1658,7 @@ def test_create_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1685,7 +1675,7 @@ async def test_create_secret_async( transport: str = "grpc_asyncio", request_type=service.CreateSecretRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1722,7 +1712,7 @@ async def test_create_secret_async_from_dict(): def test_create_secret_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1752,7 +1742,7 @@ def test_create_secret_field_headers(): @pytest.mark.asyncio async def test_create_secret_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1781,7 +1771,7 @@ async def test_create_secret_field_headers_async(): def test_create_secret_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1813,7 +1803,7 @@ def test_create_secret_flattened(): def test_create_secret_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1830,7 +1820,7 @@ def test_create_secret_flattened_error(): @pytest.mark.asyncio async def test_create_secret_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1865,7 +1855,7 @@ async def test_create_secret_flattened_async(): @pytest.mark.asyncio async def test_create_secret_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1888,7 +1878,7 @@ async def test_create_secret_flattened_error_async(): ) def test_add_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1926,7 +1916,7 @@ def test_add_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1945,7 +1935,7 @@ async def test_add_secret_version_async( transport: str = "grpc_asyncio", request_type=service.AddSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1988,7 +1978,7 @@ async def test_add_secret_version_async_from_dict(): def test_add_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2020,7 +2010,7 @@ def test_add_secret_version_field_headers(): @pytest.mark.asyncio async def test_add_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2053,7 +2043,7 @@ async def test_add_secret_version_field_headers_async(): def test_add_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2083,7 +2073,7 @@ def test_add_secret_version_flattened(): def test_add_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2099,7 +2089,7 @@ def test_add_secret_version_flattened_error(): @pytest.mark.asyncio async def test_add_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2134,7 +2124,7 @@ async def test_add_secret_version_flattened_async(): @pytest.mark.asyncio async def test_add_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2156,7 +2146,7 @@ async def test_add_secret_version_flattened_error_async(): ) def test_get_secret(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2188,7 +2178,7 @@ def test_get_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2205,7 +2195,7 @@ async def test_get_secret_async( transport: str = "grpc_asyncio", request_type=service.GetSecretRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2242,7 +2232,7 @@ async def test_get_secret_async_from_dict(): def test_get_secret_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2272,7 +2262,7 @@ def test_get_secret_field_headers(): @pytest.mark.asyncio async def test_get_secret_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2301,7 +2291,7 @@ async def test_get_secret_field_headers_async(): def test_get_secret_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2325,7 +2315,7 @@ def test_get_secret_flattened(): def test_get_secret_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2340,7 +2330,7 @@ def test_get_secret_flattened_error(): @pytest.mark.asyncio async def test_get_secret_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2367,7 +2357,7 @@ async def test_get_secret_flattened_async(): @pytest.mark.asyncio async def test_get_secret_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2388,7 +2378,7 @@ async def test_get_secret_flattened_error_async(): ) def test_update_secret(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2420,7 +2410,7 @@ def test_update_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2437,7 +2427,7 @@ async def test_update_secret_async( transport: str = "grpc_asyncio", request_type=service.UpdateSecretRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2474,7 +2464,7 @@ async def test_update_secret_async_from_dict(): def test_update_secret_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2504,7 +2494,7 @@ def test_update_secret_field_headers(): @pytest.mark.asyncio async def test_update_secret_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2533,7 +2523,7 @@ async def test_update_secret_field_headers_async(): def test_update_secret_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2561,7 +2551,7 @@ def test_update_secret_flattened(): def test_update_secret_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2577,7 +2567,7 @@ def test_update_secret_flattened_error(): @pytest.mark.asyncio async def test_update_secret_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2608,7 +2598,7 @@ async def test_update_secret_flattened_async(): @pytest.mark.asyncio async def test_update_secret_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2630,7 +2620,7 @@ async def test_update_secret_flattened_error_async(): ) def test_delete_secret(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2657,7 +2647,7 @@ def test_delete_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2674,7 +2664,7 @@ async def test_delete_secret_async( transport: str = "grpc_asyncio", request_type=service.DeleteSecretRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2704,7 +2694,7 @@ async def test_delete_secret_async_from_dict(): def test_delete_secret_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2734,7 +2724,7 @@ def test_delete_secret_field_headers(): @pytest.mark.asyncio async def test_delete_secret_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2763,7 +2753,7 @@ async def test_delete_secret_field_headers_async(): def test_delete_secret_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2787,7 +2777,7 @@ def test_delete_secret_flattened(): def test_delete_secret_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2802,7 +2792,7 @@ def test_delete_secret_flattened_error(): @pytest.mark.asyncio async def test_delete_secret_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2829,7 +2819,7 @@ async def test_delete_secret_flattened_async(): @pytest.mark.asyncio async def test_delete_secret_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2850,7 +2840,7 @@ async def test_delete_secret_flattened_error_async(): ) def test_list_secret_versions(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2884,7 +2874,7 @@ def test_list_secret_versions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2903,7 +2893,7 @@ async def test_list_secret_versions_async( transport: str = "grpc_asyncio", request_type=service.ListSecretVersionsRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2942,7 +2932,7 @@ async def test_list_secret_versions_async_from_dict(): def test_list_secret_versions_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2974,7 +2964,7 @@ def test_list_secret_versions_field_headers(): @pytest.mark.asyncio async def test_list_secret_versions_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3007,7 +2997,7 @@ async def test_list_secret_versions_field_headers_async(): def test_list_secret_versions_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3033,7 +3023,7 @@ def test_list_secret_versions_flattened(): def test_list_secret_versions_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3048,7 +3038,7 @@ def test_list_secret_versions_flattened_error(): @pytest.mark.asyncio async def test_list_secret_versions_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3079,7 +3069,7 @@ async def test_list_secret_versions_flattened_async(): @pytest.mark.asyncio async def test_list_secret_versions_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3093,7 +3083,7 @@ async def test_list_secret_versions_flattened_error_async(): def test_list_secret_versions_pager(transport_name: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3145,7 +3135,7 @@ def test_list_secret_versions_pager(transport_name: str = "grpc"): def test_list_secret_versions_pages(transport_name: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3189,7 +3179,7 @@ def test_list_secret_versions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_secret_versions_async_pager(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3241,7 +3231,7 @@ async def test_list_secret_versions_async_pager(): @pytest.mark.asyncio async def test_list_secret_versions_async_pages(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3298,7 +3288,7 @@ async def test_list_secret_versions_async_pages(): ) def test_get_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3336,7 +3326,7 @@ def test_get_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3355,7 +3345,7 @@ async def test_get_secret_version_async( transport: str = "grpc_asyncio", request_type=service.GetSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3398,7 +3388,7 @@ async def test_get_secret_version_async_from_dict(): def test_get_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3430,7 +3420,7 @@ def test_get_secret_version_field_headers(): @pytest.mark.asyncio async def test_get_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3463,7 +3453,7 @@ async def test_get_secret_version_field_headers_async(): def test_get_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3489,7 +3479,7 @@ def test_get_secret_version_flattened(): def test_get_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3504,7 +3494,7 @@ def test_get_secret_version_flattened_error(): @pytest.mark.asyncio async def test_get_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3535,7 +3525,7 @@ async def test_get_secret_version_flattened_async(): @pytest.mark.asyncio async def test_get_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3556,7 +3546,7 @@ async def test_get_secret_version_flattened_error_async(): ) def test_access_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3588,7 +3578,7 @@ def test_access_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3607,7 +3597,7 @@ async def test_access_secret_version_async( transport: str = "grpc_asyncio", request_type=service.AccessSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3644,7 +3634,7 @@ async def test_access_secret_version_async_from_dict(): def test_access_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3676,7 +3666,7 @@ def test_access_secret_version_field_headers(): @pytest.mark.asyncio async def test_access_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3709,7 +3699,7 @@ async def test_access_secret_version_field_headers_async(): def test_access_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3735,7 +3725,7 @@ def test_access_secret_version_flattened(): def test_access_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3750,7 +3740,7 @@ def test_access_secret_version_flattened_error(): @pytest.mark.asyncio async def test_access_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3781,7 +3771,7 @@ async def test_access_secret_version_flattened_async(): @pytest.mark.asyncio async def test_access_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3802,7 +3792,7 @@ async def test_access_secret_version_flattened_error_async(): ) def test_disable_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3840,7 +3830,7 @@ def test_disable_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3859,7 +3849,7 @@ async def test_disable_secret_version_async( transport: str = "grpc_asyncio", request_type=service.DisableSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3902,7 +3892,7 @@ async def test_disable_secret_version_async_from_dict(): def test_disable_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3934,7 +3924,7 @@ def test_disable_secret_version_field_headers(): @pytest.mark.asyncio async def test_disable_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3967,7 +3957,7 @@ async def test_disable_secret_version_field_headers_async(): def test_disable_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3993,7 +3983,7 @@ def test_disable_secret_version_flattened(): def test_disable_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4008,7 +3998,7 @@ def test_disable_secret_version_flattened_error(): @pytest.mark.asyncio async def test_disable_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4039,7 +4029,7 @@ async def test_disable_secret_version_flattened_async(): @pytest.mark.asyncio async def test_disable_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4060,7 +4050,7 @@ async def test_disable_secret_version_flattened_error_async(): ) def test_enable_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4098,7 +4088,7 @@ def test_enable_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4117,7 +4107,7 @@ async def test_enable_secret_version_async( transport: str = "grpc_asyncio", request_type=service.EnableSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4160,7 +4150,7 @@ async def test_enable_secret_version_async_from_dict(): def test_enable_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4192,7 +4182,7 @@ def test_enable_secret_version_field_headers(): @pytest.mark.asyncio async def test_enable_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4225,7 +4215,7 @@ async def test_enable_secret_version_field_headers_async(): def test_enable_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4251,7 +4241,7 @@ def test_enable_secret_version_flattened(): def test_enable_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4266,7 +4256,7 @@ def test_enable_secret_version_flattened_error(): @pytest.mark.asyncio async def test_enable_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4297,7 +4287,7 @@ async def test_enable_secret_version_flattened_async(): @pytest.mark.asyncio async def test_enable_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4318,7 +4308,7 @@ async def test_enable_secret_version_flattened_error_async(): ) def test_destroy_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4356,7 +4346,7 @@ def test_destroy_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4375,7 +4365,7 @@ async def test_destroy_secret_version_async( transport: str = "grpc_asyncio", request_type=service.DestroySecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4418,7 +4408,7 @@ async def test_destroy_secret_version_async_from_dict(): def test_destroy_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4450,7 +4440,7 @@ def test_destroy_secret_version_field_headers(): @pytest.mark.asyncio async def test_destroy_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4483,7 +4473,7 @@ async def test_destroy_secret_version_field_headers_async(): def test_destroy_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4509,7 +4499,7 @@ def test_destroy_secret_version_flattened(): def test_destroy_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4524,7 +4514,7 @@ def test_destroy_secret_version_flattened_error(): @pytest.mark.asyncio async def test_destroy_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4555,7 +4545,7 @@ async def test_destroy_secret_version_flattened_async(): @pytest.mark.asyncio async def test_destroy_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4576,7 +4566,7 @@ async def test_destroy_secret_version_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4608,7 +4598,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4625,7 +4615,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4662,7 +4652,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4692,7 +4682,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4721,7 +4711,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -4746,7 +4736,7 @@ def test_set_iam_policy_from_dict_foreign(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4778,7 +4768,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4795,7 +4785,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4832,7 +4822,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4862,7 +4852,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4891,7 +4881,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -4915,7 +4905,7 @@ def test_get_iam_policy_from_dict_foreign(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4947,7 +4937,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4967,7 +4957,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5004,7 +4994,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5036,7 +5026,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5069,7 +5059,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5095,7 +5085,7 @@ def test_test_iam_permissions_from_dict_foreign(): ) def test_list_secrets_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5146,7 +5136,7 @@ def test_list_secrets_rest_required_fields(request_type=service.ListSecretsReque # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_secrets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5155,7 +5145,7 @@ def test_list_secrets_rest_required_fields(request_type=service.ListSecretsReque jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_secrets._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5172,7 +5162,7 @@ def test_list_secrets_rest_required_fields(request_type=service.ListSecretsReque assert jsonified_request["parent"] == "parent_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5214,7 +5204,7 @@ def test_list_secrets_rest_required_fields(request_type=service.ListSecretsReque def test_list_secrets_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_secrets._get_unset_required_fields({}) @@ -5233,7 +5223,7 @@ def test_list_secrets_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_secrets_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -5289,7 +5279,7 @@ def test_list_secrets_rest_bad_request( transport: str = "rest", request_type=service.ListSecretsRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5311,7 +5301,7 @@ def test_list_secrets_rest_bad_request( def test_list_secrets_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5351,7 +5341,7 @@ def test_list_secrets_rest_flattened(): def test_list_secrets_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5366,7 +5356,7 @@ def test_list_secrets_rest_flattened_error(transport: str = "rest"): def test_list_secrets_rest_pager(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5434,7 +5424,7 @@ def test_list_secrets_rest_pager(transport: str = "rest"): ) def test_create_secret_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5576,7 +5566,7 @@ def test_create_secret_rest_required_fields(request_type=service.CreateSecretReq assert "secretId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5588,7 +5578,7 @@ def test_create_secret_rest_required_fields(request_type=service.CreateSecretReq jsonified_request["secretId"] = "secret_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_secret._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("secret_id",)) @@ -5601,7 +5591,7 @@ def test_create_secret_rest_required_fields(request_type=service.CreateSecretReq assert jsonified_request["secretId"] == "secret_id_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5650,7 +5640,7 @@ def test_create_secret_rest_required_fields(request_type=service.CreateSecretReq def test_create_secret_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_secret._get_unset_required_fields({}) @@ -5669,7 +5659,7 @@ def test_create_secret_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_secret_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -5723,7 +5713,7 @@ def test_create_secret_rest_bad_request( transport: str = "rest", request_type=service.CreateSecretRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5745,7 +5735,7 @@ def test_create_secret_rest_bad_request( def test_create_secret_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5787,7 +5777,7 @@ def test_create_secret_rest_flattened(): def test_create_secret_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5804,7 +5794,7 @@ def test_create_secret_rest_flattened_error(transport: str = "rest"): def test_create_secret_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5817,7 +5807,7 @@ def test_create_secret_rest_error(): ) def test_add_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5874,7 +5864,7 @@ def test_add_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5883,7 +5873,7 @@ def test_add_secret_version_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5892,7 +5882,7 @@ def test_add_secret_version_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5935,7 +5925,7 @@ def test_add_secret_version_rest_required_fields( def test_add_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_secret_version._get_unset_required_fields({}) @@ -5953,7 +5943,7 @@ def test_add_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -6011,7 +6001,7 @@ def test_add_secret_version_rest_bad_request( transport: str = "rest", request_type=service.AddSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6033,7 +6023,7 @@ def test_add_secret_version_rest_bad_request( def test_add_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6075,7 +6065,7 @@ def test_add_secret_version_rest_flattened(): def test_add_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6091,7 +6081,7 @@ def test_add_secret_version_rest_flattened_error(transport: str = "rest"): def test_add_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6104,7 +6094,7 @@ def test_add_secret_version_rest_error(): ) def test_get_secret_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6155,7 +6145,7 @@ def test_get_secret_rest_required_fields(request_type=service.GetSecretRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6164,7 +6154,7 @@ def test_get_secret_rest_required_fields(request_type=service.GetSecretRequest): jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6173,7 +6163,7 @@ def test_get_secret_rest_required_fields(request_type=service.GetSecretRequest): assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6215,7 +6205,7 @@ def test_get_secret_rest_required_fields(request_type=service.GetSecretRequest): def test_get_secret_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_secret._get_unset_required_fields({}) @@ -6225,7 +6215,7 @@ def test_get_secret_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_secret_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -6279,7 +6269,7 @@ def test_get_secret_rest_bad_request( transport: str = "rest", request_type=service.GetSecretRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6301,7 +6291,7 @@ def test_get_secret_rest_bad_request( def test_get_secret_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6341,7 +6331,7 @@ def test_get_secret_rest_flattened(): def test_get_secret_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6356,7 +6346,7 @@ def test_get_secret_rest_flattened_error(transport: str = "rest"): def test_get_secret_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6369,7 +6359,7 @@ def test_get_secret_rest_error(): ) def test_update_secret_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6508,14 +6498,14 @@ def test_update_secret_rest_required_fields(request_type=service.UpdateSecretReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_secret._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -6524,7 +6514,7 @@ def test_update_secret_rest_required_fields(request_type=service.UpdateSecretReq # verify required fields with non-default values are left alone client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6567,7 +6557,7 @@ def test_update_secret_rest_required_fields(request_type=service.UpdateSecretReq def test_update_secret_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_secret._get_unset_required_fields({}) @@ -6585,7 +6575,7 @@ def test_update_secret_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_secret_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -6639,7 +6629,7 @@ def test_update_secret_rest_bad_request( transport: str = "rest", request_type=service.UpdateSecretRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6661,7 +6651,7 @@ def test_update_secret_rest_bad_request( def test_update_secret_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6702,7 +6692,7 @@ def test_update_secret_rest_flattened(): def test_update_secret_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6718,7 +6708,7 @@ def test_update_secret_rest_flattened_error(transport: str = "rest"): def test_update_secret_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6731,7 +6721,7 @@ def test_update_secret_rest_error(): ) def test_delete_secret_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6775,7 +6765,7 @@ def test_delete_secret_rest_required_fields(request_type=service.DeleteSecretReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6784,7 +6774,7 @@ def test_delete_secret_rest_required_fields(request_type=service.DeleteSecretReq jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_secret._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("etag",)) @@ -6795,7 +6785,7 @@ def test_delete_secret_rest_required_fields(request_type=service.DeleteSecretReq assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6834,7 +6824,7 @@ def test_delete_secret_rest_required_fields(request_type=service.DeleteSecretReq def test_delete_secret_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_secret._get_unset_required_fields({}) @@ -6844,7 +6834,7 @@ def test_delete_secret_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_secret_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -6892,7 +6882,7 @@ def test_delete_secret_rest_bad_request( transport: str = "rest", request_type=service.DeleteSecretRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6914,7 +6904,7 @@ def test_delete_secret_rest_bad_request( def test_delete_secret_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6952,7 +6942,7 @@ def test_delete_secret_rest_flattened(): def test_delete_secret_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6967,7 +6957,7 @@ def test_delete_secret_rest_flattened_error(transport: str = "rest"): def test_delete_secret_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6980,7 +6970,7 @@ def test_delete_secret_rest_error(): ) def test_list_secret_versions_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7033,7 +7023,7 @@ def test_list_secret_versions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_secret_versions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7042,7 +7032,7 @@ def test_list_secret_versions_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_secret_versions._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -7059,7 +7049,7 @@ def test_list_secret_versions_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7101,7 +7091,7 @@ def test_list_secret_versions_rest_required_fields( def test_list_secret_versions_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_secret_versions._get_unset_required_fields({}) @@ -7120,7 +7110,7 @@ def test_list_secret_versions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_secret_versions_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -7178,7 +7168,7 @@ def test_list_secret_versions_rest_bad_request( transport: str = "rest", request_type=service.ListSecretVersionsRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7200,7 +7190,7 @@ def test_list_secret_versions_rest_bad_request( def test_list_secret_versions_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7241,7 +7231,7 @@ def test_list_secret_versions_rest_flattened(): def test_list_secret_versions_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7256,7 +7246,7 @@ def test_list_secret_versions_rest_flattened_error(transport: str = "rest"): def test_list_secret_versions_rest_pager(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7326,7 +7316,7 @@ def test_list_secret_versions_rest_pager(transport: str = "rest"): ) def test_get_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7383,7 +7373,7 @@ def test_get_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7392,7 +7382,7 @@ def test_get_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7401,7 +7391,7 @@ def test_get_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7443,7 +7433,7 @@ def test_get_secret_version_rest_required_fields( def test_get_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_secret_version._get_unset_required_fields({}) @@ -7453,7 +7443,7 @@ def test_get_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -7511,7 +7501,7 @@ def test_get_secret_version_rest_bad_request( transport: str = "rest", request_type=service.GetSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7533,7 +7523,7 @@ def test_get_secret_version_rest_bad_request( def test_get_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7574,7 +7564,7 @@ def test_get_secret_version_rest_flattened(): def test_get_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7589,7 +7579,7 @@ def test_get_secret_version_rest_flattened_error(transport: str = "rest"): def test_get_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7602,7 +7592,7 @@ def test_get_secret_version_rest_error(): ) def test_access_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7653,7 +7643,7 @@ def test_access_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).access_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7662,7 +7652,7 @@ def test_access_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).access_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7671,7 +7661,7 @@ def test_access_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7713,7 +7703,7 @@ def test_access_secret_version_rest_required_fields( def test_access_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.access_secret_version._get_unset_required_fields({}) @@ -7723,7 +7713,7 @@ def test_access_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_access_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -7781,7 +7771,7 @@ def test_access_secret_version_rest_bad_request( transport: str = "rest", request_type=service.AccessSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7803,7 +7793,7 @@ def test_access_secret_version_rest_bad_request( def test_access_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7845,7 +7835,7 @@ def test_access_secret_version_rest_flattened(): def test_access_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7860,7 +7850,7 @@ def test_access_secret_version_rest_flattened_error(transport: str = "rest"): def test_access_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7873,7 +7863,7 @@ def test_access_secret_version_rest_error(): ) def test_disable_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7930,7 +7920,7 @@ def test_disable_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).disable_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7939,7 +7929,7 @@ def test_disable_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).disable_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7948,7 +7938,7 @@ def test_disable_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7991,7 +7981,7 @@ def test_disable_secret_version_rest_required_fields( def test_disable_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.disable_secret_version._get_unset_required_fields({}) @@ -8001,7 +7991,7 @@ def test_disable_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_disable_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -8059,7 +8049,7 @@ def test_disable_secret_version_rest_bad_request( transport: str = "rest", request_type=service.DisableSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8081,7 +8071,7 @@ def test_disable_secret_version_rest_bad_request( def test_disable_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8123,7 +8113,7 @@ def test_disable_secret_version_rest_flattened(): def test_disable_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8138,7 +8128,7 @@ def test_disable_secret_version_rest_flattened_error(transport: str = "rest"): def test_disable_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8151,7 +8141,7 @@ def test_disable_secret_version_rest_error(): ) def test_enable_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8208,7 +8198,7 @@ def test_enable_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).enable_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8217,7 +8207,7 @@ def test_enable_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).enable_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8226,7 +8216,7 @@ def test_enable_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8269,7 +8259,7 @@ def test_enable_secret_version_rest_required_fields( def test_enable_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.enable_secret_version._get_unset_required_fields({}) @@ -8279,7 +8269,7 @@ def test_enable_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_enable_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -8337,7 +8327,7 @@ def test_enable_secret_version_rest_bad_request( transport: str = "rest", request_type=service.EnableSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8359,7 +8349,7 @@ def test_enable_secret_version_rest_bad_request( def test_enable_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8401,7 +8391,7 @@ def test_enable_secret_version_rest_flattened(): def test_enable_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8416,7 +8406,7 @@ def test_enable_secret_version_rest_flattened_error(transport: str = "rest"): def test_enable_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8429,7 +8419,7 @@ def test_enable_secret_version_rest_error(): ) def test_destroy_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8486,7 +8476,7 @@ def test_destroy_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).destroy_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8495,7 +8485,7 @@ def test_destroy_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).destroy_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8504,7 +8494,7 @@ def test_destroy_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8547,7 +8537,7 @@ def test_destroy_secret_version_rest_required_fields( def test_destroy_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.destroy_secret_version._get_unset_required_fields({}) @@ -8557,7 +8547,7 @@ def test_destroy_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_destroy_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -8615,7 +8605,7 @@ def test_destroy_secret_version_rest_bad_request( transport: str = "rest", request_type=service.DestroySecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8637,7 +8627,7 @@ def test_destroy_secret_version_rest_bad_request( def test_destroy_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8679,7 +8669,7 @@ def test_destroy_secret_version_rest_flattened(): def test_destroy_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8694,7 +8684,7 @@ def test_destroy_secret_version_rest_flattened_error(transport: str = "rest"): def test_destroy_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8707,7 +8697,7 @@ def test_destroy_secret_version_rest_error(): ) def test_set_iam_policy_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8758,7 +8748,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8767,7 +8757,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8776,7 +8766,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8817,7 +8807,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -8835,7 +8825,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -8889,7 +8879,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8911,7 +8901,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8924,7 +8914,7 @@ def test_set_iam_policy_rest_error(): ) def test_get_iam_policy_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8975,7 +8965,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8984,7 +8974,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("options",)) @@ -8995,7 +8985,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9035,7 +9025,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -9045,7 +9035,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -9099,7 +9089,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9121,7 +9111,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9134,7 +9124,7 @@ def test_get_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9184,7 +9174,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9194,7 +9184,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9205,7 +9195,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9246,7 +9236,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -9264,7 +9254,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -9320,7 +9310,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9342,24 +9332,24 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecretManagerServiceClient( @@ -9369,7 +9359,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -9384,13 +9374,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SecretManagerServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecretManagerServiceClient( @@ -9402,7 +9391,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SecretManagerServiceClient(transport=transport) assert client.transport is transport @@ -9411,13 +9400,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SecretManagerServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -9434,7 +9423,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -9448,7 +9437,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SecretManagerServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -9456,7 +9445,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -9468,7 +9457,7 @@ def test_secret_manager_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SecretManagerServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -9480,7 +9469,7 @@ def test_secret_manager_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SecretManagerServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -9526,7 +9515,7 @@ def test_secret_manager_service_base_transport_with_credentials_file(): "google.cloud.secretmanager_v1.services.secret_manager_service.transports.SecretManagerServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecretManagerServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -9545,7 +9534,7 @@ def test_secret_manager_service_base_transport_with_adc(): "google.cloud.secretmanager_v1.services.secret_manager_service.transports.SecretManagerServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecretManagerServiceTransport() adc.assert_called_once() @@ -9553,7 +9542,7 @@ def test_secret_manager_service_base_transport_with_adc(): def test_secret_manager_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SecretManagerServiceClient() adc.assert_called_once_with( scopes=None, @@ -9573,7 +9562,7 @@ def test_secret_manager_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -9620,7 +9609,7 @@ def test_secret_manager_service_transport_create_channel(transport_class, grpc_h ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -9650,7 +9639,7 @@ def test_secret_manager_service_transport_create_channel(transport_class, grpc_h def test_secret_manager_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -9688,7 +9677,7 @@ def test_secret_manager_service_grpc_transport_client_cert_source_for_mtls( def test_secret_manager_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -9708,7 +9697,7 @@ def test_secret_manager_service_http_transport_client_cert_source_for_mtls(): ) def test_secret_manager_service_host_no_port(transport_name): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="secretmanager.googleapis.com" ), @@ -9731,7 +9720,7 @@ def test_secret_manager_service_host_no_port(transport_name): ) def test_secret_manager_service_host_with_port(transport_name): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="secretmanager.googleapis.com:8000" ), @@ -9751,8 +9740,8 @@ def test_secret_manager_service_host_with_port(transport_name): ], ) def test_secret_manager_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SecretManagerServiceClient( credentials=creds1, transport=transport_name, @@ -9858,7 +9847,7 @@ def test_secret_manager_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -10118,7 +10107,7 @@ def test_client_with_default_client_info(): transports.SecretManagerServiceTransport, "_prep_wrapped_messages" ) as prep: client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -10128,7 +10117,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecretManagerServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -10137,7 +10126,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -10156,7 +10145,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -10173,7 +10162,7 @@ def test_client_ctx(): ] for transport in transports: client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py index 247e7f43db1d..9f5e908d0f30 100644 --- a/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py +++ b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py @@ -83,18 +83,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -344,7 +332,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -371,42 +359,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -419,7 +414,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_secret_manager_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -473,7 +468,7 @@ def test_secret_manager_service_client_service_account_always_use_jwt( def test_secret_manager_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -544,9 +539,7 @@ def test_secret_manager_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(SecretManagerServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -965,20 +958,20 @@ def test_secret_manager_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -990,13 +983,11 @@ def test_secret_manager_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1012,8 +1003,7 @@ def test_secret_manager_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1179,8 +1169,8 @@ def test_secret_manager_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1209,7 +1199,7 @@ def test_secret_manager_service_client_create_channel_credentials_file( ) def test_list_secrets(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1241,7 +1231,7 @@ def test_list_secrets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1258,7 +1248,7 @@ async def test_list_secrets_async( transport: str = "grpc_asyncio", request_type=service.ListSecretsRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1295,7 +1285,7 @@ async def test_list_secrets_async_from_dict(): def test_list_secrets_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1325,7 +1315,7 @@ def test_list_secrets_field_headers(): @pytest.mark.asyncio async def test_list_secrets_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1356,7 +1346,7 @@ async def test_list_secrets_field_headers_async(): def test_list_secrets_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1380,7 +1370,7 @@ def test_list_secrets_flattened(): def test_list_secrets_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1395,7 +1385,7 @@ def test_list_secrets_flattened_error(): @pytest.mark.asyncio async def test_list_secrets_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1424,7 +1414,7 @@ async def test_list_secrets_flattened_async(): @pytest.mark.asyncio async def test_list_secrets_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1438,7 +1428,7 @@ async def test_list_secrets_flattened_error_async(): def test_list_secrets_pager(transport_name: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1488,7 +1478,7 @@ def test_list_secrets_pager(transport_name: str = "grpc"): def test_list_secrets_pages(transport_name: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1530,7 +1520,7 @@ def test_list_secrets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_secrets_async_pager(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1580,7 +1570,7 @@ async def test_list_secrets_async_pager(): @pytest.mark.asyncio async def test_list_secrets_async_pages(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1635,7 +1625,7 @@ async def test_list_secrets_async_pages(): ) def test_create_secret(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1665,7 +1655,7 @@ def test_create_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1682,7 +1672,7 @@ async def test_create_secret_async( transport: str = "grpc_asyncio", request_type=service.CreateSecretRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1717,7 +1707,7 @@ async def test_create_secret_async_from_dict(): def test_create_secret_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1747,7 +1737,7 @@ def test_create_secret_field_headers(): @pytest.mark.asyncio async def test_create_secret_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1776,7 +1766,7 @@ async def test_create_secret_field_headers_async(): def test_create_secret_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1808,7 +1798,7 @@ def test_create_secret_flattened(): def test_create_secret_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1825,7 +1815,7 @@ def test_create_secret_flattened_error(): @pytest.mark.asyncio async def test_create_secret_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1860,7 +1850,7 @@ async def test_create_secret_flattened_async(): @pytest.mark.asyncio async def test_create_secret_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1883,7 +1873,7 @@ async def test_create_secret_flattened_error_async(): ) def test_add_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1917,7 +1907,7 @@ def test_add_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1936,7 +1926,7 @@ async def test_add_secret_version_async( transport: str = "grpc_asyncio", request_type=service.AddSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1975,7 +1965,7 @@ async def test_add_secret_version_async_from_dict(): def test_add_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2007,7 +1997,7 @@ def test_add_secret_version_field_headers(): @pytest.mark.asyncio async def test_add_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2040,7 +2030,7 @@ async def test_add_secret_version_field_headers_async(): def test_add_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2070,7 +2060,7 @@ def test_add_secret_version_flattened(): def test_add_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2086,7 +2076,7 @@ def test_add_secret_version_flattened_error(): @pytest.mark.asyncio async def test_add_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2121,7 +2111,7 @@ async def test_add_secret_version_flattened_async(): @pytest.mark.asyncio async def test_add_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2143,7 +2133,7 @@ async def test_add_secret_version_flattened_error_async(): ) def test_get_secret(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2173,7 +2163,7 @@ def test_get_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2190,7 +2180,7 @@ async def test_get_secret_async( transport: str = "grpc_asyncio", request_type=service.GetSecretRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2225,7 +2215,7 @@ async def test_get_secret_async_from_dict(): def test_get_secret_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2255,7 +2245,7 @@ def test_get_secret_field_headers(): @pytest.mark.asyncio async def test_get_secret_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2284,7 +2274,7 @@ async def test_get_secret_field_headers_async(): def test_get_secret_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2308,7 +2298,7 @@ def test_get_secret_flattened(): def test_get_secret_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2323,7 +2313,7 @@ def test_get_secret_flattened_error(): @pytest.mark.asyncio async def test_get_secret_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2350,7 +2340,7 @@ async def test_get_secret_flattened_async(): @pytest.mark.asyncio async def test_get_secret_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2371,7 +2361,7 @@ async def test_get_secret_flattened_error_async(): ) def test_update_secret(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2401,7 +2391,7 @@ def test_update_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2418,7 +2408,7 @@ async def test_update_secret_async( transport: str = "grpc_asyncio", request_type=service.UpdateSecretRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2453,7 +2443,7 @@ async def test_update_secret_async_from_dict(): def test_update_secret_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2483,7 +2473,7 @@ def test_update_secret_field_headers(): @pytest.mark.asyncio async def test_update_secret_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2512,7 +2502,7 @@ async def test_update_secret_field_headers_async(): def test_update_secret_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2540,7 +2530,7 @@ def test_update_secret_flattened(): def test_update_secret_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2556,7 +2546,7 @@ def test_update_secret_flattened_error(): @pytest.mark.asyncio async def test_update_secret_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2587,7 +2577,7 @@ async def test_update_secret_flattened_async(): @pytest.mark.asyncio async def test_update_secret_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2609,7 +2599,7 @@ async def test_update_secret_flattened_error_async(): ) def test_delete_secret(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2636,7 +2626,7 @@ def test_delete_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2653,7 +2643,7 @@ async def test_delete_secret_async( transport: str = "grpc_asyncio", request_type=service.DeleteSecretRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2683,7 +2673,7 @@ async def test_delete_secret_async_from_dict(): def test_delete_secret_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2713,7 +2703,7 @@ def test_delete_secret_field_headers(): @pytest.mark.asyncio async def test_delete_secret_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2742,7 +2732,7 @@ async def test_delete_secret_field_headers_async(): def test_delete_secret_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2766,7 +2756,7 @@ def test_delete_secret_flattened(): def test_delete_secret_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2781,7 +2771,7 @@ def test_delete_secret_flattened_error(): @pytest.mark.asyncio async def test_delete_secret_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2808,7 +2798,7 @@ async def test_delete_secret_flattened_async(): @pytest.mark.asyncio async def test_delete_secret_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2829,7 +2819,7 @@ async def test_delete_secret_flattened_error_async(): ) def test_list_secret_versions(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2863,7 +2853,7 @@ def test_list_secret_versions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2882,7 +2872,7 @@ async def test_list_secret_versions_async( transport: str = "grpc_asyncio", request_type=service.ListSecretVersionsRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2921,7 +2911,7 @@ async def test_list_secret_versions_async_from_dict(): def test_list_secret_versions_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2953,7 +2943,7 @@ def test_list_secret_versions_field_headers(): @pytest.mark.asyncio async def test_list_secret_versions_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2986,7 +2976,7 @@ async def test_list_secret_versions_field_headers_async(): def test_list_secret_versions_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3012,7 +3002,7 @@ def test_list_secret_versions_flattened(): def test_list_secret_versions_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3027,7 +3017,7 @@ def test_list_secret_versions_flattened_error(): @pytest.mark.asyncio async def test_list_secret_versions_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3058,7 +3048,7 @@ async def test_list_secret_versions_flattened_async(): @pytest.mark.asyncio async def test_list_secret_versions_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3072,7 +3062,7 @@ async def test_list_secret_versions_flattened_error_async(): def test_list_secret_versions_pager(transport_name: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3124,7 +3114,7 @@ def test_list_secret_versions_pager(transport_name: str = "grpc"): def test_list_secret_versions_pages(transport_name: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3168,7 +3158,7 @@ def test_list_secret_versions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_secret_versions_async_pager(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3220,7 +3210,7 @@ async def test_list_secret_versions_async_pager(): @pytest.mark.asyncio async def test_list_secret_versions_async_pages(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3277,7 +3267,7 @@ async def test_list_secret_versions_async_pages(): ) def test_get_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3311,7 +3301,7 @@ def test_get_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3330,7 +3320,7 @@ async def test_get_secret_version_async( transport: str = "grpc_asyncio", request_type=service.GetSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3369,7 +3359,7 @@ async def test_get_secret_version_async_from_dict(): def test_get_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3401,7 +3391,7 @@ def test_get_secret_version_field_headers(): @pytest.mark.asyncio async def test_get_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3434,7 +3424,7 @@ async def test_get_secret_version_field_headers_async(): def test_get_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3460,7 +3450,7 @@ def test_get_secret_version_flattened(): def test_get_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3475,7 +3465,7 @@ def test_get_secret_version_flattened_error(): @pytest.mark.asyncio async def test_get_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3506,7 +3496,7 @@ async def test_get_secret_version_flattened_async(): @pytest.mark.asyncio async def test_get_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3527,7 +3517,7 @@ async def test_get_secret_version_flattened_error_async(): ) def test_access_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3559,7 +3549,7 @@ def test_access_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3578,7 +3568,7 @@ async def test_access_secret_version_async( transport: str = "grpc_asyncio", request_type=service.AccessSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3615,7 +3605,7 @@ async def test_access_secret_version_async_from_dict(): def test_access_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3647,7 +3637,7 @@ def test_access_secret_version_field_headers(): @pytest.mark.asyncio async def test_access_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3680,7 +3670,7 @@ async def test_access_secret_version_field_headers_async(): def test_access_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3706,7 +3696,7 @@ def test_access_secret_version_flattened(): def test_access_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3721,7 +3711,7 @@ def test_access_secret_version_flattened_error(): @pytest.mark.asyncio async def test_access_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3752,7 +3742,7 @@ async def test_access_secret_version_flattened_async(): @pytest.mark.asyncio async def test_access_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3773,7 +3763,7 @@ async def test_access_secret_version_flattened_error_async(): ) def test_disable_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3807,7 +3797,7 @@ def test_disable_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3826,7 +3816,7 @@ async def test_disable_secret_version_async( transport: str = "grpc_asyncio", request_type=service.DisableSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3865,7 +3855,7 @@ async def test_disable_secret_version_async_from_dict(): def test_disable_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3897,7 +3887,7 @@ def test_disable_secret_version_field_headers(): @pytest.mark.asyncio async def test_disable_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3930,7 +3920,7 @@ async def test_disable_secret_version_field_headers_async(): def test_disable_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3956,7 +3946,7 @@ def test_disable_secret_version_flattened(): def test_disable_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3971,7 +3961,7 @@ def test_disable_secret_version_flattened_error(): @pytest.mark.asyncio async def test_disable_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4002,7 +3992,7 @@ async def test_disable_secret_version_flattened_async(): @pytest.mark.asyncio async def test_disable_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4023,7 +4013,7 @@ async def test_disable_secret_version_flattened_error_async(): ) def test_enable_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4057,7 +4047,7 @@ def test_enable_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4076,7 +4066,7 @@ async def test_enable_secret_version_async( transport: str = "grpc_asyncio", request_type=service.EnableSecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4115,7 +4105,7 @@ async def test_enable_secret_version_async_from_dict(): def test_enable_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4147,7 +4137,7 @@ def test_enable_secret_version_field_headers(): @pytest.mark.asyncio async def test_enable_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4180,7 +4170,7 @@ async def test_enable_secret_version_field_headers_async(): def test_enable_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4206,7 +4196,7 @@ def test_enable_secret_version_flattened(): def test_enable_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4221,7 +4211,7 @@ def test_enable_secret_version_flattened_error(): @pytest.mark.asyncio async def test_enable_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4252,7 +4242,7 @@ async def test_enable_secret_version_flattened_async(): @pytest.mark.asyncio async def test_enable_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4273,7 +4263,7 @@ async def test_enable_secret_version_flattened_error_async(): ) def test_destroy_secret_version(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4307,7 +4297,7 @@ def test_destroy_secret_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4326,7 +4316,7 @@ async def test_destroy_secret_version_async( transport: str = "grpc_asyncio", request_type=service.DestroySecretVersionRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4365,7 +4355,7 @@ async def test_destroy_secret_version_async_from_dict(): def test_destroy_secret_version_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4397,7 +4387,7 @@ def test_destroy_secret_version_field_headers(): @pytest.mark.asyncio async def test_destroy_secret_version_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4430,7 +4420,7 @@ async def test_destroy_secret_version_field_headers_async(): def test_destroy_secret_version_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4456,7 +4446,7 @@ def test_destroy_secret_version_flattened(): def test_destroy_secret_version_flattened_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4471,7 +4461,7 @@ def test_destroy_secret_version_flattened_error(): @pytest.mark.asyncio async def test_destroy_secret_version_flattened_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4502,7 +4492,7 @@ async def test_destroy_secret_version_flattened_async(): @pytest.mark.asyncio async def test_destroy_secret_version_flattened_error_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4523,7 +4513,7 @@ async def test_destroy_secret_version_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4555,7 +4545,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4572,7 +4562,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4609,7 +4599,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4639,7 +4629,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4668,7 +4658,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -4693,7 +4683,7 @@ def test_set_iam_policy_from_dict_foreign(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4725,7 +4715,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4742,7 +4732,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4779,7 +4769,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4809,7 +4799,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4838,7 +4828,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -4862,7 +4852,7 @@ def test_get_iam_policy_from_dict_foreign(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4894,7 +4884,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4914,7 +4904,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4951,7 +4941,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4983,7 +4973,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5016,7 +5006,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5042,7 +5032,7 @@ def test_test_iam_permissions_from_dict_foreign(): ) def test_list_secrets_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5093,7 +5083,7 @@ def test_list_secrets_rest_required_fields(request_type=service.ListSecretsReque # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_secrets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5102,7 +5092,7 @@ def test_list_secrets_rest_required_fields(request_type=service.ListSecretsReque jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_secrets._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5118,7 +5108,7 @@ def test_list_secrets_rest_required_fields(request_type=service.ListSecretsReque assert jsonified_request["parent"] == "parent_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5160,7 +5150,7 @@ def test_list_secrets_rest_required_fields(request_type=service.ListSecretsReque def test_list_secrets_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_secrets._get_unset_required_fields({}) @@ -5178,7 +5168,7 @@ def test_list_secrets_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_secrets_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -5234,7 +5224,7 @@ def test_list_secrets_rest_bad_request( transport: str = "rest", request_type=service.ListSecretsRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5256,7 +5246,7 @@ def test_list_secrets_rest_bad_request( def test_list_secrets_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5296,7 +5286,7 @@ def test_list_secrets_rest_flattened(): def test_list_secrets_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5311,7 +5301,7 @@ def test_list_secrets_rest_flattened_error(transport: str = "rest"): def test_list_secrets_rest_pager(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5379,7 +5369,7 @@ def test_list_secrets_rest_pager(transport: str = "rest"): ) def test_create_secret_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5506,7 +5496,7 @@ def test_create_secret_rest_required_fields(request_type=service.CreateSecretReq assert "secretId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5518,7 +5508,7 @@ def test_create_secret_rest_required_fields(request_type=service.CreateSecretReq jsonified_request["secretId"] = "secret_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_secret._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("secret_id",)) @@ -5531,7 +5521,7 @@ def test_create_secret_rest_required_fields(request_type=service.CreateSecretReq assert jsonified_request["secretId"] == "secret_id_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5580,7 +5570,7 @@ def test_create_secret_rest_required_fields(request_type=service.CreateSecretReq def test_create_secret_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_secret._get_unset_required_fields({}) @@ -5599,7 +5589,7 @@ def test_create_secret_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_secret_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -5653,7 +5643,7 @@ def test_create_secret_rest_bad_request( transport: str = "rest", request_type=service.CreateSecretRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5675,7 +5665,7 @@ def test_create_secret_rest_bad_request( def test_create_secret_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5717,7 +5707,7 @@ def test_create_secret_rest_flattened(): def test_create_secret_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5734,7 +5724,7 @@ def test_create_secret_rest_flattened_error(transport: str = "rest"): def test_create_secret_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5747,7 +5737,7 @@ def test_create_secret_rest_error(): ) def test_add_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5800,7 +5790,7 @@ def test_add_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5809,7 +5799,7 @@ def test_add_secret_version_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).add_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5818,7 +5808,7 @@ def test_add_secret_version_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5861,7 +5851,7 @@ def test_add_secret_version_rest_required_fields( def test_add_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.add_secret_version._get_unset_required_fields({}) @@ -5879,7 +5869,7 @@ def test_add_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -5937,7 +5927,7 @@ def test_add_secret_version_rest_bad_request( transport: str = "rest", request_type=service.AddSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5959,7 +5949,7 @@ def test_add_secret_version_rest_bad_request( def test_add_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6002,7 +5992,7 @@ def test_add_secret_version_rest_flattened(): def test_add_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6018,7 +6008,7 @@ def test_add_secret_version_rest_flattened_error(transport: str = "rest"): def test_add_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6031,7 +6021,7 @@ def test_add_secret_version_rest_error(): ) def test_get_secret_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6080,7 +6070,7 @@ def test_get_secret_rest_required_fields(request_type=service.GetSecretRequest): # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6089,7 +6079,7 @@ def test_get_secret_rest_required_fields(request_type=service.GetSecretRequest): jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6098,7 +6088,7 @@ def test_get_secret_rest_required_fields(request_type=service.GetSecretRequest): assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6140,7 +6130,7 @@ def test_get_secret_rest_required_fields(request_type=service.GetSecretRequest): def test_get_secret_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_secret._get_unset_required_fields({}) @@ -6150,7 +6140,7 @@ def test_get_secret_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_secret_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -6204,7 +6194,7 @@ def test_get_secret_rest_bad_request( transport: str = "rest", request_type=service.GetSecretRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6226,7 +6216,7 @@ def test_get_secret_rest_bad_request( def test_get_secret_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6266,7 +6256,7 @@ def test_get_secret_rest_flattened(): def test_get_secret_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6281,7 +6271,7 @@ def test_get_secret_rest_flattened_error(transport: str = "rest"): def test_get_secret_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6294,7 +6284,7 @@ def test_get_secret_rest_error(): ) def test_update_secret_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6418,14 +6408,14 @@ def test_update_secret_rest_required_fields(request_type=service.UpdateSecretReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_secret._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -6434,7 +6424,7 @@ def test_update_secret_rest_required_fields(request_type=service.UpdateSecretReq # verify required fields with non-default values are left alone client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6477,7 +6467,7 @@ def test_update_secret_rest_required_fields(request_type=service.UpdateSecretReq def test_update_secret_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_secret._get_unset_required_fields({}) @@ -6495,7 +6485,7 @@ def test_update_secret_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_secret_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -6549,7 +6539,7 @@ def test_update_secret_rest_bad_request( transport: str = "rest", request_type=service.UpdateSecretRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6571,7 +6561,7 @@ def test_update_secret_rest_bad_request( def test_update_secret_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6613,7 +6603,7 @@ def test_update_secret_rest_flattened(): def test_update_secret_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6629,7 +6619,7 @@ def test_update_secret_rest_flattened_error(transport: str = "rest"): def test_update_secret_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6642,7 +6632,7 @@ def test_update_secret_rest_error(): ) def test_delete_secret_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6686,7 +6676,7 @@ def test_delete_secret_rest_required_fields(request_type=service.DeleteSecretReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6695,7 +6685,7 @@ def test_delete_secret_rest_required_fields(request_type=service.DeleteSecretReq jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6704,7 +6694,7 @@ def test_delete_secret_rest_required_fields(request_type=service.DeleteSecretReq assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6743,7 +6733,7 @@ def test_delete_secret_rest_required_fields(request_type=service.DeleteSecretReq def test_delete_secret_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_secret._get_unset_required_fields({}) @@ -6753,7 +6743,7 @@ def test_delete_secret_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_secret_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -6801,7 +6791,7 @@ def test_delete_secret_rest_bad_request( transport: str = "rest", request_type=service.DeleteSecretRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6823,7 +6813,7 @@ def test_delete_secret_rest_bad_request( def test_delete_secret_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6861,7 +6851,7 @@ def test_delete_secret_rest_flattened(): def test_delete_secret_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6876,7 +6866,7 @@ def test_delete_secret_rest_flattened_error(transport: str = "rest"): def test_delete_secret_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6889,7 +6879,7 @@ def test_delete_secret_rest_error(): ) def test_list_secret_versions_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6942,7 +6932,7 @@ def test_list_secret_versions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_secret_versions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6951,7 +6941,7 @@ def test_list_secret_versions_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_secret_versions._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -6967,7 +6957,7 @@ def test_list_secret_versions_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7009,7 +6999,7 @@ def test_list_secret_versions_rest_required_fields( def test_list_secret_versions_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_secret_versions._get_unset_required_fields({}) @@ -7027,7 +7017,7 @@ def test_list_secret_versions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_secret_versions_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -7085,7 +7075,7 @@ def test_list_secret_versions_rest_bad_request( transport: str = "rest", request_type=service.ListSecretVersionsRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7107,7 +7097,7 @@ def test_list_secret_versions_rest_bad_request( def test_list_secret_versions_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7149,7 +7139,7 @@ def test_list_secret_versions_rest_flattened(): def test_list_secret_versions_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7164,7 +7154,7 @@ def test_list_secret_versions_rest_flattened_error(transport: str = "rest"): def test_list_secret_versions_rest_pager(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7234,7 +7224,7 @@ def test_list_secret_versions_rest_pager(transport: str = "rest"): ) def test_get_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7287,7 +7277,7 @@ def test_get_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7296,7 +7286,7 @@ def test_get_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7305,7 +7295,7 @@ def test_get_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7347,7 +7337,7 @@ def test_get_secret_version_rest_required_fields( def test_get_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_secret_version._get_unset_required_fields({}) @@ -7357,7 +7347,7 @@ def test_get_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -7415,7 +7405,7 @@ def test_get_secret_version_rest_bad_request( transport: str = "rest", request_type=service.GetSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7437,7 +7427,7 @@ def test_get_secret_version_rest_bad_request( def test_get_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7479,7 +7469,7 @@ def test_get_secret_version_rest_flattened(): def test_get_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7494,7 +7484,7 @@ def test_get_secret_version_rest_flattened_error(transport: str = "rest"): def test_get_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7507,7 +7497,7 @@ def test_get_secret_version_rest_error(): ) def test_access_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7558,7 +7548,7 @@ def test_access_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).access_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7567,7 +7557,7 @@ def test_access_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).access_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7576,7 +7566,7 @@ def test_access_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7618,7 +7608,7 @@ def test_access_secret_version_rest_required_fields( def test_access_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.access_secret_version._get_unset_required_fields({}) @@ -7628,7 +7618,7 @@ def test_access_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_access_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -7686,7 +7676,7 @@ def test_access_secret_version_rest_bad_request( transport: str = "rest", request_type=service.AccessSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7708,7 +7698,7 @@ def test_access_secret_version_rest_bad_request( def test_access_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7750,7 +7740,7 @@ def test_access_secret_version_rest_flattened(): def test_access_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7765,7 +7755,7 @@ def test_access_secret_version_rest_flattened_error(transport: str = "rest"): def test_access_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7778,7 +7768,7 @@ def test_access_secret_version_rest_error(): ) def test_disable_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7831,7 +7821,7 @@ def test_disable_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).disable_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7840,7 +7830,7 @@ def test_disable_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).disable_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7849,7 +7839,7 @@ def test_disable_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7892,7 +7882,7 @@ def test_disable_secret_version_rest_required_fields( def test_disable_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.disable_secret_version._get_unset_required_fields({}) @@ -7902,7 +7892,7 @@ def test_disable_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_disable_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -7960,7 +7950,7 @@ def test_disable_secret_version_rest_bad_request( transport: str = "rest", request_type=service.DisableSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7982,7 +7972,7 @@ def test_disable_secret_version_rest_bad_request( def test_disable_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8024,7 +8014,7 @@ def test_disable_secret_version_rest_flattened(): def test_disable_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8039,7 +8029,7 @@ def test_disable_secret_version_rest_flattened_error(transport: str = "rest"): def test_disable_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8052,7 +8042,7 @@ def test_disable_secret_version_rest_error(): ) def test_enable_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8105,7 +8095,7 @@ def test_enable_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).enable_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8114,7 +8104,7 @@ def test_enable_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).enable_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8123,7 +8113,7 @@ def test_enable_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8166,7 +8156,7 @@ def test_enable_secret_version_rest_required_fields( def test_enable_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.enable_secret_version._get_unset_required_fields({}) @@ -8176,7 +8166,7 @@ def test_enable_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_enable_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -8234,7 +8224,7 @@ def test_enable_secret_version_rest_bad_request( transport: str = "rest", request_type=service.EnableSecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8256,7 +8246,7 @@ def test_enable_secret_version_rest_bad_request( def test_enable_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8298,7 +8288,7 @@ def test_enable_secret_version_rest_flattened(): def test_enable_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8313,7 +8303,7 @@ def test_enable_secret_version_rest_flattened_error(transport: str = "rest"): def test_enable_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8326,7 +8316,7 @@ def test_enable_secret_version_rest_error(): ) def test_destroy_secret_version_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8379,7 +8369,7 @@ def test_destroy_secret_version_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).destroy_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8388,7 +8378,7 @@ def test_destroy_secret_version_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).destroy_secret_version._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8397,7 +8387,7 @@ def test_destroy_secret_version_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8440,7 +8430,7 @@ def test_destroy_secret_version_rest_required_fields( def test_destroy_secret_version_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.destroy_secret_version._get_unset_required_fields({}) @@ -8450,7 +8440,7 @@ def test_destroy_secret_version_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_destroy_secret_version_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -8508,7 +8498,7 @@ def test_destroy_secret_version_rest_bad_request( transport: str = "rest", request_type=service.DestroySecretVersionRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8530,7 +8520,7 @@ def test_destroy_secret_version_rest_bad_request( def test_destroy_secret_version_rest_flattened(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8572,7 +8562,7 @@ def test_destroy_secret_version_rest_flattened(): def test_destroy_secret_version_rest_flattened_error(transport: str = "rest"): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8587,7 +8577,7 @@ def test_destroy_secret_version_rest_flattened_error(transport: str = "rest"): def test_destroy_secret_version_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8600,7 +8590,7 @@ def test_destroy_secret_version_rest_error(): ) def test_set_iam_policy_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8651,7 +8641,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8660,7 +8650,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8669,7 +8659,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8710,7 +8700,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -8728,7 +8718,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -8782,7 +8772,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8804,7 +8794,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8817,7 +8807,7 @@ def test_set_iam_policy_rest_error(): ) def test_get_iam_policy_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8868,7 +8858,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8877,7 +8867,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("options",)) @@ -8888,7 +8878,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8928,7 +8918,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -8938,7 +8928,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -8992,7 +8982,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9014,7 +9004,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9027,7 +9017,7 @@ def test_get_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9077,7 +9067,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9087,7 +9077,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9098,7 +9088,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9139,7 +9129,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -9157,7 +9147,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.SecretManagerServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecretManagerServiceRestInterceptor(), @@ -9213,7 +9203,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9235,24 +9225,24 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_error(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecretManagerServiceClient( @@ -9262,7 +9252,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -9277,13 +9267,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SecretManagerServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecretManagerServiceClient( @@ -9295,7 +9284,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SecretManagerServiceClient(transport=transport) assert client.transport is transport @@ -9304,13 +9293,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SecretManagerServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SecretManagerServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -9327,7 +9316,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -9341,7 +9330,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SecretManagerServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -9349,7 +9338,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -9361,7 +9350,7 @@ def test_secret_manager_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SecretManagerServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -9373,7 +9362,7 @@ def test_secret_manager_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SecretManagerServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -9419,7 +9408,7 @@ def test_secret_manager_service_base_transport_with_credentials_file(): "google.cloud.secretmanager_v1beta1.services.secret_manager_service.transports.SecretManagerServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecretManagerServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -9438,7 +9427,7 @@ def test_secret_manager_service_base_transport_with_adc(): "google.cloud.secretmanager_v1beta1.services.secret_manager_service.transports.SecretManagerServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecretManagerServiceTransport() adc.assert_called_once() @@ -9446,7 +9435,7 @@ def test_secret_manager_service_base_transport_with_adc(): def test_secret_manager_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SecretManagerServiceClient() adc.assert_called_once_with( scopes=None, @@ -9466,7 +9455,7 @@ def test_secret_manager_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -9513,7 +9502,7 @@ def test_secret_manager_service_transport_create_channel(transport_class, grpc_h ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -9543,7 +9532,7 @@ def test_secret_manager_service_transport_create_channel(transport_class, grpc_h def test_secret_manager_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -9581,7 +9570,7 @@ def test_secret_manager_service_grpc_transport_client_cert_source_for_mtls( def test_secret_manager_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -9601,7 +9590,7 @@ def test_secret_manager_service_http_transport_client_cert_source_for_mtls(): ) def test_secret_manager_service_host_no_port(transport_name): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="secretmanager.googleapis.com" ), @@ -9624,7 +9613,7 @@ def test_secret_manager_service_host_no_port(transport_name): ) def test_secret_manager_service_host_with_port(transport_name): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="secretmanager.googleapis.com:8000" ), @@ -9644,8 +9633,8 @@ def test_secret_manager_service_host_with_port(transport_name): ], ) def test_secret_manager_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SecretManagerServiceClient( credentials=creds1, transport=transport_name, @@ -9751,7 +9740,7 @@ def test_secret_manager_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -9988,7 +9977,7 @@ def test_client_with_default_client_info(): transports.SecretManagerServiceTransport, "_prep_wrapped_messages" ) as prep: client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -9998,7 +9987,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecretManagerServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -10007,7 +9996,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SecretManagerServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -10026,7 +10015,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -10043,7 +10032,7 @@ def test_client_ctx(): ] for transport in transports: client = SecretManagerServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager/gapic_version.py b/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager/gapic_version.py index cf99f3acb1ee..360a0d13ebdd 100644 --- a/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager/gapic_version.py +++ b/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.2" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager_v1/gapic_version.py b/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager_v1/gapic_version.py index cf99f3acb1ee..360a0d13ebdd 100644 --- a/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager_v1/gapic_version.py +++ b/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.2" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager_v1/services/secure_source_manager/client.py b/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager_v1/services/secure_source_manager/client.py index 0f336b59fb0f..9cdfaa165138 100644 --- a/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager_v1/services/secure_source_manager/client.py +++ b/packages/google-cloud-securesourcemanager/google/cloud/securesourcemanager_v1/services/secure_source_manager/client.py @@ -464,6 +464,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -482,6 +483,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -556,17 +558,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SecureSourceManagerClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SecureSourceManagerClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-securesourcemanager/samples/generated_samples/snippet_metadata_google.cloud.securesourcemanager.v1.json b/packages/google-cloud-securesourcemanager/samples/generated_samples/snippet_metadata_google.cloud.securesourcemanager.v1.json index c308b6ab36ff..d36601a453e4 100644 --- a/packages/google-cloud-securesourcemanager/samples/generated_samples/snippet_metadata_google.cloud.securesourcemanager.v1.json +++ b/packages/google-cloud-securesourcemanager/samples/generated_samples/snippet_metadata_google.cloud.securesourcemanager.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-securesourcemanager", - "version": "0.1.2" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-securesourcemanager/setup.py b/packages/google-cloud-securesourcemanager/setup.py index bc63b94bcadb..087e3daf16cb 100644 --- a/packages/google-cloud-securesourcemanager/setup.py +++ b/packages/google-cloud-securesourcemanager/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", diff --git a/packages/google-cloud-securesourcemanager/testing/constraints-3.7.txt b/packages/google-cloud-securesourcemanager/testing/constraints-3.7.txt index 44ffd04543a8..712d45b4c5ea 100644 --- a/packages/google-cloud-securesourcemanager/testing/constraints-3.7.txt +++ b/packages/google-cloud-securesourcemanager/testing/constraints-3.7.txt @@ -5,6 +5,7 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 grpc-google-iam-v1==0.12.4 diff --git a/packages/google-cloud-securesourcemanager/tests/unit/gapic/securesourcemanager_v1/test_secure_source_manager.py b/packages/google-cloud-securesourcemanager/tests/unit/gapic/securesourcemanager_v1/test_secure_source_manager.py index 66e1b2327bd8..e6413964eaf5 100644 --- a/packages/google-cloud-securesourcemanager/tests/unit/gapic/securesourcemanager_v1/test_secure_source_manager.py +++ b/packages/google-cloud-securesourcemanager/tests/unit/gapic/securesourcemanager_v1/test_secure_source_manager.py @@ -95,18 +95,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -356,7 +344,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -383,42 +371,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -431,7 +426,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_secure_source_manager_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -485,7 +480,7 @@ def test_secure_source_manager_client_service_account_always_use_jwt( def test_secure_source_manager_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -556,9 +551,7 @@ def test_secure_source_manager_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(SecureSourceManagerClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -977,20 +970,20 @@ def test_secure_source_manager_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -1002,13 +995,11 @@ def test_secure_source_manager_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1024,8 +1015,7 @@ def test_secure_source_manager_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1191,8 +1181,8 @@ def test_secure_source_manager_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1221,7 +1211,7 @@ def test_secure_source_manager_client_create_channel_credentials_file( ) def test_list_instances(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1253,7 +1243,7 @@ def test_list_instances_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1271,7 +1261,7 @@ async def test_list_instances_async( request_type=secure_source_manager.ListInstancesRequest, ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1308,7 +1298,7 @@ async def test_list_instances_async_from_dict(): def test_list_instances_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1338,7 +1328,7 @@ def test_list_instances_field_headers(): @pytest.mark.asyncio async def test_list_instances_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1369,7 +1359,7 @@ async def test_list_instances_field_headers_async(): def test_list_instances_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1393,7 +1383,7 @@ def test_list_instances_flattened(): def test_list_instances_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1408,7 +1398,7 @@ def test_list_instances_flattened_error(): @pytest.mark.asyncio async def test_list_instances_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1437,7 +1427,7 @@ async def test_list_instances_flattened_async(): @pytest.mark.asyncio async def test_list_instances_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1451,7 +1441,7 @@ async def test_list_instances_flattened_error_async(): def test_list_instances_pager(transport_name: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1501,7 +1491,7 @@ def test_list_instances_pager(transport_name: str = "grpc"): def test_list_instances_pages(transport_name: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1543,7 +1533,7 @@ def test_list_instances_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_instances_async_pager(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1593,7 +1583,7 @@ async def test_list_instances_async_pager(): @pytest.mark.asyncio async def test_list_instances_async_pages(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1648,7 +1638,7 @@ async def test_list_instances_async_pages(): ) def test_get_instance(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1687,7 +1677,7 @@ def test_get_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1705,7 +1695,7 @@ async def test_get_instance_async( request_type=secure_source_manager.GetInstanceRequest, ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1749,7 +1739,7 @@ async def test_get_instance_async_from_dict(): def test_get_instance_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1779,7 +1769,7 @@ def test_get_instance_field_headers(): @pytest.mark.asyncio async def test_get_instance_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1810,7 +1800,7 @@ async def test_get_instance_field_headers_async(): def test_get_instance_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1834,7 +1824,7 @@ def test_get_instance_flattened(): def test_get_instance_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1849,7 +1839,7 @@ def test_get_instance_flattened_error(): @pytest.mark.asyncio async def test_get_instance_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1878,7 +1868,7 @@ async def test_get_instance_flattened_async(): @pytest.mark.asyncio async def test_get_instance_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1899,7 +1889,7 @@ async def test_get_instance_flattened_error_async(): ) def test_create_instance(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1926,7 +1916,7 @@ def test_create_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1944,7 +1934,7 @@ async def test_create_instance_async( request_type=secure_source_manager.CreateInstanceRequest, ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1976,7 +1966,7 @@ async def test_create_instance_async_from_dict(): def test_create_instance_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2006,7 +1996,7 @@ def test_create_instance_field_headers(): @pytest.mark.asyncio async def test_create_instance_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2037,7 +2027,7 @@ async def test_create_instance_field_headers_async(): def test_create_instance_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2069,7 +2059,7 @@ def test_create_instance_flattened(): def test_create_instance_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2086,7 +2076,7 @@ def test_create_instance_flattened_error(): @pytest.mark.asyncio async def test_create_instance_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2123,7 +2113,7 @@ async def test_create_instance_flattened_async(): @pytest.mark.asyncio async def test_create_instance_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2146,7 +2136,7 @@ async def test_create_instance_flattened_error_async(): ) def test_delete_instance(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2173,7 +2163,7 @@ def test_delete_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2191,7 +2181,7 @@ async def test_delete_instance_async( request_type=secure_source_manager.DeleteInstanceRequest, ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2223,7 +2213,7 @@ async def test_delete_instance_async_from_dict(): def test_delete_instance_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2253,7 +2243,7 @@ def test_delete_instance_field_headers(): @pytest.mark.asyncio async def test_delete_instance_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2284,7 +2274,7 @@ async def test_delete_instance_field_headers_async(): def test_delete_instance_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2308,7 +2298,7 @@ def test_delete_instance_flattened(): def test_delete_instance_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2323,7 +2313,7 @@ def test_delete_instance_flattened_error(): @pytest.mark.asyncio async def test_delete_instance_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2352,7 +2342,7 @@ async def test_delete_instance_flattened_async(): @pytest.mark.asyncio async def test_delete_instance_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2373,7 +2363,7 @@ async def test_delete_instance_flattened_error_async(): ) def test_list_repositories(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2405,7 +2395,7 @@ def test_list_repositories_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2425,7 +2415,7 @@ async def test_list_repositories_async( request_type=secure_source_manager.ListRepositoriesRequest, ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2462,7 +2452,7 @@ async def test_list_repositories_async_from_dict(): def test_list_repositories_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2494,7 +2484,7 @@ def test_list_repositories_field_headers(): @pytest.mark.asyncio async def test_list_repositories_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2527,7 +2517,7 @@ async def test_list_repositories_field_headers_async(): def test_list_repositories_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2553,7 +2543,7 @@ def test_list_repositories_flattened(): def test_list_repositories_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2568,7 +2558,7 @@ def test_list_repositories_flattened_error(): @pytest.mark.asyncio async def test_list_repositories_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2599,7 +2589,7 @@ async def test_list_repositories_flattened_async(): @pytest.mark.asyncio async def test_list_repositories_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2613,7 +2603,7 @@ async def test_list_repositories_flattened_error_async(): def test_list_repositories_pager(transport_name: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2665,7 +2655,7 @@ def test_list_repositories_pager(transport_name: str = "grpc"): def test_list_repositories_pages(transport_name: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2709,7 +2699,7 @@ def test_list_repositories_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_repositories_async_pager(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2761,7 +2751,7 @@ async def test_list_repositories_async_pager(): @pytest.mark.asyncio async def test_list_repositories_async_pages(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2818,7 +2808,7 @@ async def test_list_repositories_async_pages(): ) def test_get_repository(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2856,7 +2846,7 @@ def test_get_repository_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2874,7 +2864,7 @@ async def test_get_repository_async( request_type=secure_source_manager.GetRepositoryRequest, ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2917,7 +2907,7 @@ async def test_get_repository_async_from_dict(): def test_get_repository_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2947,7 +2937,7 @@ def test_get_repository_field_headers(): @pytest.mark.asyncio async def test_get_repository_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2978,7 +2968,7 @@ async def test_get_repository_field_headers_async(): def test_get_repository_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3002,7 +2992,7 @@ def test_get_repository_flattened(): def test_get_repository_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3017,7 +3007,7 @@ def test_get_repository_flattened_error(): @pytest.mark.asyncio async def test_get_repository_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3046,7 +3036,7 @@ async def test_get_repository_flattened_async(): @pytest.mark.asyncio async def test_get_repository_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3067,7 +3057,7 @@ async def test_get_repository_flattened_error_async(): ) def test_create_repository(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3096,7 +3086,7 @@ def test_create_repository_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3116,7 +3106,7 @@ async def test_create_repository_async( request_type=secure_source_manager.CreateRepositoryRequest, ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3150,7 +3140,7 @@ async def test_create_repository_async_from_dict(): def test_create_repository_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3182,7 +3172,7 @@ def test_create_repository_field_headers(): @pytest.mark.asyncio async def test_create_repository_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3215,7 +3205,7 @@ async def test_create_repository_field_headers_async(): def test_create_repository_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3249,7 +3239,7 @@ def test_create_repository_flattened(): def test_create_repository_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3266,7 +3256,7 @@ def test_create_repository_flattened_error(): @pytest.mark.asyncio async def test_create_repository_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3305,7 +3295,7 @@ async def test_create_repository_flattened_async(): @pytest.mark.asyncio async def test_create_repository_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3328,7 +3318,7 @@ async def test_create_repository_flattened_error_async(): ) def test_delete_repository(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3357,7 +3347,7 @@ def test_delete_repository_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3377,7 +3367,7 @@ async def test_delete_repository_async( request_type=secure_source_manager.DeleteRepositoryRequest, ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3411,7 +3401,7 @@ async def test_delete_repository_async_from_dict(): def test_delete_repository_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3443,7 +3433,7 @@ def test_delete_repository_field_headers(): @pytest.mark.asyncio async def test_delete_repository_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3476,7 +3466,7 @@ async def test_delete_repository_field_headers_async(): def test_delete_repository_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3502,7 +3492,7 @@ def test_delete_repository_flattened(): def test_delete_repository_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3517,7 +3507,7 @@ def test_delete_repository_flattened_error(): @pytest.mark.asyncio async def test_delete_repository_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3548,7 +3538,7 @@ async def test_delete_repository_flattened_async(): @pytest.mark.asyncio async def test_delete_repository_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3569,7 +3559,7 @@ async def test_delete_repository_flattened_error_async(): ) def test_get_iam_policy_repo(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3603,7 +3593,7 @@ def test_get_iam_policy_repo_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3622,7 +3612,7 @@ async def test_get_iam_policy_repo_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3661,7 +3651,7 @@ async def test_get_iam_policy_repo_async_from_dict(): def test_get_iam_policy_repo_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3693,7 +3683,7 @@ def test_get_iam_policy_repo_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_repo_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3724,7 +3714,7 @@ async def test_get_iam_policy_repo_field_headers_async(): def test_get_iam_policy_repo_from_dict_foreign(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3743,7 +3733,7 @@ def test_get_iam_policy_repo_from_dict_foreign(): def test_get_iam_policy_repo_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3769,7 +3759,7 @@ def test_get_iam_policy_repo_flattened(): def test_get_iam_policy_repo_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3784,7 +3774,7 @@ def test_get_iam_policy_repo_flattened_error(): @pytest.mark.asyncio async def test_get_iam_policy_repo_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3813,7 +3803,7 @@ async def test_get_iam_policy_repo_flattened_async(): @pytest.mark.asyncio async def test_get_iam_policy_repo_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3834,7 +3824,7 @@ async def test_get_iam_policy_repo_flattened_error_async(): ) def test_set_iam_policy_repo(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3868,7 +3858,7 @@ def test_set_iam_policy_repo_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3887,7 +3877,7 @@ async def test_set_iam_policy_repo_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3926,7 +3916,7 @@ async def test_set_iam_policy_repo_async_from_dict(): def test_set_iam_policy_repo_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3958,7 +3948,7 @@ def test_set_iam_policy_repo_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_repo_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3989,7 +3979,7 @@ async def test_set_iam_policy_repo_field_headers_async(): def test_set_iam_policy_repo_from_dict_foreign(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4009,7 +3999,7 @@ def test_set_iam_policy_repo_from_dict_foreign(): def test_set_iam_policy_repo_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4035,7 +4025,7 @@ def test_set_iam_policy_repo_flattened(): def test_set_iam_policy_repo_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4050,7 +4040,7 @@ def test_set_iam_policy_repo_flattened_error(): @pytest.mark.asyncio async def test_set_iam_policy_repo_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4079,7 +4069,7 @@ async def test_set_iam_policy_repo_flattened_async(): @pytest.mark.asyncio async def test_set_iam_policy_repo_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4100,7 +4090,7 @@ async def test_set_iam_policy_repo_flattened_error_async(): ) def test_test_iam_permissions_repo(request_type, transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4132,7 +4122,7 @@ def test_test_iam_permissions_repo_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4152,7 +4142,7 @@ async def test_test_iam_permissions_repo_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4189,7 +4179,7 @@ async def test_test_iam_permissions_repo_async_from_dict(): def test_test_iam_permissions_repo_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4221,7 +4211,7 @@ def test_test_iam_permissions_repo_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_repo_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4254,7 +4244,7 @@ async def test_test_iam_permissions_repo_field_headers_async(): def test_test_iam_permissions_repo_from_dict_foreign(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4273,7 +4263,7 @@ def test_test_iam_permissions_repo_from_dict_foreign(): def test_test_iam_permissions_repo_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4299,7 +4289,7 @@ def test_test_iam_permissions_repo_flattened(): def test_test_iam_permissions_repo_flattened_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4314,7 +4304,7 @@ def test_test_iam_permissions_repo_flattened_error(): @pytest.mark.asyncio async def test_test_iam_permissions_repo_flattened_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4345,7 +4335,7 @@ async def test_test_iam_permissions_repo_flattened_async(): @pytest.mark.asyncio async def test_test_iam_permissions_repo_flattened_error_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4366,7 +4356,7 @@ async def test_test_iam_permissions_repo_flattened_error_async(): ) def test_list_instances_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4419,7 +4409,7 @@ def test_list_instances_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_instances._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4428,7 +4418,7 @@ def test_list_instances_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_instances._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4446,7 +4436,7 @@ def test_list_instances_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4488,7 +4478,7 @@ def test_list_instances_rest_required_fields( def test_list_instances_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_instances._get_unset_required_fields({}) @@ -4508,7 +4498,7 @@ def test_list_instances_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_instances_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -4566,7 +4556,7 @@ def test_list_instances_rest_bad_request( transport: str = "rest", request_type=secure_source_manager.ListInstancesRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4588,7 +4578,7 @@ def test_list_instances_rest_bad_request( def test_list_instances_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4629,7 +4619,7 @@ def test_list_instances_rest_flattened(): def test_list_instances_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4644,7 +4634,7 @@ def test_list_instances_rest_flattened_error(transport: str = "rest"): def test_list_instances_rest_pager(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4714,7 +4704,7 @@ def test_list_instances_rest_pager(transport: str = "rest"): ) def test_get_instance_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4774,7 +4764,7 @@ def test_get_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4783,7 +4773,7 @@ def test_get_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4792,7 +4782,7 @@ def test_get_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4834,7 +4824,7 @@ def test_get_instance_rest_required_fields( def test_get_instance_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_instance._get_unset_required_fields({}) @@ -4844,7 +4834,7 @@ def test_get_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_instance_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -4902,7 +4892,7 @@ def test_get_instance_rest_bad_request( transport: str = "rest", request_type=secure_source_manager.GetInstanceRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4924,7 +4914,7 @@ def test_get_instance_rest_bad_request( def test_get_instance_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4967,7 +4957,7 @@ def test_get_instance_rest_flattened(): def test_get_instance_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4982,7 +4972,7 @@ def test_get_instance_rest_flattened_error(transport: str = "rest"): def test_get_instance_rest_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4995,7 +4985,7 @@ def test_get_instance_rest_error(): ) def test_create_instance_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5125,7 +5115,7 @@ def test_create_instance_rest_required_fields( assert "instanceId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5137,7 +5127,7 @@ def test_create_instance_rest_required_fields( jsonified_request["instanceId"] = "instance_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_instance._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5155,7 +5145,7 @@ def test_create_instance_rest_required_fields( assert jsonified_request["instanceId"] == "instance_id_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5201,7 +5191,7 @@ def test_create_instance_rest_required_fields( def test_create_instance_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_instance._get_unset_required_fields({}) @@ -5225,7 +5215,7 @@ def test_create_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_instance_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -5285,7 +5275,7 @@ def test_create_instance_rest_bad_request( transport: str = "rest", request_type=secure_source_manager.CreateInstanceRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5307,7 +5297,7 @@ def test_create_instance_rest_bad_request( def test_create_instance_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5348,7 +5338,7 @@ def test_create_instance_rest_flattened(): def test_create_instance_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5365,7 +5355,7 @@ def test_create_instance_rest_flattened_error(transport: str = "rest"): def test_create_instance_rest_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5378,7 +5368,7 @@ def test_create_instance_rest_error(): ) def test_delete_instance_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5424,7 +5414,7 @@ def test_delete_instance_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_instance._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5433,7 +5423,7 @@ def test_delete_instance_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_instance._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("request_id",)) @@ -5444,7 +5434,7 @@ def test_delete_instance_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5483,7 +5473,7 @@ def test_delete_instance_rest_required_fields( def test_delete_instance_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_instance._get_unset_required_fields({}) @@ -5493,7 +5483,7 @@ def test_delete_instance_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_instance_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -5553,7 +5543,7 @@ def test_delete_instance_rest_bad_request( transport: str = "rest", request_type=secure_source_manager.DeleteInstanceRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5575,7 +5565,7 @@ def test_delete_instance_rest_bad_request( def test_delete_instance_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5616,7 +5606,7 @@ def test_delete_instance_rest_flattened(): def test_delete_instance_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5631,7 +5621,7 @@ def test_delete_instance_rest_flattened_error(transport: str = "rest"): def test_delete_instance_rest_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5644,7 +5634,7 @@ def test_delete_instance_rest_error(): ) def test_list_repositories_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5695,7 +5685,7 @@ def test_list_repositories_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_repositories._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5704,7 +5694,7 @@ def test_list_repositories_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_repositories._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5721,7 +5711,7 @@ def test_list_repositories_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5765,7 +5755,7 @@ def test_list_repositories_rest_required_fields( def test_list_repositories_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_repositories._get_unset_required_fields({}) @@ -5784,7 +5774,7 @@ def test_list_repositories_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_repositories_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -5844,7 +5834,7 @@ def test_list_repositories_rest_bad_request( transport: str = "rest", request_type=secure_source_manager.ListRepositoriesRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5866,7 +5856,7 @@ def test_list_repositories_rest_bad_request( def test_list_repositories_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5908,7 +5898,7 @@ def test_list_repositories_rest_flattened(): def test_list_repositories_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5923,7 +5913,7 @@ def test_list_repositories_rest_flattened_error(transport: str = "rest"): def test_list_repositories_rest_pager(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5993,7 +5983,7 @@ def test_list_repositories_rest_pager(transport: str = "rest"): ) def test_get_repository_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6052,7 +6042,7 @@ def test_get_repository_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_repository._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6061,7 +6051,7 @@ def test_get_repository_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_repository._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6070,7 +6060,7 @@ def test_get_repository_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6112,7 +6102,7 @@ def test_get_repository_rest_required_fields( def test_get_repository_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_repository._get_unset_required_fields({}) @@ -6122,7 +6112,7 @@ def test_get_repository_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_repository_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -6180,7 +6170,7 @@ def test_get_repository_rest_bad_request( transport: str = "rest", request_type=secure_source_manager.GetRepositoryRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6202,7 +6192,7 @@ def test_get_repository_rest_bad_request( def test_get_repository_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6246,7 +6236,7 @@ def test_get_repository_rest_flattened(): def test_get_repository_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6261,7 +6251,7 @@ def test_get_repository_rest_flattened_error(transport: str = "rest"): def test_get_repository_rest_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6274,7 +6264,7 @@ def test_get_repository_rest_error(): ) def test_create_repository_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6409,7 +6399,7 @@ def test_create_repository_rest_required_fields( assert "repositoryId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_repository._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6421,7 +6411,7 @@ def test_create_repository_rest_required_fields( jsonified_request["repositoryId"] = "repository_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_repository._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("repository_id",)) @@ -6434,7 +6424,7 @@ def test_create_repository_rest_required_fields( assert jsonified_request["repositoryId"] == "repository_id_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6480,7 +6470,7 @@ def test_create_repository_rest_required_fields( def test_create_repository_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_repository._get_unset_required_fields({}) @@ -6499,7 +6489,7 @@ def test_create_repository_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_repository_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -6559,7 +6549,7 @@ def test_create_repository_rest_bad_request( transport: str = "rest", request_type=secure_source_manager.CreateRepositoryRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6581,7 +6571,7 @@ def test_create_repository_rest_bad_request( def test_create_repository_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6623,7 +6613,7 @@ def test_create_repository_rest_flattened(): def test_create_repository_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6640,7 +6630,7 @@ def test_create_repository_rest_flattened_error(transport: str = "rest"): def test_create_repository_rest_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6653,7 +6643,7 @@ def test_create_repository_rest_error(): ) def test_delete_repository_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6699,7 +6689,7 @@ def test_delete_repository_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_repository._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6708,7 +6698,7 @@ def test_delete_repository_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_repository._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("allow_missing",)) @@ -6719,7 +6709,7 @@ def test_delete_repository_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6758,7 +6748,7 @@ def test_delete_repository_rest_required_fields( def test_delete_repository_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_repository._get_unset_required_fields({}) @@ -6768,7 +6758,7 @@ def test_delete_repository_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_repository_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -6828,7 +6818,7 @@ def test_delete_repository_rest_bad_request( transport: str = "rest", request_type=secure_source_manager.DeleteRepositoryRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6850,7 +6840,7 @@ def test_delete_repository_rest_bad_request( def test_delete_repository_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6892,7 +6882,7 @@ def test_delete_repository_rest_flattened(): def test_delete_repository_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6907,7 +6897,7 @@ def test_delete_repository_rest_flattened_error(transport: str = "rest"): def test_delete_repository_rest_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6920,7 +6910,7 @@ def test_delete_repository_rest_error(): ) def test_get_iam_policy_repo_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6973,7 +6963,7 @@ def test_get_iam_policy_repo_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy_repo._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6982,7 +6972,7 @@ def test_get_iam_policy_repo_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy_repo._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("options",)) @@ -6993,7 +6983,7 @@ def test_get_iam_policy_repo_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7033,7 +7023,7 @@ def test_get_iam_policy_repo_rest_required_fields( def test_get_iam_policy_repo_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy_repo._get_unset_required_fields({}) @@ -7043,7 +7033,7 @@ def test_get_iam_policy_repo_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_repo_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -7097,7 +7087,7 @@ def test_get_iam_policy_repo_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7121,7 +7111,7 @@ def test_get_iam_policy_repo_rest_bad_request( def test_get_iam_policy_repo_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7163,7 +7153,7 @@ def test_get_iam_policy_repo_rest_flattened(): def test_get_iam_policy_repo_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7178,7 +7168,7 @@ def test_get_iam_policy_repo_rest_flattened_error(transport: str = "rest"): def test_get_iam_policy_repo_rest_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7191,7 +7181,7 @@ def test_get_iam_policy_repo_rest_error(): ) def test_set_iam_policy_repo_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7244,7 +7234,7 @@ def test_set_iam_policy_repo_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy_repo._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7253,7 +7243,7 @@ def test_set_iam_policy_repo_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy_repo._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7262,7 +7252,7 @@ def test_set_iam_policy_repo_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7303,7 +7293,7 @@ def test_set_iam_policy_repo_rest_required_fields( def test_set_iam_policy_repo_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy_repo._get_unset_required_fields({}) @@ -7321,7 +7311,7 @@ def test_set_iam_policy_repo_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_repo_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -7375,7 +7365,7 @@ def test_set_iam_policy_repo_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7399,7 +7389,7 @@ def test_set_iam_policy_repo_rest_bad_request( def test_set_iam_policy_repo_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7441,7 +7431,7 @@ def test_set_iam_policy_repo_rest_flattened(): def test_set_iam_policy_repo_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7456,7 +7446,7 @@ def test_set_iam_policy_repo_rest_flattened_error(transport: str = "rest"): def test_set_iam_policy_repo_rest_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7469,7 +7459,7 @@ def test_set_iam_policy_repo_rest_error(): ) def test_test_iam_permissions_repo_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7521,7 +7511,7 @@ def test_test_iam_permissions_repo_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions_repo._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7531,7 +7521,7 @@ def test_test_iam_permissions_repo_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions_repo._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7542,7 +7532,7 @@ def test_test_iam_permissions_repo_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7583,7 +7573,7 @@ def test_test_iam_permissions_repo_rest_required_fields( def test_test_iam_permissions_repo_rest_unset_required_fields(): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions_repo._get_unset_required_fields({}) @@ -7601,7 +7591,7 @@ def test_test_iam_permissions_repo_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_repo_rest_interceptors(null_interceptor): transport = transports.SecureSourceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecureSourceManagerRestInterceptor(), @@ -7657,7 +7647,7 @@ def test_test_iam_permissions_repo_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7681,7 +7671,7 @@ def test_test_iam_permissions_repo_rest_bad_request( def test_test_iam_permissions_repo_rest_flattened(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7723,7 +7713,7 @@ def test_test_iam_permissions_repo_rest_flattened(): def test_test_iam_permissions_repo_rest_flattened_error(transport: str = "rest"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7738,24 +7728,24 @@ def test_test_iam_permissions_repo_rest_flattened_error(transport: str = "rest") def test_test_iam_permissions_repo_rest_error(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SecureSourceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SecureSourceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecureSourceManagerClient( @@ -7765,7 +7755,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SecureSourceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7780,13 +7770,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SecureSourceManagerClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SecureSourceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecureSourceManagerClient( @@ -7798,7 +7787,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SecureSourceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SecureSourceManagerClient(transport=transport) assert client.transport is transport @@ -7807,13 +7796,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SecureSourceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SecureSourceManagerGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7830,7 +7819,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7844,7 +7833,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SecureSourceManagerClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7852,7 +7841,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7864,7 +7853,7 @@ def test_secure_source_manager_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SecureSourceManagerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7876,7 +7865,7 @@ def test_secure_source_manager_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SecureSourceManagerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7932,7 +7921,7 @@ def test_secure_source_manager_base_transport_with_credentials_file(): "google.cloud.securesourcemanager_v1.services.secure_source_manager.transports.SecureSourceManagerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecureSourceManagerTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7951,7 +7940,7 @@ def test_secure_source_manager_base_transport_with_adc(): "google.cloud.securesourcemanager_v1.services.secure_source_manager.transports.SecureSourceManagerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecureSourceManagerTransport() adc.assert_called_once() @@ -7959,7 +7948,7 @@ def test_secure_source_manager_base_transport_with_adc(): def test_secure_source_manager_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SecureSourceManagerClient() adc.assert_called_once_with( scopes=None, @@ -7979,7 +7968,7 @@ def test_secure_source_manager_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -8026,7 +8015,7 @@ def test_secure_source_manager_transport_create_channel(transport_class, grpc_he ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -8056,7 +8045,7 @@ def test_secure_source_manager_transport_create_channel(transport_class, grpc_he def test_secure_source_manager_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -8094,7 +8083,7 @@ def test_secure_source_manager_grpc_transport_client_cert_source_for_mtls( def test_secure_source_manager_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -8106,7 +8095,7 @@ def test_secure_source_manager_http_transport_client_cert_source_for_mtls(): def test_secure_source_manager_rest_lro_client(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -8131,7 +8120,7 @@ def test_secure_source_manager_rest_lro_client(): ) def test_secure_source_manager_host_no_port(transport_name): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securesourcemanager.googleapis.com" ), @@ -8154,7 +8143,7 @@ def test_secure_source_manager_host_no_port(transport_name): ) def test_secure_source_manager_host_with_port(transport_name): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securesourcemanager.googleapis.com:8000" ), @@ -8174,8 +8163,8 @@ def test_secure_source_manager_host_with_port(transport_name): ], ) def test_secure_source_manager_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SecureSourceManagerClient( credentials=creds1, transport=transport_name, @@ -8269,7 +8258,7 @@ def test_secure_source_manager_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -8347,7 +8336,7 @@ def test_secure_source_manager_transport_channel_mtls_with_adc(transport_class): def test_secure_source_manager_grpc_lro_client(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -8364,7 +8353,7 @@ def test_secure_source_manager_grpc_lro_client(): def test_secure_source_manager_grpc_lro_async_client(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -8574,7 +8563,7 @@ def test_client_with_default_client_info(): transports.SecureSourceManagerTransport, "_prep_wrapped_messages" ) as prep: client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8584,7 +8573,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecureSourceManagerClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8593,7 +8582,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -8608,7 +8597,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8638,7 +8627,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -8666,7 +8655,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8694,7 +8683,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -8722,7 +8711,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8752,7 +8741,7 @@ def test_get_iam_policy_rest_bad_request( ) def test_get_iam_policy_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"resource": "projects/sample1/locations/sample2/instances/sample3"} @@ -8780,7 +8769,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8810,7 +8799,7 @@ def test_set_iam_policy_rest_bad_request( ) def test_set_iam_policy_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"resource": "projects/sample1/locations/sample2/instances/sample3"} @@ -8838,7 +8827,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8868,7 +8857,7 @@ def test_test_iam_permissions_rest_bad_request( ) def test_test_iam_permissions_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"resource": "projects/sample1/locations/sample2/instances/sample3"} @@ -8896,7 +8885,7 @@ def test_cancel_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.CancelOperationRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8926,7 +8915,7 @@ def test_cancel_operation_rest_bad_request( ) def test_cancel_operation_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -8954,7 +8943,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8984,7 +8973,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -9012,7 +9001,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9042,7 +9031,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -9070,7 +9059,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9100,7 +9089,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -9126,7 +9115,7 @@ def test_list_operations_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9151,7 +9140,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9175,7 +9164,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9204,7 +9193,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9231,7 +9220,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -9249,7 +9238,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -9265,7 +9254,7 @@ async def test_delete_operation_from_dict_async(): def test_cancel_operation(transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9290,7 +9279,7 @@ def test_cancel_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_cancel_operation_async(transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9314,7 +9303,7 @@ async def test_cancel_operation_async(transport: str = "grpc_asyncio"): def test_cancel_operation_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9343,7 +9332,7 @@ def test_cancel_operation_field_headers(): @pytest.mark.asyncio async def test_cancel_operation_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9370,7 +9359,7 @@ async def test_cancel_operation_field_headers_async(): def test_cancel_operation_from_dict(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -9388,7 +9377,7 @@ def test_cancel_operation_from_dict(): @pytest.mark.asyncio async def test_cancel_operation_from_dict_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -9404,7 +9393,7 @@ async def test_cancel_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9429,7 +9418,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9455,7 +9444,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9484,7 +9473,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9513,7 +9502,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -9531,7 +9520,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -9549,7 +9538,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9574,7 +9563,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9600,7 +9589,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9629,7 +9618,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9658,7 +9647,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -9676,7 +9665,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -9694,7 +9683,7 @@ async def test_list_operations_from_dict_async(): def test_list_locations(transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9719,7 +9708,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9745,7 +9734,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9774,7 +9763,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9803,7 +9792,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -9821,7 +9810,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -9839,7 +9828,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9864,7 +9853,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9890,7 +9879,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9919,7 +9908,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9948,7 +9937,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -9966,7 +9955,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -9984,7 +9973,7 @@ async def test_get_location_from_dict_async(): def test_set_iam_policy(transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10017,7 +10006,7 @@ def test_set_iam_policy(transport: str = "grpc"): @pytest.mark.asyncio async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10052,7 +10041,7 @@ async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): def test_set_iam_policy_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10082,7 +10071,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10111,7 +10100,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -10130,7 +10119,7 @@ def test_set_iam_policy_from_dict(): @pytest.mark.asyncio async def test_set_iam_policy_from_dict_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -10148,7 +10137,7 @@ async def test_set_iam_policy_from_dict_async(): def test_get_iam_policy(transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10183,7 +10172,7 @@ def test_get_iam_policy(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10219,7 +10208,7 @@ async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): def test_get_iam_policy_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10249,7 +10238,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10278,7 +10267,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -10297,7 +10286,7 @@ def test_get_iam_policy_from_dict(): @pytest.mark.asyncio async def test_get_iam_policy_from_dict_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -10315,7 +10304,7 @@ async def test_get_iam_policy_from_dict_async(): def test_test_iam_permissions(transport: str = "grpc"): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10349,7 +10338,7 @@ def test_test_iam_permissions(transport: str = "grpc"): @pytest.mark.asyncio async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10384,7 +10373,7 @@ async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): def test_test_iam_permissions_field_headers(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10416,7 +10405,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10449,7 +10438,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10470,7 +10459,7 @@ def test_test_iam_permissions_from_dict(): @pytest.mark.asyncio async def test_test_iam_permissions_from_dict_async(): client = SecureSourceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10498,7 +10487,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -10515,7 +10504,7 @@ def test_client_ctx(): ] for transport in transports: client = SecureSourceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-securitycenter/google/cloud/securitycenter/gapic_version.py b/packages/google-cloud-securitycenter/google/cloud/securitycenter/gapic_version.py index 66c308d0ae53..360a0d13ebdd 100644 --- a/packages/google-cloud-securitycenter/google/cloud/securitycenter/gapic_version.py +++ b/packages/google-cloud-securitycenter/google/cloud/securitycenter/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.26.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/gapic_version.py b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/gapic_version.py index 66c308d0ae53..360a0d13ebdd 100644 --- a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/gapic_version.py +++ b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.26.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/services/security_center/client.py b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/services/security_center/client.py index a7bfb7bc6440..3be3d4d7278c 100644 --- a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/services/security_center/client.py +++ b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/services/security_center/client.py @@ -694,6 +694,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -712,6 +713,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -786,17 +788,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SecurityCenterClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SecurityCenterClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1beta1/gapic_version.py b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1beta1/gapic_version.py index 66c308d0ae53..360a0d13ebdd 100644 --- a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1beta1/gapic_version.py +++ b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.26.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1beta1/services/security_center/client.py b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1beta1/services/security_center/client.py index bfd3b3dfbe1c..803a6aeb7dbb 100644 --- a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1beta1/services/security_center/client.py +++ b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1beta1/services/security_center/client.py @@ -478,6 +478,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -496,6 +497,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -570,17 +572,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SecurityCenterClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SecurityCenterClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1p1beta1/gapic_version.py b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1p1beta1/gapic_version.py index 66c308d0ae53..360a0d13ebdd 100644 --- a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1p1beta1/gapic_version.py +++ b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1p1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.26.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1p1beta1/services/security_center/client.py b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1p1beta1/services/security_center/client.py index 8897a28c0e49..5be417cac65b 100644 --- a/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1p1beta1/services/security_center/client.py +++ b/packages/google-cloud-securitycenter/google/cloud/securitycenter_v1p1beta1/services/security_center/client.py @@ -521,6 +521,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -539,6 +540,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -613,17 +615,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SecurityCenterClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SecurityCenterClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1.json b/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1.json index 8e22ccbc5115..278ec40bb216 100644 --- a/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1.json +++ b/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-securitycenter", - "version": "1.26.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1beta1.json b/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1beta1.json index bc3c1f220258..a4c1295eaf99 100644 --- a/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1beta1.json +++ b/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-securitycenter", - "version": "1.26.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1p1beta1.json b/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1p1beta1.json index dea78d7fb9aa..774592ce11f7 100644 --- a/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1p1beta1.json +++ b/packages/google-cloud-securitycenter/samples/generated_samples/snippet_metadata_google.cloud.securitycenter.v1p1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-securitycenter", - "version": "1.26.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-securitycenter/setup.py b/packages/google-cloud-securitycenter/setup.py index e61ab0587733..7a6cf6f184dd 100644 --- a/packages/google-cloud-securitycenter/setup.py +++ b/packages/google-cloud-securitycenter/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", diff --git a/packages/google-cloud-securitycenter/testing/constraints-3.7.txt b/packages/google-cloud-securitycenter/testing/constraints-3.7.txt index 44ffd04543a8..712d45b4c5ea 100644 --- a/packages/google-cloud-securitycenter/testing/constraints-3.7.txt +++ b/packages/google-cloud-securitycenter/testing/constraints-3.7.txt @@ -5,6 +5,7 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 grpc-google-iam-v1==0.12.4 diff --git a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1/test_security_center.py b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1/test_security_center.py index 41c25f0382f4..290053d0ec81 100644 --- a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1/test_security_center.py +++ b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1/test_security_center.py @@ -146,18 +146,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -384,7 +372,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -411,42 +399,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -457,7 +452,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_security_center_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -509,7 +504,7 @@ def test_security_center_client_service_account_always_use_jwt( ], ) def test_security_center_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -572,9 +567,7 @@ def test_security_center_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(SecurityCenterClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -973,20 +966,20 @@ def test_security_center_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -998,13 +991,11 @@ def test_security_center_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1020,8 +1011,7 @@ def test_security_center_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1174,8 +1164,8 @@ def test_security_center_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1204,7 +1194,7 @@ def test_security_center_client_create_channel_credentials_file( ) def test_bulk_mute_findings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1233,7 +1223,7 @@ def test_bulk_mute_findings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1253,7 +1243,7 @@ async def test_bulk_mute_findings_async( request_type=securitycenter_service.BulkMuteFindingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1287,7 +1277,7 @@ async def test_bulk_mute_findings_async_from_dict(): def test_bulk_mute_findings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1319,7 +1309,7 @@ def test_bulk_mute_findings_field_headers(): @pytest.mark.asyncio async def test_bulk_mute_findings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1352,7 +1342,7 @@ async def test_bulk_mute_findings_field_headers_async(): def test_bulk_mute_findings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1378,7 +1368,7 @@ def test_bulk_mute_findings_flattened(): def test_bulk_mute_findings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1393,7 +1383,7 @@ def test_bulk_mute_findings_flattened_error(): @pytest.mark.asyncio async def test_bulk_mute_findings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1424,7 +1414,7 @@ async def test_bulk_mute_findings_flattened_async(): @pytest.mark.asyncio async def test_bulk_mute_findings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1447,7 +1437,7 @@ def test_create_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1497,7 +1487,7 @@ def test_create_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1521,7 +1511,7 @@ async def test_create_security_health_analytics_custom_module_async( request_type=securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1576,7 +1566,7 @@ async def test_create_security_health_analytics_custom_module_async_from_dict(): def test_create_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1611,7 +1601,7 @@ def test_create_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_create_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1645,7 +1635,7 @@ async def test_create_security_health_analytics_custom_module_field_headers_asyn def test_create_security_health_analytics_custom_module_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1682,7 +1672,7 @@ def test_create_security_health_analytics_custom_module_flattened(): def test_create_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1700,7 +1690,7 @@ def test_create_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_create_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1742,7 +1732,7 @@ async def test_create_security_health_analytics_custom_module_flattened_async(): @pytest.mark.asyncio async def test_create_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1766,7 +1756,7 @@ async def test_create_security_health_analytics_custom_module_flattened_error_as ) def test_create_source(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1802,7 +1792,7 @@ def test_create_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1820,7 +1810,7 @@ async def test_create_source_async( request_type=securitycenter_service.CreateSourceRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1861,7 +1851,7 @@ async def test_create_source_async_from_dict(): def test_create_source_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1891,7 +1881,7 @@ def test_create_source_field_headers(): @pytest.mark.asyncio async def test_create_source_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1920,7 +1910,7 @@ async def test_create_source_field_headers_async(): def test_create_source_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1948,7 +1938,7 @@ def test_create_source_flattened(): def test_create_source_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1964,7 +1954,7 @@ def test_create_source_flattened_error(): @pytest.mark.asyncio async def test_create_source_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1995,7 +1985,7 @@ async def test_create_source_flattened_async(): @pytest.mark.asyncio async def test_create_source_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2017,7 +2007,7 @@ async def test_create_source_flattened_error_async(): ) def test_create_finding(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2075,7 +2065,7 @@ def test_create_finding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2093,7 +2083,7 @@ async def test_create_finding_async( request_type=securitycenter_service.CreateFindingRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2156,7 +2146,7 @@ async def test_create_finding_async_from_dict(): def test_create_finding_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2186,7 +2176,7 @@ def test_create_finding_field_headers(): @pytest.mark.asyncio async def test_create_finding_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2215,7 +2205,7 @@ async def test_create_finding_field_headers_async(): def test_create_finding_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2247,7 +2237,7 @@ def test_create_finding_flattened(): def test_create_finding_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2264,7 +2254,7 @@ def test_create_finding_flattened_error(): @pytest.mark.asyncio async def test_create_finding_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2299,7 +2289,7 @@ async def test_create_finding_flattened_async(): @pytest.mark.asyncio async def test_create_finding_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2322,7 +2312,7 @@ async def test_create_finding_flattened_error_async(): ) def test_create_mute_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2362,7 +2352,7 @@ def test_create_mute_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2382,7 +2372,7 @@ async def test_create_mute_config_async( request_type=securitycenter_service.CreateMuteConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2427,7 +2417,7 @@ async def test_create_mute_config_async_from_dict(): def test_create_mute_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2459,7 +2449,7 @@ def test_create_mute_config_field_headers(): @pytest.mark.asyncio async def test_create_mute_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2492,7 +2482,7 @@ async def test_create_mute_config_field_headers_async(): def test_create_mute_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2526,7 +2516,7 @@ def test_create_mute_config_flattened(): def test_create_mute_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2543,7 +2533,7 @@ def test_create_mute_config_flattened_error(): @pytest.mark.asyncio async def test_create_mute_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2582,7 +2572,7 @@ async def test_create_mute_config_flattened_async(): @pytest.mark.asyncio async def test_create_mute_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2605,7 +2595,7 @@ async def test_create_mute_config_flattened_error_async(): ) def test_create_notification_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2643,7 +2633,7 @@ def test_create_notification_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2663,7 +2653,7 @@ async def test_create_notification_config_async( request_type=securitycenter_service.CreateNotificationConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2706,7 +2696,7 @@ async def test_create_notification_config_async_from_dict(): def test_create_notification_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2738,7 +2728,7 @@ def test_create_notification_config_field_headers(): @pytest.mark.asyncio async def test_create_notification_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2771,7 +2761,7 @@ async def test_create_notification_config_field_headers_async(): def test_create_notification_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2807,7 +2797,7 @@ def test_create_notification_config_flattened(): def test_create_notification_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2826,7 +2816,7 @@ def test_create_notification_config_flattened_error(): @pytest.mark.asyncio async def test_create_notification_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2867,7 +2857,7 @@ async def test_create_notification_config_flattened_async(): @pytest.mark.asyncio async def test_create_notification_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2892,7 +2882,7 @@ async def test_create_notification_config_flattened_error_async(): ) def test_delete_mute_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2921,7 +2911,7 @@ def test_delete_mute_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2941,7 +2931,7 @@ async def test_delete_mute_config_async( request_type=securitycenter_service.DeleteMuteConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2973,7 +2963,7 @@ async def test_delete_mute_config_async_from_dict(): def test_delete_mute_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3005,7 +2995,7 @@ def test_delete_mute_config_field_headers(): @pytest.mark.asyncio async def test_delete_mute_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3036,7 +3026,7 @@ async def test_delete_mute_config_field_headers_async(): def test_delete_mute_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3062,7 +3052,7 @@ def test_delete_mute_config_flattened(): def test_delete_mute_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3077,7 +3067,7 @@ def test_delete_mute_config_flattened_error(): @pytest.mark.asyncio async def test_delete_mute_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3106,7 +3096,7 @@ async def test_delete_mute_config_flattened_async(): @pytest.mark.asyncio async def test_delete_mute_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3127,7 +3117,7 @@ async def test_delete_mute_config_flattened_error_async(): ) def test_delete_notification_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3156,7 +3146,7 @@ def test_delete_notification_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3176,7 +3166,7 @@ async def test_delete_notification_config_async( request_type=securitycenter_service.DeleteNotificationConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3208,7 +3198,7 @@ async def test_delete_notification_config_async_from_dict(): def test_delete_notification_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3240,7 +3230,7 @@ def test_delete_notification_config_field_headers(): @pytest.mark.asyncio async def test_delete_notification_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3271,7 +3261,7 @@ async def test_delete_notification_config_field_headers_async(): def test_delete_notification_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3297,7 +3287,7 @@ def test_delete_notification_config_flattened(): def test_delete_notification_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3312,7 +3302,7 @@ def test_delete_notification_config_flattened_error(): @pytest.mark.asyncio async def test_delete_notification_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3341,7 +3331,7 @@ async def test_delete_notification_config_flattened_async(): @pytest.mark.asyncio async def test_delete_notification_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3364,7 +3354,7 @@ def test_delete_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3397,7 +3387,7 @@ def test_delete_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3421,7 +3411,7 @@ async def test_delete_security_health_analytics_custom_module_async( request_type=securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3457,7 +3447,7 @@ async def test_delete_security_health_analytics_custom_module_async_from_dict(): def test_delete_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3490,7 +3480,7 @@ def test_delete_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_delete_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3522,7 +3512,7 @@ async def test_delete_security_health_analytics_custom_module_field_headers_asyn def test_delete_security_health_analytics_custom_module_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3549,7 +3539,7 @@ def test_delete_security_health_analytics_custom_module_flattened(): def test_delete_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3564,7 +3554,7 @@ def test_delete_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_delete_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3594,7 +3584,7 @@ async def test_delete_security_health_analytics_custom_module_flattened_async(): @pytest.mark.asyncio async def test_delete_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3615,7 +3605,7 @@ async def test_delete_security_health_analytics_custom_module_flattened_error_as ) def test_get_big_query_export(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3657,7 +3647,7 @@ def test_get_big_query_export_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3677,7 +3667,7 @@ async def test_get_big_query_export_async( request_type=securitycenter_service.GetBigQueryExportRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3724,7 +3714,7 @@ async def test_get_big_query_export_async_from_dict(): def test_get_big_query_export_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3756,7 +3746,7 @@ def test_get_big_query_export_field_headers(): @pytest.mark.asyncio async def test_get_big_query_export_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3789,7 +3779,7 @@ async def test_get_big_query_export_field_headers_async(): def test_get_big_query_export_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3815,7 +3805,7 @@ def test_get_big_query_export_flattened(): def test_get_big_query_export_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3830,7 +3820,7 @@ def test_get_big_query_export_flattened_error(): @pytest.mark.asyncio async def test_get_big_query_export_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3861,7 +3851,7 @@ async def test_get_big_query_export_flattened_async(): @pytest.mark.asyncio async def test_get_big_query_export_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3882,7 +3872,7 @@ async def test_get_big_query_export_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3914,7 +3904,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3931,7 +3921,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3968,7 +3958,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3998,7 +3988,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4027,7 +4017,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -4044,7 +4034,7 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4068,7 +4058,7 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4083,7 +4073,7 @@ def test_get_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4110,7 +4100,7 @@ async def test_get_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4131,7 +4121,7 @@ async def test_get_iam_policy_flattened_error_async(): ) def test_get_mute_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4169,7 +4159,7 @@ def test_get_mute_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4187,7 +4177,7 @@ async def test_get_mute_config_async( request_type=securitycenter_service.GetMuteConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4230,7 +4220,7 @@ async def test_get_mute_config_async_from_dict(): def test_get_mute_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4260,7 +4250,7 @@ def test_get_mute_config_field_headers(): @pytest.mark.asyncio async def test_get_mute_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4291,7 +4281,7 @@ async def test_get_mute_config_field_headers_async(): def test_get_mute_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4315,7 +4305,7 @@ def test_get_mute_config_flattened(): def test_get_mute_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4330,7 +4320,7 @@ def test_get_mute_config_flattened_error(): @pytest.mark.asyncio async def test_get_mute_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4359,7 +4349,7 @@ async def test_get_mute_config_flattened_async(): @pytest.mark.asyncio async def test_get_mute_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4380,7 +4370,7 @@ async def test_get_mute_config_flattened_error_async(): ) def test_get_notification_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4418,7 +4408,7 @@ def test_get_notification_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4438,7 +4428,7 @@ async def test_get_notification_config_async( request_type=securitycenter_service.GetNotificationConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4481,7 +4471,7 @@ async def test_get_notification_config_async_from_dict(): def test_get_notification_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4513,7 +4503,7 @@ def test_get_notification_config_field_headers(): @pytest.mark.asyncio async def test_get_notification_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4546,7 +4536,7 @@ async def test_get_notification_config_field_headers_async(): def test_get_notification_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4572,7 +4562,7 @@ def test_get_notification_config_flattened(): def test_get_notification_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4587,7 +4577,7 @@ def test_get_notification_config_flattened_error(): @pytest.mark.asyncio async def test_get_notification_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4618,7 +4608,7 @@ async def test_get_notification_config_flattened_async(): @pytest.mark.asyncio async def test_get_notification_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4639,7 +4629,7 @@ async def test_get_notification_config_flattened_error_async(): ) def test_get_organization_settings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4673,7 +4663,7 @@ def test_get_organization_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4693,7 +4683,7 @@ async def test_get_organization_settings_async( request_type=securitycenter_service.GetOrganizationSettingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4732,7 +4722,7 @@ async def test_get_organization_settings_async_from_dict(): def test_get_organization_settings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4764,7 +4754,7 @@ def test_get_organization_settings_field_headers(): @pytest.mark.asyncio async def test_get_organization_settings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4797,7 +4787,7 @@ async def test_get_organization_settings_field_headers_async(): def test_get_organization_settings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4823,7 +4813,7 @@ def test_get_organization_settings_flattened(): def test_get_organization_settings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4838,7 +4828,7 @@ def test_get_organization_settings_flattened_error(): @pytest.mark.asyncio async def test_get_organization_settings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4869,7 +4859,7 @@ async def test_get_organization_settings_flattened_async(): @pytest.mark.asyncio async def test_get_organization_settings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4892,7 +4882,7 @@ def test_get_effective_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4938,7 +4928,7 @@ def test_get_effective_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4962,7 +4952,7 @@ async def test_get_effective_security_health_analytics_custom_module_async( request_type=securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5017,7 +5007,7 @@ async def test_get_effective_security_health_analytics_custom_module_async_from_ def test_get_effective_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5054,7 +5044,7 @@ def test_get_effective_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_get_effective_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5090,7 +5080,7 @@ async def test_get_effective_security_health_analytics_custom_module_field_heade def test_get_effective_security_health_analytics_custom_module_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5119,7 +5109,7 @@ def test_get_effective_security_health_analytics_custom_module_flattened(): def test_get_effective_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5134,7 +5124,7 @@ def test_get_effective_security_health_analytics_custom_module_flattened_error() @pytest.mark.asyncio async def test_get_effective_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5168,7 +5158,7 @@ async def test_get_effective_security_health_analytics_custom_module_flattened_a @pytest.mark.asyncio async def test_get_effective_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5191,7 +5181,7 @@ def test_get_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5240,7 +5230,7 @@ def test_get_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5263,7 +5253,7 @@ async def test_get_security_health_analytics_custom_module_async( request_type=securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5317,7 +5307,7 @@ async def test_get_security_health_analytics_custom_module_async_from_dict(): def test_get_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5351,7 +5341,7 @@ def test_get_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_get_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5384,7 +5374,7 @@ async def test_get_security_health_analytics_custom_module_field_headers_async() def test_get_security_health_analytics_custom_module_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5412,7 +5402,7 @@ def test_get_security_health_analytics_custom_module_flattened(): def test_get_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5427,7 +5417,7 @@ def test_get_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_get_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5460,7 +5450,7 @@ async def test_get_security_health_analytics_custom_module_flattened_async(): @pytest.mark.asyncio async def test_get_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5481,7 +5471,7 @@ async def test_get_security_health_analytics_custom_module_flattened_error_async ) def test_get_source(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5517,7 +5507,7 @@ def test_get_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5535,7 +5525,7 @@ async def test_get_source_async( request_type=securitycenter_service.GetSourceRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5576,7 +5566,7 @@ async def test_get_source_async_from_dict(): def test_get_source_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5606,7 +5596,7 @@ def test_get_source_field_headers(): @pytest.mark.asyncio async def test_get_source_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5635,7 +5625,7 @@ async def test_get_source_field_headers_async(): def test_get_source_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5659,7 +5649,7 @@ def test_get_source_flattened(): def test_get_source_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5674,7 +5664,7 @@ def test_get_source_flattened_error(): @pytest.mark.asyncio async def test_get_source_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5701,7 +5691,7 @@ async def test_get_source_flattened_async(): @pytest.mark.asyncio async def test_get_source_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5722,7 +5712,7 @@ async def test_get_source_flattened_error_async(): ) def test_group_assets(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5754,7 +5744,7 @@ def test_group_assets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5772,7 +5762,7 @@ async def test_group_assets_async( request_type=securitycenter_service.GroupAssetsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5809,7 +5799,7 @@ async def test_group_assets_async_from_dict(): def test_group_assets_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5839,7 +5829,7 @@ def test_group_assets_field_headers(): @pytest.mark.asyncio async def test_group_assets_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5870,7 +5860,7 @@ async def test_group_assets_field_headers_async(): def test_group_assets_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -5920,7 +5910,7 @@ def test_group_assets_pager(transport_name: str = "grpc"): def test_group_assets_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -5962,7 +5952,7 @@ def test_group_assets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_group_assets_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6012,7 +6002,7 @@ async def test_group_assets_async_pager(): @pytest.mark.asyncio async def test_group_assets_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6067,7 +6057,7 @@ async def test_group_assets_async_pages(): ) def test_group_findings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6099,7 +6089,7 @@ def test_group_findings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6117,7 +6107,7 @@ async def test_group_findings_async( request_type=securitycenter_service.GroupFindingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6154,7 +6144,7 @@ async def test_group_findings_async_from_dict(): def test_group_findings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6184,7 +6174,7 @@ def test_group_findings_field_headers(): @pytest.mark.asyncio async def test_group_findings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6215,7 +6205,7 @@ async def test_group_findings_field_headers_async(): def test_group_findings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6243,7 +6233,7 @@ def test_group_findings_flattened(): def test_group_findings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6259,7 +6249,7 @@ def test_group_findings_flattened_error(): @pytest.mark.asyncio async def test_group_findings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6292,7 +6282,7 @@ async def test_group_findings_flattened_async(): @pytest.mark.asyncio async def test_group_findings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6307,7 +6297,7 @@ async def test_group_findings_flattened_error_async(): def test_group_findings_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -6357,7 +6347,7 @@ def test_group_findings_pager(transport_name: str = "grpc"): def test_group_findings_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -6399,7 +6389,7 @@ def test_group_findings_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_group_findings_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6449,7 +6439,7 @@ async def test_group_findings_async_pager(): @pytest.mark.asyncio async def test_group_findings_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6504,7 +6494,7 @@ async def test_group_findings_async_pages(): ) def test_list_assets(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6536,7 +6526,7 @@ def test_list_assets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6554,7 +6544,7 @@ async def test_list_assets_async( request_type=securitycenter_service.ListAssetsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6591,7 +6581,7 @@ async def test_list_assets_async_from_dict(): def test_list_assets_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6621,7 +6611,7 @@ def test_list_assets_field_headers(): @pytest.mark.asyncio async def test_list_assets_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6652,7 +6642,7 @@ async def test_list_assets_field_headers_async(): def test_list_assets_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -6705,7 +6695,7 @@ def test_list_assets_pager(transport_name: str = "grpc"): def test_list_assets_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -6747,7 +6737,7 @@ def test_list_assets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_assets_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6800,7 +6790,7 @@ async def test_list_assets_async_pager(): @pytest.mark.asyncio async def test_list_assets_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6857,7 +6847,7 @@ def test_list_descendant_security_health_analytics_custom_modules( request_type, transport: str = "grpc" ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6897,7 +6887,7 @@ def test_list_descendant_security_health_analytics_custom_modules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6921,7 +6911,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_async( request_type=securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6970,7 +6960,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_async_fr def test_list_descendant_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7007,7 +6997,7 @@ def test_list_descendant_security_health_analytics_custom_modules_field_headers( @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7043,7 +7033,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_field_he def test_list_descendant_security_health_analytics_custom_modules_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7072,7 +7062,7 @@ def test_list_descendant_security_health_analytics_custom_modules_flattened(): def test_list_descendant_security_health_analytics_custom_modules_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7087,7 +7077,7 @@ def test_list_descendant_security_health_analytics_custom_modules_flattened_erro @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7123,7 +7113,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_flattene @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7139,7 +7129,7 @@ def test_list_descendant_security_health_analytics_custom_modules_pager( transport_name: str = "grpc", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -7202,7 +7192,7 @@ def test_list_descendant_security_health_analytics_custom_modules_pages( transport_name: str = "grpc", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -7251,7 +7241,7 @@ def test_list_descendant_security_health_analytics_custom_modules_pages( @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7311,7 +7301,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_async_pa @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7370,7 +7360,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_async_pa ) def test_list_findings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7402,7 +7392,7 @@ def test_list_findings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7420,7 +7410,7 @@ async def test_list_findings_async( request_type=securitycenter_service.ListFindingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7457,7 +7447,7 @@ async def test_list_findings_async_from_dict(): def test_list_findings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7487,7 +7477,7 @@ def test_list_findings_field_headers(): @pytest.mark.asyncio async def test_list_findings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7518,7 +7508,7 @@ async def test_list_findings_field_headers_async(): def test_list_findings_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -7573,7 +7563,7 @@ def test_list_findings_pager(transport_name: str = "grpc"): def test_list_findings_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -7615,7 +7605,7 @@ def test_list_findings_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_findings_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7670,7 +7660,7 @@ async def test_list_findings_async_pager(): @pytest.mark.asyncio async def test_list_findings_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7725,7 +7715,7 @@ async def test_list_findings_async_pages(): ) def test_list_mute_configs(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7757,7 +7747,7 @@ def test_list_mute_configs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7777,7 +7767,7 @@ async def test_list_mute_configs_async( request_type=securitycenter_service.ListMuteConfigsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7814,7 +7804,7 @@ async def test_list_mute_configs_async_from_dict(): def test_list_mute_configs_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7846,7 +7836,7 @@ def test_list_mute_configs_field_headers(): @pytest.mark.asyncio async def test_list_mute_configs_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7879,7 +7869,7 @@ async def test_list_mute_configs_field_headers_async(): def test_list_mute_configs_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7905,7 +7895,7 @@ def test_list_mute_configs_flattened(): def test_list_mute_configs_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7920,7 +7910,7 @@ def test_list_mute_configs_flattened_error(): @pytest.mark.asyncio async def test_list_mute_configs_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7951,7 +7941,7 @@ async def test_list_mute_configs_flattened_async(): @pytest.mark.asyncio async def test_list_mute_configs_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7965,7 +7955,7 @@ async def test_list_mute_configs_flattened_error_async(): def test_list_mute_configs_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -8017,7 +8007,7 @@ def test_list_mute_configs_pager(transport_name: str = "grpc"): def test_list_mute_configs_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -8061,7 +8051,7 @@ def test_list_mute_configs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_mute_configs_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8113,7 +8103,7 @@ async def test_list_mute_configs_async_pager(): @pytest.mark.asyncio async def test_list_mute_configs_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8170,7 +8160,7 @@ async def test_list_mute_configs_async_pages(): ) def test_list_notification_configs(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8202,7 +8192,7 @@ def test_list_notification_configs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -8222,7 +8212,7 @@ async def test_list_notification_configs_async( request_type=securitycenter_service.ListNotificationConfigsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8259,7 +8249,7 @@ async def test_list_notification_configs_async_from_dict(): def test_list_notification_configs_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8291,7 +8281,7 @@ def test_list_notification_configs_field_headers(): @pytest.mark.asyncio async def test_list_notification_configs_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8324,7 +8314,7 @@ async def test_list_notification_configs_field_headers_async(): def test_list_notification_configs_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8350,7 +8340,7 @@ def test_list_notification_configs_flattened(): def test_list_notification_configs_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -8365,7 +8355,7 @@ def test_list_notification_configs_flattened_error(): @pytest.mark.asyncio async def test_list_notification_configs_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8396,7 +8386,7 @@ async def test_list_notification_configs_flattened_async(): @pytest.mark.asyncio async def test_list_notification_configs_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -8410,7 +8400,7 @@ async def test_list_notification_configs_flattened_error_async(): def test_list_notification_configs_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -8464,7 +8454,7 @@ def test_list_notification_configs_pager(transport_name: str = "grpc"): def test_list_notification_configs_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -8508,7 +8498,7 @@ def test_list_notification_configs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_notification_configs_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8562,7 +8552,7 @@ async def test_list_notification_configs_async_pager(): @pytest.mark.asyncio async def test_list_notification_configs_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8621,7 +8611,7 @@ def test_list_effective_security_health_analytics_custom_modules( request_type, transport: str = "grpc" ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8661,7 +8651,7 @@ def test_list_effective_security_health_analytics_custom_modules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -8685,7 +8675,7 @@ async def test_list_effective_security_health_analytics_custom_modules_async( request_type=securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8732,7 +8722,7 @@ async def test_list_effective_security_health_analytics_custom_modules_async_fro def test_list_effective_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8769,7 +8759,7 @@ def test_list_effective_security_health_analytics_custom_modules_field_headers() @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8805,7 +8795,7 @@ async def test_list_effective_security_health_analytics_custom_modules_field_hea def test_list_effective_security_health_analytics_custom_modules_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8834,7 +8824,7 @@ def test_list_effective_security_health_analytics_custom_modules_flattened(): def test_list_effective_security_health_analytics_custom_modules_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -8849,7 +8839,7 @@ def test_list_effective_security_health_analytics_custom_modules_flattened_error @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8883,7 +8873,7 @@ async def test_list_effective_security_health_analytics_custom_modules_flattened @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -8899,7 +8889,7 @@ def test_list_effective_security_health_analytics_custom_modules_pager( transport_name: str = "grpc", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -8962,7 +8952,7 @@ def test_list_effective_security_health_analytics_custom_modules_pages( transport_name: str = "grpc", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -9011,7 +9001,7 @@ def test_list_effective_security_health_analytics_custom_modules_pages( @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9071,7 +9061,7 @@ async def test_list_effective_security_health_analytics_custom_modules_async_pag @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9132,7 +9122,7 @@ def test_list_security_health_analytics_custom_modules( request_type, transport: str = "grpc" ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9169,7 +9159,7 @@ def test_list_security_health_analytics_custom_modules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -9192,7 +9182,7 @@ async def test_list_security_health_analytics_custom_modules_async( request_type=securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9234,7 +9224,7 @@ async def test_list_security_health_analytics_custom_modules_async_from_dict(): def test_list_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9268,7 +9258,7 @@ def test_list_security_health_analytics_custom_modules_field_headers(): @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9301,7 +9291,7 @@ async def test_list_security_health_analytics_custom_modules_field_headers_async def test_list_security_health_analytics_custom_modules_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9329,7 +9319,7 @@ def test_list_security_health_analytics_custom_modules_flattened(): def test_list_security_health_analytics_custom_modules_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -9344,7 +9334,7 @@ def test_list_security_health_analytics_custom_modules_flattened_error(): @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9377,7 +9367,7 @@ async def test_list_security_health_analytics_custom_modules_flattened_async(): @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -9393,7 +9383,7 @@ def test_list_security_health_analytics_custom_modules_pager( transport_name: str = "grpc", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -9453,7 +9443,7 @@ def test_list_security_health_analytics_custom_modules_pages( transport_name: str = "grpc", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -9499,7 +9489,7 @@ def test_list_security_health_analytics_custom_modules_pages( @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9557,7 +9547,7 @@ async def test_list_security_health_analytics_custom_modules_async_pager(): @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9614,7 +9604,7 @@ async def test_list_security_health_analytics_custom_modules_async_pages(): ) def test_list_sources(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9644,7 +9634,7 @@ def test_list_sources_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -9662,7 +9652,7 @@ async def test_list_sources_async( request_type=securitycenter_service.ListSourcesRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9697,7 +9687,7 @@ async def test_list_sources_async_from_dict(): def test_list_sources_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9727,7 +9717,7 @@ def test_list_sources_field_headers(): @pytest.mark.asyncio async def test_list_sources_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9758,7 +9748,7 @@ async def test_list_sources_field_headers_async(): def test_list_sources_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9782,7 +9772,7 @@ def test_list_sources_flattened(): def test_list_sources_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -9797,7 +9787,7 @@ def test_list_sources_flattened_error(): @pytest.mark.asyncio async def test_list_sources_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9826,7 +9816,7 @@ async def test_list_sources_flattened_async(): @pytest.mark.asyncio async def test_list_sources_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -9840,7 +9830,7 @@ async def test_list_sources_flattened_error_async(): def test_list_sources_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -9890,7 +9880,7 @@ def test_list_sources_pager(transport_name: str = "grpc"): def test_list_sources_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -9932,7 +9922,7 @@ def test_list_sources_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_sources_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -9982,7 +9972,7 @@ async def test_list_sources_async_pager(): @pytest.mark.asyncio async def test_list_sources_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -10037,7 +10027,7 @@ async def test_list_sources_async_pages(): ) def test_run_asset_discovery(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10066,7 +10056,7 @@ def test_run_asset_discovery_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -10086,7 +10076,7 @@ async def test_run_asset_discovery_async( request_type=securitycenter_service.RunAssetDiscoveryRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10120,7 +10110,7 @@ async def test_run_asset_discovery_async_from_dict(): def test_run_asset_discovery_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10152,7 +10142,7 @@ def test_run_asset_discovery_field_headers(): @pytest.mark.asyncio async def test_run_asset_discovery_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10185,7 +10175,7 @@ async def test_run_asset_discovery_field_headers_async(): def test_run_asset_discovery_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -10211,7 +10201,7 @@ def test_run_asset_discovery_flattened(): def test_run_asset_discovery_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -10226,7 +10216,7 @@ def test_run_asset_discovery_flattened_error(): @pytest.mark.asyncio async def test_run_asset_discovery_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -10257,7 +10247,7 @@ async def test_run_asset_discovery_flattened_async(): @pytest.mark.asyncio async def test_run_asset_discovery_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -10278,7 +10268,7 @@ async def test_run_asset_discovery_flattened_error_async(): ) def test_set_finding_state(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10338,7 +10328,7 @@ def test_set_finding_state_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -10358,7 +10348,7 @@ async def test_set_finding_state_async( request_type=securitycenter_service.SetFindingStateRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10423,7 +10413,7 @@ async def test_set_finding_state_async_from_dict(): def test_set_finding_state_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10455,7 +10445,7 @@ def test_set_finding_state_field_headers(): @pytest.mark.asyncio async def test_set_finding_state_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10486,7 +10476,7 @@ async def test_set_finding_state_field_headers_async(): def test_set_finding_state_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -10520,7 +10510,7 @@ def test_set_finding_state_flattened(): def test_set_finding_state_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -10537,7 +10527,7 @@ def test_set_finding_state_flattened_error(): @pytest.mark.asyncio async def test_set_finding_state_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -10574,7 +10564,7 @@ async def test_set_finding_state_flattened_async(): @pytest.mark.asyncio async def test_set_finding_state_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -10597,7 +10587,7 @@ async def test_set_finding_state_flattened_error_async(): ) def test_set_mute(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10655,7 +10645,7 @@ def test_set_mute_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -10672,7 +10662,7 @@ async def test_set_mute_async( transport: str = "grpc_asyncio", request_type=securitycenter_service.SetMuteRequest ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10735,7 +10725,7 @@ async def test_set_mute_async_from_dict(): def test_set_mute_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10765,7 +10755,7 @@ def test_set_mute_field_headers(): @pytest.mark.asyncio async def test_set_mute_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10794,7 +10784,7 @@ async def test_set_mute_field_headers_async(): def test_set_mute_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -10822,7 +10812,7 @@ def test_set_mute_flattened(): def test_set_mute_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -10838,7 +10828,7 @@ def test_set_mute_flattened_error(): @pytest.mark.asyncio async def test_set_mute_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -10869,7 +10859,7 @@ async def test_set_mute_flattened_async(): @pytest.mark.asyncio async def test_set_mute_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -10891,7 +10881,7 @@ async def test_set_mute_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10923,7 +10913,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -10940,7 +10930,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10977,7 +10967,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -11007,7 +10997,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -11036,7 +11026,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -11054,7 +11044,7 @@ def test_set_iam_policy_from_dict_foreign(): def test_set_iam_policy_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -11078,7 +11068,7 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -11093,7 +11083,7 @@ def test_set_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -11120,7 +11110,7 @@ async def test_set_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -11141,7 +11131,7 @@ async def test_set_iam_policy_flattened_error_async(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11173,7 +11163,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -11193,7 +11183,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11230,7 +11220,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -11262,7 +11252,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -11295,7 +11285,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11314,7 +11304,7 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -11344,7 +11334,7 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -11360,7 +11350,7 @@ def test_test_iam_permissions_flattened_error(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -11395,7 +11385,7 @@ async def test_test_iam_permissions_flattened_async(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -11419,7 +11409,7 @@ def test_simulate_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11457,7 +11447,7 @@ def test_simulate_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -11481,7 +11471,7 @@ async def test_simulate_security_health_analytics_custom_module_async( request_type=securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11524,7 +11514,7 @@ async def test_simulate_security_health_analytics_custom_module_async_from_dict( def test_simulate_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -11561,7 +11551,7 @@ def test_simulate_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_simulate_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -11597,7 +11587,7 @@ async def test_simulate_security_health_analytics_custom_module_field_headers_as def test_simulate_security_health_analytics_custom_module_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -11642,7 +11632,7 @@ def test_simulate_security_health_analytics_custom_module_flattened(): def test_simulate_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -11663,7 +11653,7 @@ def test_simulate_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_simulate_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -11713,7 +11703,7 @@ async def test_simulate_security_health_analytics_custom_module_flattened_async( @pytest.mark.asyncio async def test_simulate_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -11740,7 +11730,7 @@ async def test_simulate_security_health_analytics_custom_module_flattened_error_ ) def test_update_external_system(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11778,7 +11768,7 @@ def test_update_external_system_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -11798,7 +11788,7 @@ async def test_update_external_system_async( request_type=securitycenter_service.UpdateExternalSystemRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11841,7 +11831,7 @@ async def test_update_external_system_async_from_dict(): def test_update_external_system_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -11873,7 +11863,7 @@ def test_update_external_system_field_headers(): @pytest.mark.asyncio async def test_update_external_system_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -11906,7 +11896,7 @@ async def test_update_external_system_field_headers_async(): def test_update_external_system_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -11936,7 +11926,7 @@ def test_update_external_system_flattened(): def test_update_external_system_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -11952,7 +11942,7 @@ def test_update_external_system_flattened_error(): @pytest.mark.asyncio async def test_update_external_system_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -11987,7 +11977,7 @@ async def test_update_external_system_flattened_async(): @pytest.mark.asyncio async def test_update_external_system_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -12009,7 +11999,7 @@ async def test_update_external_system_flattened_error_async(): ) def test_update_finding(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12067,7 +12057,7 @@ def test_update_finding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -12085,7 +12075,7 @@ async def test_update_finding_async( request_type=securitycenter_service.UpdateFindingRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12148,7 +12138,7 @@ async def test_update_finding_async_from_dict(): def test_update_finding_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12178,7 +12168,7 @@ def test_update_finding_field_headers(): @pytest.mark.asyncio async def test_update_finding_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12207,7 +12197,7 @@ async def test_update_finding_field_headers_async(): def test_update_finding_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -12231,7 +12221,7 @@ def test_update_finding_flattened(): def test_update_finding_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -12246,7 +12236,7 @@ def test_update_finding_flattened_error(): @pytest.mark.asyncio async def test_update_finding_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -12273,7 +12263,7 @@ async def test_update_finding_flattened_async(): @pytest.mark.asyncio async def test_update_finding_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -12294,7 +12284,7 @@ async def test_update_finding_flattened_error_async(): ) def test_update_mute_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12334,7 +12324,7 @@ def test_update_mute_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -12354,7 +12344,7 @@ async def test_update_mute_config_async( request_type=securitycenter_service.UpdateMuteConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12399,7 +12389,7 @@ async def test_update_mute_config_async_from_dict(): def test_update_mute_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12431,7 +12421,7 @@ def test_update_mute_config_field_headers(): @pytest.mark.asyncio async def test_update_mute_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12464,7 +12454,7 @@ async def test_update_mute_config_field_headers_async(): def test_update_mute_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -12494,7 +12484,7 @@ def test_update_mute_config_flattened(): def test_update_mute_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -12510,7 +12500,7 @@ def test_update_mute_config_flattened_error(): @pytest.mark.asyncio async def test_update_mute_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -12545,7 +12535,7 @@ async def test_update_mute_config_flattened_async(): @pytest.mark.asyncio async def test_update_mute_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -12567,7 +12557,7 @@ async def test_update_mute_config_flattened_error_async(): ) def test_update_notification_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12605,7 +12595,7 @@ def test_update_notification_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -12625,7 +12615,7 @@ async def test_update_notification_config_async( request_type=securitycenter_service.UpdateNotificationConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12668,7 +12658,7 @@ async def test_update_notification_config_async_from_dict(): def test_update_notification_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12700,7 +12690,7 @@ def test_update_notification_config_field_headers(): @pytest.mark.asyncio async def test_update_notification_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12733,7 +12723,7 @@ async def test_update_notification_config_field_headers_async(): def test_update_notification_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -12765,7 +12755,7 @@ def test_update_notification_config_flattened(): def test_update_notification_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -12783,7 +12773,7 @@ def test_update_notification_config_flattened_error(): @pytest.mark.asyncio async def test_update_notification_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -12820,7 +12810,7 @@ async def test_update_notification_config_flattened_async(): @pytest.mark.asyncio async def test_update_notification_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -12844,7 +12834,7 @@ async def test_update_notification_config_flattened_error_async(): ) def test_update_organization_settings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12878,7 +12868,7 @@ def test_update_organization_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -12898,7 +12888,7 @@ async def test_update_organization_settings_async( request_type=securitycenter_service.UpdateOrganizationSettingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12937,7 +12927,7 @@ async def test_update_organization_settings_async_from_dict(): def test_update_organization_settings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12969,7 +12959,7 @@ def test_update_organization_settings_field_headers(): @pytest.mark.asyncio async def test_update_organization_settings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -13002,7 +12992,7 @@ async def test_update_organization_settings_field_headers_async(): def test_update_organization_settings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -13030,7 +13020,7 @@ def test_update_organization_settings_flattened(): def test_update_organization_settings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -13047,7 +13037,7 @@ def test_update_organization_settings_flattened_error(): @pytest.mark.asyncio async def test_update_organization_settings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -13080,7 +13070,7 @@ async def test_update_organization_settings_flattened_async(): @pytest.mark.asyncio async def test_update_organization_settings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -13105,7 +13095,7 @@ def test_update_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13155,7 +13145,7 @@ def test_update_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -13179,7 +13169,7 @@ async def test_update_security_health_analytics_custom_module_async( request_type=securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13234,7 +13224,7 @@ async def test_update_security_health_analytics_custom_module_async_from_dict(): def test_update_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -13269,7 +13259,7 @@ def test_update_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_update_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -13303,7 +13293,7 @@ async def test_update_security_health_analytics_custom_module_field_headers_asyn def test_update_security_health_analytics_custom_module_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -13340,7 +13330,7 @@ def test_update_security_health_analytics_custom_module_flattened(): def test_update_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -13358,7 +13348,7 @@ def test_update_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_update_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -13400,7 +13390,7 @@ async def test_update_security_health_analytics_custom_module_flattened_async(): @pytest.mark.asyncio async def test_update_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -13424,7 +13414,7 @@ async def test_update_security_health_analytics_custom_module_flattened_error_as ) def test_update_source(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13460,7 +13450,7 @@ def test_update_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -13478,7 +13468,7 @@ async def test_update_source_async( request_type=securitycenter_service.UpdateSourceRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13519,7 +13509,7 @@ async def test_update_source_async_from_dict(): def test_update_source_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -13549,7 +13539,7 @@ def test_update_source_field_headers(): @pytest.mark.asyncio async def test_update_source_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -13578,7 +13568,7 @@ async def test_update_source_field_headers_async(): def test_update_source_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -13602,7 +13592,7 @@ def test_update_source_flattened(): def test_update_source_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -13617,7 +13607,7 @@ def test_update_source_flattened_error(): @pytest.mark.asyncio async def test_update_source_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -13644,7 +13634,7 @@ async def test_update_source_flattened_async(): @pytest.mark.asyncio async def test_update_source_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -13665,7 +13655,7 @@ async def test_update_source_flattened_error_async(): ) def test_update_security_marks(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13699,7 +13689,7 @@ def test_update_security_marks_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -13719,7 +13709,7 @@ async def test_update_security_marks_async( request_type=securitycenter_service.UpdateSecurityMarksRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13758,7 +13748,7 @@ async def test_update_security_marks_async_from_dict(): def test_update_security_marks_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -13790,7 +13780,7 @@ def test_update_security_marks_field_headers(): @pytest.mark.asyncio async def test_update_security_marks_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -13823,7 +13813,7 @@ async def test_update_security_marks_field_headers_async(): def test_update_security_marks_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -13849,7 +13839,7 @@ def test_update_security_marks_flattened(): def test_update_security_marks_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -13864,7 +13854,7 @@ def test_update_security_marks_flattened_error(): @pytest.mark.asyncio async def test_update_security_marks_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -13895,7 +13885,7 @@ async def test_update_security_marks_flattened_async(): @pytest.mark.asyncio async def test_update_security_marks_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -13916,7 +13906,7 @@ async def test_update_security_marks_flattened_error_async(): ) def test_create_big_query_export(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13958,7 +13948,7 @@ def test_create_big_query_export_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -13978,7 +13968,7 @@ async def test_create_big_query_export_async( request_type=securitycenter_service.CreateBigQueryExportRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14025,7 +14015,7 @@ async def test_create_big_query_export_async_from_dict(): def test_create_big_query_export_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -14057,7 +14047,7 @@ def test_create_big_query_export_field_headers(): @pytest.mark.asyncio async def test_create_big_query_export_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -14090,7 +14080,7 @@ async def test_create_big_query_export_field_headers_async(): def test_create_big_query_export_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -14124,7 +14114,7 @@ def test_create_big_query_export_flattened(): def test_create_big_query_export_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -14141,7 +14131,7 @@ def test_create_big_query_export_flattened_error(): @pytest.mark.asyncio async def test_create_big_query_export_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -14180,7 +14170,7 @@ async def test_create_big_query_export_flattened_async(): @pytest.mark.asyncio async def test_create_big_query_export_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -14203,7 +14193,7 @@ async def test_create_big_query_export_flattened_error_async(): ) def test_delete_big_query_export(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14232,7 +14222,7 @@ def test_delete_big_query_export_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -14252,7 +14242,7 @@ async def test_delete_big_query_export_async( request_type=securitycenter_service.DeleteBigQueryExportRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14284,7 +14274,7 @@ async def test_delete_big_query_export_async_from_dict(): def test_delete_big_query_export_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -14316,7 +14306,7 @@ def test_delete_big_query_export_field_headers(): @pytest.mark.asyncio async def test_delete_big_query_export_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -14347,7 +14337,7 @@ async def test_delete_big_query_export_field_headers_async(): def test_delete_big_query_export_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -14373,7 +14363,7 @@ def test_delete_big_query_export_flattened(): def test_delete_big_query_export_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -14388,7 +14378,7 @@ def test_delete_big_query_export_flattened_error(): @pytest.mark.asyncio async def test_delete_big_query_export_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -14417,7 +14407,7 @@ async def test_delete_big_query_export_flattened_async(): @pytest.mark.asyncio async def test_delete_big_query_export_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -14438,7 +14428,7 @@ async def test_delete_big_query_export_flattened_error_async(): ) def test_update_big_query_export(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14480,7 +14470,7 @@ def test_update_big_query_export_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -14500,7 +14490,7 @@ async def test_update_big_query_export_async( request_type=securitycenter_service.UpdateBigQueryExportRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14547,7 +14537,7 @@ async def test_update_big_query_export_async_from_dict(): def test_update_big_query_export_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -14579,7 +14569,7 @@ def test_update_big_query_export_field_headers(): @pytest.mark.asyncio async def test_update_big_query_export_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -14612,7 +14602,7 @@ async def test_update_big_query_export_field_headers_async(): def test_update_big_query_export_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -14642,7 +14632,7 @@ def test_update_big_query_export_flattened(): def test_update_big_query_export_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -14658,7 +14648,7 @@ def test_update_big_query_export_flattened_error(): @pytest.mark.asyncio async def test_update_big_query_export_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -14693,7 +14683,7 @@ async def test_update_big_query_export_flattened_async(): @pytest.mark.asyncio async def test_update_big_query_export_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -14715,7 +14705,7 @@ async def test_update_big_query_export_flattened_error_async(): ) def test_list_big_query_exports(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14747,7 +14737,7 @@ def test_list_big_query_exports_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -14767,7 +14757,7 @@ async def test_list_big_query_exports_async( request_type=securitycenter_service.ListBigQueryExportsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14804,7 +14794,7 @@ async def test_list_big_query_exports_async_from_dict(): def test_list_big_query_exports_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -14836,7 +14826,7 @@ def test_list_big_query_exports_field_headers(): @pytest.mark.asyncio async def test_list_big_query_exports_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -14869,7 +14859,7 @@ async def test_list_big_query_exports_field_headers_async(): def test_list_big_query_exports_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -14895,7 +14885,7 @@ def test_list_big_query_exports_flattened(): def test_list_big_query_exports_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -14910,7 +14900,7 @@ def test_list_big_query_exports_flattened_error(): @pytest.mark.asyncio async def test_list_big_query_exports_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -14941,7 +14931,7 @@ async def test_list_big_query_exports_flattened_async(): @pytest.mark.asyncio async def test_list_big_query_exports_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -14955,7 +14945,7 @@ async def test_list_big_query_exports_flattened_error_async(): def test_list_big_query_exports_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -15007,7 +14997,7 @@ def test_list_big_query_exports_pager(transport_name: str = "grpc"): def test_list_big_query_exports_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -15051,7 +15041,7 @@ def test_list_big_query_exports_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_big_query_exports_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -15103,7 +15093,7 @@ async def test_list_big_query_exports_async_pager(): @pytest.mark.asyncio async def test_list_big_query_exports_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -15160,7 +15150,7 @@ async def test_list_big_query_exports_async_pages(): ) def test_bulk_mute_findings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -15206,7 +15196,7 @@ def test_bulk_mute_findings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).bulk_mute_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -15215,7 +15205,7 @@ def test_bulk_mute_findings_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).bulk_mute_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -15224,7 +15214,7 @@ def test_bulk_mute_findings_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -15264,7 +15254,7 @@ def test_bulk_mute_findings_rest_required_fields( def test_bulk_mute_findings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.bulk_mute_findings._get_unset_required_fields({}) @@ -15274,7 +15264,7 @@ def test_bulk_mute_findings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_bulk_mute_findings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -15334,7 +15324,7 @@ def test_bulk_mute_findings_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.BulkMuteFindingsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15356,7 +15346,7 @@ def test_bulk_mute_findings_rest_bad_request( def test_bulk_mute_findings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -15395,7 +15385,7 @@ def test_bulk_mute_findings_rest_flattened(): def test_bulk_mute_findings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15410,7 +15400,7 @@ def test_bulk_mute_findings_rest_flattened_error(transport: str = "rest"): def test_bulk_mute_findings_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -15423,7 +15413,7 @@ def test_bulk_mute_findings_rest_error(): ) def test_create_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -15593,7 +15583,7 @@ def test_create_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -15604,7 +15594,7 @@ def test_create_security_health_analytics_custom_module_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -15615,7 +15605,7 @@ def test_create_security_health_analytics_custom_module_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -15662,7 +15652,7 @@ def test_create_security_health_analytics_custom_module_rest_required_fields( def test_create_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_security_health_analytics_custom_module._get_unset_required_fields( @@ -15684,7 +15674,7 @@ def test_create_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -15749,7 +15739,7 @@ def test_create_security_health_analytics_custom_module_rest_bad_request( request_type=securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15771,7 +15761,7 @@ def test_create_security_health_analytics_custom_module_rest_bad_request( def test_create_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -15824,7 +15814,7 @@ def test_create_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15842,7 +15832,7 @@ def test_create_security_health_analytics_custom_module_rest_flattened_error( def test_create_security_health_analytics_custom_module_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -15855,7 +15845,7 @@ def test_create_security_health_analytics_custom_module_rest_error(): ) def test_create_source_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -15985,7 +15975,7 @@ def test_create_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -15994,7 +15984,7 @@ def test_create_source_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -16003,7 +15993,7 @@ def test_create_source_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -16046,7 +16036,7 @@ def test_create_source_rest_required_fields( def test_create_source_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_source._get_unset_required_fields({}) @@ -16064,7 +16054,7 @@ def test_create_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_source_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -16120,7 +16110,7 @@ def test_create_source_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.CreateSourceRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16142,7 +16132,7 @@ def test_create_source_rest_bad_request( def test_create_source_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -16183,7 +16173,7 @@ def test_create_source_rest_flattened(): def test_create_source_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16199,7 +16189,7 @@ def test_create_source_rest_flattened_error(transport: str = "rest"): def test_create_source_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -16212,7 +16202,7 @@ def test_create_source_rest_error(): ) def test_create_finding_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -16558,7 +16548,7 @@ def test_create_finding_rest_required_fields( assert "findingId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_finding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -16570,7 +16560,7 @@ def test_create_finding_rest_required_fields( jsonified_request["findingId"] = "finding_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_finding._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("finding_id",)) @@ -16583,7 +16573,7 @@ def test_create_finding_rest_required_fields( assert jsonified_request["findingId"] == "finding_id_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -16632,7 +16622,7 @@ def test_create_finding_rest_required_fields( def test_create_finding_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_finding._get_unset_required_fields({}) @@ -16651,7 +16641,7 @@ def test_create_finding_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_finding_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -16707,7 +16697,7 @@ def test_create_finding_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.CreateFindingRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16729,7 +16719,7 @@ def test_create_finding_rest_bad_request( def test_create_finding_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -16773,7 +16763,7 @@ def test_create_finding_rest_flattened(): def test_create_finding_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16790,7 +16780,7 @@ def test_create_finding_rest_flattened_error(transport: str = "rest"): def test_create_finding_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -16803,7 +16793,7 @@ def test_create_finding_rest_error(): ) def test_create_mute_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -16942,7 +16932,7 @@ def test_create_mute_config_rest_required_fields( assert "muteConfigId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_mute_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -16954,7 +16944,7 @@ def test_create_mute_config_rest_required_fields( jsonified_request["muteConfigId"] = "mute_config_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_mute_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("mute_config_id",)) @@ -16967,7 +16957,7 @@ def test_create_mute_config_rest_required_fields( assert jsonified_request["muteConfigId"] == "mute_config_id_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -17016,7 +17006,7 @@ def test_create_mute_config_rest_required_fields( def test_create_mute_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_mute_config._get_unset_required_fields({}) @@ -17035,7 +17025,7 @@ def test_create_mute_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_mute_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -17093,7 +17083,7 @@ def test_create_mute_config_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.CreateMuteConfigRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -17115,7 +17105,7 @@ def test_create_mute_config_rest_bad_request( def test_create_mute_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -17158,7 +17148,7 @@ def test_create_mute_config_rest_flattened(): def test_create_mute_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -17175,7 +17165,7 @@ def test_create_mute_config_rest_flattened_error(transport: str = "rest"): def test_create_mute_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -17188,7 +17178,7 @@ def test_create_mute_config_rest_error(): ) def test_create_notification_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -17323,7 +17313,7 @@ def test_create_notification_config_rest_required_fields( assert "configId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -17335,7 +17325,7 @@ def test_create_notification_config_rest_required_fields( jsonified_request["configId"] = "config_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_notification_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("config_id",)) @@ -17348,7 +17338,7 @@ def test_create_notification_config_rest_required_fields( assert jsonified_request["configId"] == "config_id_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -17397,7 +17387,7 @@ def test_create_notification_config_rest_required_fields( def test_create_notification_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_notification_config._get_unset_required_fields({}) @@ -17416,7 +17406,7 @@ def test_create_notification_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_notification_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -17475,7 +17465,7 @@ def test_create_notification_config_rest_bad_request( request_type=securitycenter_service.CreateNotificationConfigRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -17497,7 +17487,7 @@ def test_create_notification_config_rest_bad_request( def test_create_notification_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -17543,7 +17533,7 @@ def test_create_notification_config_rest_flattened(): def test_create_notification_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -17562,7 +17552,7 @@ def test_create_notification_config_rest_flattened_error(transport: str = "rest" def test_create_notification_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -17575,7 +17565,7 @@ def test_create_notification_config_rest_error(): ) def test_delete_mute_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -17621,7 +17611,7 @@ def test_delete_mute_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_mute_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -17630,7 +17620,7 @@ def test_delete_mute_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_mute_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -17639,7 +17629,7 @@ def test_delete_mute_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -17678,7 +17668,7 @@ def test_delete_mute_config_rest_required_fields( def test_delete_mute_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_mute_config._get_unset_required_fields({}) @@ -17688,7 +17678,7 @@ def test_delete_mute_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_mute_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -17738,7 +17728,7 @@ def test_delete_mute_config_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.DeleteMuteConfigRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -17760,7 +17750,7 @@ def test_delete_mute_config_rest_bad_request( def test_delete_mute_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -17799,7 +17789,7 @@ def test_delete_mute_config_rest_flattened(): def test_delete_mute_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -17814,7 +17804,7 @@ def test_delete_mute_config_rest_flattened_error(transport: str = "rest"): def test_delete_mute_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -17827,7 +17817,7 @@ def test_delete_mute_config_rest_error(): ) def test_delete_notification_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -17873,7 +17863,7 @@ def test_delete_notification_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -17882,7 +17872,7 @@ def test_delete_notification_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -17891,7 +17881,7 @@ def test_delete_notification_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -17930,7 +17920,7 @@ def test_delete_notification_config_rest_required_fields( def test_delete_notification_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_notification_config._get_unset_required_fields({}) @@ -17940,7 +17930,7 @@ def test_delete_notification_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_notification_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -17991,7 +17981,7 @@ def test_delete_notification_config_rest_bad_request( request_type=securitycenter_service.DeleteNotificationConfigRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -18013,7 +18003,7 @@ def test_delete_notification_config_rest_bad_request( def test_delete_notification_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -18053,7 +18043,7 @@ def test_delete_notification_config_rest_flattened(): def test_delete_notification_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -18068,7 +18058,7 @@ def test_delete_notification_config_rest_flattened_error(transport: str = "rest" def test_delete_notification_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -18081,7 +18071,7 @@ def test_delete_notification_config_rest_error(): ) def test_delete_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -18129,7 +18119,7 @@ def test_delete_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -18140,7 +18130,7 @@ def test_delete_security_health_analytics_custom_module_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -18151,7 +18141,7 @@ def test_delete_security_health_analytics_custom_module_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -18190,7 +18180,7 @@ def test_delete_security_health_analytics_custom_module_rest_required_fields( def test_delete_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_security_health_analytics_custom_module._get_unset_required_fields( @@ -18204,7 +18194,7 @@ def test_delete_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -18258,7 +18248,7 @@ def test_delete_security_health_analytics_custom_module_rest_bad_request( request_type=securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -18282,7 +18272,7 @@ def test_delete_security_health_analytics_custom_module_rest_bad_request( def test_delete_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -18326,7 +18316,7 @@ def test_delete_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -18341,7 +18331,7 @@ def test_delete_security_health_analytics_custom_module_rest_flattened_error( def test_delete_security_health_analytics_custom_module_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -18354,7 +18344,7 @@ def test_delete_security_health_analytics_custom_module_rest_error(): ) def test_get_big_query_export_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -18415,7 +18405,7 @@ def test_get_big_query_export_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_big_query_export._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -18424,7 +18414,7 @@ def test_get_big_query_export_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_big_query_export._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -18433,7 +18423,7 @@ def test_get_big_query_export_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -18475,7 +18465,7 @@ def test_get_big_query_export_rest_required_fields( def test_get_big_query_export_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_big_query_export._get_unset_required_fields({}) @@ -18485,7 +18475,7 @@ def test_get_big_query_export_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_big_query_export_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -18544,7 +18534,7 @@ def test_get_big_query_export_rest_bad_request( request_type=securitycenter_service.GetBigQueryExportRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -18566,7 +18556,7 @@ def test_get_big_query_export_rest_bad_request( def test_get_big_query_export_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -18607,7 +18597,7 @@ def test_get_big_query_export_rest_flattened(): def test_get_big_query_export_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -18622,7 +18612,7 @@ def test_get_big_query_export_rest_flattened_error(transport: str = "rest"): def test_get_big_query_export_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -18635,7 +18625,7 @@ def test_get_big_query_export_rest_error(): ) def test_get_iam_policy_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -18686,7 +18676,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -18695,7 +18685,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -18704,7 +18694,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -18745,7 +18735,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -18755,7 +18745,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -18809,7 +18799,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -18831,7 +18821,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -18871,7 +18861,7 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -18886,7 +18876,7 @@ def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): def test_get_iam_policy_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -18899,7 +18889,7 @@ def test_get_iam_policy_rest_error(): ) def test_get_mute_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -18958,7 +18948,7 @@ def test_get_mute_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_mute_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -18967,7 +18957,7 @@ def test_get_mute_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_mute_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -18976,7 +18966,7 @@ def test_get_mute_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -19018,7 +19008,7 @@ def test_get_mute_config_rest_required_fields( def test_get_mute_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_mute_config._get_unset_required_fields({}) @@ -19028,7 +19018,7 @@ def test_get_mute_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_mute_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -19086,7 +19076,7 @@ def test_get_mute_config_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GetMuteConfigRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -19108,7 +19098,7 @@ def test_get_mute_config_rest_bad_request( def test_get_mute_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -19149,7 +19139,7 @@ def test_get_mute_config_rest_flattened(): def test_get_mute_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -19164,7 +19154,7 @@ def test_get_mute_config_rest_flattened_error(transport: str = "rest"): def test_get_mute_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -19177,7 +19167,7 @@ def test_get_mute_config_rest_error(): ) def test_get_notification_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -19234,7 +19224,7 @@ def test_get_notification_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -19243,7 +19233,7 @@ def test_get_notification_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -19252,7 +19242,7 @@ def test_get_notification_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -19294,7 +19284,7 @@ def test_get_notification_config_rest_required_fields( def test_get_notification_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_notification_config._get_unset_required_fields({}) @@ -19304,7 +19294,7 @@ def test_get_notification_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_notification_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -19363,7 +19353,7 @@ def test_get_notification_config_rest_bad_request( request_type=securitycenter_service.GetNotificationConfigRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -19385,7 +19375,7 @@ def test_get_notification_config_rest_bad_request( def test_get_notification_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -19427,7 +19417,7 @@ def test_get_notification_config_rest_flattened(): def test_get_notification_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -19442,7 +19432,7 @@ def test_get_notification_config_rest_flattened_error(transport: str = "rest"): def test_get_notification_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -19455,7 +19445,7 @@ def test_get_notification_config_rest_error(): ) def test_get_organization_settings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -19508,7 +19498,7 @@ def test_get_organization_settings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -19517,7 +19507,7 @@ def test_get_organization_settings_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -19526,7 +19516,7 @@ def test_get_organization_settings_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -19568,7 +19558,7 @@ def test_get_organization_settings_rest_required_fields( def test_get_organization_settings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_organization_settings._get_unset_required_fields({}) @@ -19578,7 +19568,7 @@ def test_get_organization_settings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_organization_settings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -19637,7 +19627,7 @@ def test_get_organization_settings_rest_bad_request( request_type=securitycenter_service.GetOrganizationSettingsRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -19659,7 +19649,7 @@ def test_get_organization_settings_rest_bad_request( def test_get_organization_settings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -19701,7 +19691,7 @@ def test_get_organization_settings_rest_flattened(): def test_get_organization_settings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -19716,7 +19706,7 @@ def test_get_organization_settings_rest_flattened_error(transport: str = "rest") def test_get_organization_settings_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -19729,7 +19719,7 @@ def test_get_organization_settings_rest_error(): ) def test_get_effective_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -19794,7 +19784,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_required_fie # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_effective_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -19805,7 +19795,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_required_fie jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_effective_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -19816,7 +19806,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_required_fie assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -19864,7 +19854,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_required_fie def test_get_effective_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_effective_security_health_analytics_custom_module._get_unset_required_fields( @@ -19878,7 +19868,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_interceptors null_interceptor, ): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -19943,7 +19933,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_bad_request( request_type=securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -19967,7 +19957,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_bad_request( def test_get_effective_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -20017,7 +20007,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_flattened_er transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -20032,7 +20022,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_flattened_er def test_get_effective_security_health_analytics_custom_module_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -20045,7 +20035,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_error(): ) def test_get_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -20114,7 +20104,7 @@ def test_get_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -20125,7 +20115,7 @@ def test_get_security_health_analytics_custom_module_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -20136,7 +20126,7 @@ def test_get_security_health_analytics_custom_module_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -20182,7 +20172,7 @@ def test_get_security_health_analytics_custom_module_rest_required_fields( def test_get_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_security_health_analytics_custom_module._get_unset_required_fields( @@ -20196,7 +20186,7 @@ def test_get_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -20261,7 +20251,7 @@ def test_get_security_health_analytics_custom_module_rest_bad_request( request_type=securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -20285,7 +20275,7 @@ def test_get_security_health_analytics_custom_module_rest_bad_request( def test_get_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -20335,7 +20325,7 @@ def test_get_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -20350,7 +20340,7 @@ def test_get_security_health_analytics_custom_module_rest_flattened_error( def test_get_security_health_analytics_custom_module_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -20363,7 +20353,7 @@ def test_get_security_health_analytics_custom_module_rest_error(): ) def test_get_source_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -20420,7 +20410,7 @@ def test_get_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -20429,7 +20419,7 @@ def test_get_source_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -20438,7 +20428,7 @@ def test_get_source_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -20480,7 +20470,7 @@ def test_get_source_rest_required_fields( def test_get_source_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_source._get_unset_required_fields({}) @@ -20490,7 +20480,7 @@ def test_get_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_source_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -20546,7 +20536,7 @@ def test_get_source_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GetSourceRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -20568,7 +20558,7 @@ def test_get_source_rest_bad_request( def test_get_source_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -20608,7 +20598,7 @@ def test_get_source_rest_flattened(): def test_get_source_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -20623,7 +20613,7 @@ def test_get_source_rest_flattened_error(transport: str = "rest"): def test_get_source_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -20636,7 +20626,7 @@ def test_get_source_rest_error(): ) def test_group_assets_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -20690,7 +20680,7 @@ def test_group_assets_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_assets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -20700,7 +20690,7 @@ def test_group_assets_rest_required_fields( jsonified_request["groupBy"] = "group_by_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_assets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -20711,7 +20701,7 @@ def test_group_assets_rest_required_fields( assert jsonified_request["groupBy"] == "group_by_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -20754,7 +20744,7 @@ def test_group_assets_rest_required_fields( def test_group_assets_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.group_assets._get_unset_required_fields({}) @@ -20772,7 +20762,7 @@ def test_group_assets_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_group_assets_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -20830,7 +20820,7 @@ def test_group_assets_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GroupAssetsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -20852,7 +20842,7 @@ def test_group_assets_rest_bad_request( def test_group_assets_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -20922,7 +20912,7 @@ def test_group_assets_rest_pager(transport: str = "rest"): ) def test_group_findings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -20976,7 +20966,7 @@ def test_group_findings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -20986,7 +20976,7 @@ def test_group_findings_rest_required_fields( jsonified_request["groupBy"] = "group_by_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -20997,7 +20987,7 @@ def test_group_findings_rest_required_fields( assert jsonified_request["groupBy"] == "group_by_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -21040,7 +21030,7 @@ def test_group_findings_rest_required_fields( def test_group_findings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.group_findings._get_unset_required_fields({}) @@ -21058,7 +21048,7 @@ def test_group_findings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_group_findings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -21118,7 +21108,7 @@ def test_group_findings_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GroupFindingsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -21140,7 +21130,7 @@ def test_group_findings_rest_bad_request( def test_group_findings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -21183,7 +21173,7 @@ def test_group_findings_rest_flattened(): def test_group_findings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -21199,7 +21189,7 @@ def test_group_findings_rest_flattened_error(transport: str = "rest"): def test_group_findings_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -21269,7 +21259,7 @@ def test_group_findings_rest_pager(transport: str = "rest"): ) def test_list_assets_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -21322,7 +21312,7 @@ def test_list_assets_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_assets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -21331,7 +21321,7 @@ def test_list_assets_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_assets._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -21352,7 +21342,7 @@ def test_list_assets_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -21394,7 +21384,7 @@ def test_list_assets_rest_required_fields( def test_list_assets_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_assets._get_unset_required_fields({}) @@ -21417,7 +21407,7 @@ def test_list_assets_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_assets_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -21475,7 +21465,7 @@ def test_list_assets_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListAssetsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -21497,7 +21487,7 @@ def test_list_assets_rest_bad_request( def test_list_assets_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -21570,7 +21560,7 @@ def test_list_assets_rest_pager(transport: str = "rest"): ) def test_list_descendant_security_health_analytics_custom_modules_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -21627,7 +21617,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_required_ # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_descendant_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -21638,7 +21628,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_required_ jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_descendant_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -21656,7 +21646,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_required_ assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -21704,7 +21694,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_required_ def test_list_descendant_security_health_analytics_custom_modules_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_descendant_security_health_analytics_custom_modules._get_unset_required_fields( @@ -21726,7 +21716,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_intercept null_interceptor, ): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -21791,7 +21781,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_bad_reque request_type=securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -21813,7 +21803,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_bad_reque def test_list_descendant_security_health_analytics_custom_modules_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -21863,7 +21853,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_flattened transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -21880,7 +21870,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_pager( transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -21967,7 +21957,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_pager( ) def test_list_findings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -22020,7 +22010,7 @@ def test_list_findings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -22029,7 +22019,7 @@ def test_list_findings_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_findings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -22050,7 +22040,7 @@ def test_list_findings_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -22092,7 +22082,7 @@ def test_list_findings_rest_required_fields( def test_list_findings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_findings._get_unset_required_fields({}) @@ -22115,7 +22105,7 @@ def test_list_findings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_findings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -22173,7 +22163,7 @@ def test_list_findings_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListFindingsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -22195,7 +22185,7 @@ def test_list_findings_rest_bad_request( def test_list_findings_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -22270,7 +22260,7 @@ def test_list_findings_rest_pager(transport: str = "rest"): ) def test_list_mute_configs_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -22321,7 +22311,7 @@ def test_list_mute_configs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_mute_configs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -22330,7 +22320,7 @@ def test_list_mute_configs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_mute_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -22346,7 +22336,7 @@ def test_list_mute_configs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -22390,7 +22380,7 @@ def test_list_mute_configs_rest_required_fields( def test_list_mute_configs_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_mute_configs._get_unset_required_fields({}) @@ -22408,7 +22398,7 @@ def test_list_mute_configs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_mute_configs_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -22468,7 +22458,7 @@ def test_list_mute_configs_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListMuteConfigsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -22490,7 +22480,7 @@ def test_list_mute_configs_rest_bad_request( def test_list_mute_configs_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -22531,7 +22521,7 @@ def test_list_mute_configs_rest_flattened(): def test_list_mute_configs_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -22546,7 +22536,7 @@ def test_list_mute_configs_rest_flattened_error(transport: str = "rest"): def test_list_mute_configs_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -22616,7 +22606,7 @@ def test_list_mute_configs_rest_pager(transport: str = "rest"): ) def test_list_notification_configs_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -22669,7 +22659,7 @@ def test_list_notification_configs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_notification_configs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -22678,7 +22668,7 @@ def test_list_notification_configs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_notification_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -22694,7 +22684,7 @@ def test_list_notification_configs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -22738,7 +22728,7 @@ def test_list_notification_configs_rest_required_fields( def test_list_notification_configs_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_notification_configs._get_unset_required_fields({}) @@ -22756,7 +22746,7 @@ def test_list_notification_configs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_notification_configs_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -22817,7 +22807,7 @@ def test_list_notification_configs_rest_bad_request( request_type=securitycenter_service.ListNotificationConfigsRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -22839,7 +22829,7 @@ def test_list_notification_configs_rest_bad_request( def test_list_notification_configs_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -22883,7 +22873,7 @@ def test_list_notification_configs_rest_flattened(): def test_list_notification_configs_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -22898,7 +22888,7 @@ def test_list_notification_configs_rest_flattened_error(transport: str = "rest") def test_list_notification_configs_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -22971,7 +22961,7 @@ def test_list_notification_configs_rest_pager(transport: str = "rest"): ) def test_list_effective_security_health_analytics_custom_modules_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -23028,7 +23018,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_required_f # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_effective_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -23039,7 +23029,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_required_f jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_effective_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -23057,7 +23047,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_required_f assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -23105,7 +23095,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_required_f def test_list_effective_security_health_analytics_custom_modules_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_effective_security_health_analytics_custom_modules._get_unset_required_fields( @@ -23127,7 +23117,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_intercepto null_interceptor, ): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -23192,7 +23182,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_bad_reques request_type=securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -23214,7 +23204,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_bad_reques def test_list_effective_security_health_analytics_custom_modules_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -23264,7 +23254,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_flattened_ transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -23281,7 +23271,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_pager( transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -23368,7 +23358,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_pager( ) def test_list_security_health_analytics_custom_modules_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -23425,7 +23415,7 @@ def test_list_security_health_analytics_custom_modules_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -23436,7 +23426,7 @@ def test_list_security_health_analytics_custom_modules_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -23454,7 +23444,7 @@ def test_list_security_health_analytics_custom_modules_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -23500,7 +23490,7 @@ def test_list_security_health_analytics_custom_modules_rest_required_fields( def test_list_security_health_analytics_custom_modules_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_security_health_analytics_custom_modules._get_unset_required_fields( @@ -23522,7 +23512,7 @@ def test_list_security_health_analytics_custom_modules_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -23589,7 +23579,7 @@ def test_list_security_health_analytics_custom_modules_rest_bad_request( request_type=securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -23611,7 +23601,7 @@ def test_list_security_health_analytics_custom_modules_rest_bad_request( def test_list_security_health_analytics_custom_modules_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -23663,7 +23653,7 @@ def test_list_security_health_analytics_custom_modules_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -23680,7 +23670,7 @@ def test_list_security_health_analytics_custom_modules_rest_pager( transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -23767,7 +23757,7 @@ def test_list_security_health_analytics_custom_modules_rest_pager( ) def test_list_sources_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -23818,7 +23808,7 @@ def test_list_sources_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_sources._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -23827,7 +23817,7 @@ def test_list_sources_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_sources._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -23843,7 +23833,7 @@ def test_list_sources_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -23885,7 +23875,7 @@ def test_list_sources_rest_required_fields( def test_list_sources_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_sources._get_unset_required_fields({}) @@ -23903,7 +23893,7 @@ def test_list_sources_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_sources_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -23961,7 +23951,7 @@ def test_list_sources_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListSourcesRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -23983,7 +23973,7 @@ def test_list_sources_rest_bad_request( def test_list_sources_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -24023,7 +24013,7 @@ def test_list_sources_rest_flattened(): def test_list_sources_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -24038,7 +24028,7 @@ def test_list_sources_rest_flattened_error(transport: str = "rest"): def test_list_sources_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -24108,7 +24098,7 @@ def test_list_sources_rest_pager(transport: str = "rest"): ) def test_run_asset_discovery_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -24154,7 +24144,7 @@ def test_run_asset_discovery_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_asset_discovery._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -24163,7 +24153,7 @@ def test_run_asset_discovery_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_asset_discovery._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -24172,7 +24162,7 @@ def test_run_asset_discovery_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -24212,7 +24202,7 @@ def test_run_asset_discovery_rest_required_fields( def test_run_asset_discovery_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.run_asset_discovery._get_unset_required_fields({}) @@ -24222,7 +24212,7 @@ def test_run_asset_discovery_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_run_asset_discovery_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -24283,7 +24273,7 @@ def test_run_asset_discovery_rest_bad_request( request_type=securitycenter_service.RunAssetDiscoveryRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -24305,7 +24295,7 @@ def test_run_asset_discovery_rest_bad_request( def test_run_asset_discovery_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -24345,7 +24335,7 @@ def test_run_asset_discovery_rest_flattened(): def test_run_asset_discovery_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -24360,7 +24350,7 @@ def test_run_asset_discovery_rest_flattened_error(transport: str = "rest"): def test_run_asset_discovery_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -24373,7 +24363,7 @@ def test_run_asset_discovery_rest_error(): ) def test_set_finding_state_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -24452,7 +24442,7 @@ def test_set_finding_state_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_finding_state._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -24461,7 +24451,7 @@ def test_set_finding_state_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_finding_state._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -24470,7 +24460,7 @@ def test_set_finding_state_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -24513,7 +24503,7 @@ def test_set_finding_state_rest_required_fields( def test_set_finding_state_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_finding_state._get_unset_required_fields({}) @@ -24532,7 +24522,7 @@ def test_set_finding_state_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_finding_state_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -24588,7 +24578,7 @@ def test_set_finding_state_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.SetFindingStateRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -24610,7 +24600,7 @@ def test_set_finding_state_rest_bad_request( def test_set_finding_state_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -24656,7 +24646,7 @@ def test_set_finding_state_rest_flattened(): def test_set_finding_state_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -24673,7 +24663,7 @@ def test_set_finding_state_rest_flattened_error(transport: str = "rest"): def test_set_finding_state_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -24686,7 +24676,7 @@ def test_set_finding_state_rest_error(): ) def test_set_mute_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -24765,7 +24755,7 @@ def test_set_mute_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_mute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -24774,7 +24764,7 @@ def test_set_mute_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_mute._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -24783,7 +24773,7 @@ def test_set_mute_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -24826,7 +24816,7 @@ def test_set_mute_rest_required_fields( def test_set_mute_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_mute._get_unset_required_fields({}) @@ -24844,7 +24834,7 @@ def test_set_mute_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_mute_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -24900,7 +24890,7 @@ def test_set_mute_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.SetMuteRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -24922,7 +24912,7 @@ def test_set_mute_rest_bad_request( def test_set_mute_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -24967,7 +24957,7 @@ def test_set_mute_rest_flattened(): def test_set_mute_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -24983,7 +24973,7 @@ def test_set_mute_rest_flattened_error(transport: str = "rest"): def test_set_mute_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -24996,7 +24986,7 @@ def test_set_mute_rest_error(): ) def test_set_iam_policy_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -25047,7 +25037,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -25056,7 +25046,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -25065,7 +25055,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -25106,7 +25096,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -25124,7 +25114,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -25178,7 +25168,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -25200,7 +25190,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -25240,7 +25230,7 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -25255,7 +25245,7 @@ def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): def test_set_iam_policy_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -25268,7 +25258,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -25318,7 +25308,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -25328,7 +25318,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -25339,7 +25329,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -25380,7 +25370,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -25398,7 +25388,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -25454,7 +25444,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -25476,7 +25466,7 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -25517,7 +25507,7 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -25533,7 +25523,7 @@ def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): def test_test_iam_permissions_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -25546,7 +25536,7 @@ def test_test_iam_permissions_rest_error(): ) def test_simulate_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -25601,7 +25591,7 @@ def test_simulate_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).simulate_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -25612,7 +25602,7 @@ def test_simulate_security_health_analytics_custom_module_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).simulate_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -25623,7 +25613,7 @@ def test_simulate_security_health_analytics_custom_module_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -25670,7 +25660,7 @@ def test_simulate_security_health_analytics_custom_module_rest_required_fields( def test_simulate_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.simulate_security_health_analytics_custom_module._get_unset_required_fields( @@ -25693,7 +25683,7 @@ def test_simulate_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -25758,7 +25748,7 @@ def test_simulate_security_health_analytics_custom_module_rest_bad_request( request_type=securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -25780,7 +25770,7 @@ def test_simulate_security_health_analytics_custom_module_rest_bad_request( def test_simulate_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -25836,7 +25826,7 @@ def test_simulate_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -25857,7 +25847,7 @@ def test_simulate_security_health_analytics_custom_module_rest_flattened_error( def test_simulate_security_health_analytics_custom_module_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -25870,7 +25860,7 @@ def test_simulate_security_health_analytics_custom_module_rest_error(): ) def test_update_external_system_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -26006,14 +25996,14 @@ def test_update_external_system_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_external_system._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_external_system._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -26022,7 +26012,7 @@ def test_update_external_system_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -26065,7 +26055,7 @@ def test_update_external_system_rest_required_fields( def test_update_external_system_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_external_system._get_unset_required_fields({}) @@ -26075,7 +26065,7 @@ def test_update_external_system_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_external_system_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -26134,7 +26124,7 @@ def test_update_external_system_rest_bad_request( request_type=securitycenter_service.UpdateExternalSystemRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -26160,7 +26150,7 @@ def test_update_external_system_rest_bad_request( def test_update_external_system_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -26207,7 +26197,7 @@ def test_update_external_system_rest_flattened(): def test_update_external_system_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -26223,7 +26213,7 @@ def test_update_external_system_rest_flattened_error(transport: str = "rest"): def test_update_external_system_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -26236,7 +26226,7 @@ def test_update_external_system_rest_error(): ) def test_update_finding_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -26581,14 +26571,14 @@ def test_update_finding_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_finding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_finding._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -26597,7 +26587,7 @@ def test_update_finding_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -26640,7 +26630,7 @@ def test_update_finding_rest_required_fields( def test_update_finding_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_finding._get_unset_required_fields({}) @@ -26650,7 +26640,7 @@ def test_update_finding_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_finding_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -26706,7 +26696,7 @@ def test_update_finding_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.UpdateFindingRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -26730,7 +26720,7 @@ def test_update_finding_rest_bad_request( def test_update_finding_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -26776,7 +26766,7 @@ def test_update_finding_rest_flattened(): def test_update_finding_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -26791,7 +26781,7 @@ def test_update_finding_rest_flattened_error(transport: str = "rest"): def test_update_finding_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -26804,7 +26794,7 @@ def test_update_finding_rest_error(): ) def test_update_mute_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -26942,14 +26932,14 @@ def test_update_mute_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_mute_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_mute_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -26958,7 +26948,7 @@ def test_update_mute_config_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -27001,7 +26991,7 @@ def test_update_mute_config_rest_required_fields( def test_update_mute_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_mute_config._get_unset_required_fields({}) @@ -27011,7 +27001,7 @@ def test_update_mute_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_mute_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -27069,7 +27059,7 @@ def test_update_mute_config_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.UpdateMuteConfigRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -27093,7 +27083,7 @@ def test_update_mute_config_rest_bad_request( def test_update_mute_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -27138,7 +27128,7 @@ def test_update_mute_config_rest_flattened(): def test_update_mute_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -27154,7 +27144,7 @@ def test_update_mute_config_rest_flattened_error(transport: str = "rest"): def test_update_mute_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -27167,7 +27157,7 @@ def test_update_mute_config_rest_error(): ) def test_update_notification_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -27303,14 +27293,14 @@ def test_update_notification_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_notification_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -27319,7 +27309,7 @@ def test_update_notification_config_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -27362,7 +27352,7 @@ def test_update_notification_config_rest_required_fields( def test_update_notification_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_notification_config._get_unset_required_fields({}) @@ -27372,7 +27362,7 @@ def test_update_notification_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_notification_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -27431,7 +27421,7 @@ def test_update_notification_config_rest_bad_request( request_type=securitycenter_service.UpdateNotificationConfigRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -27457,7 +27447,7 @@ def test_update_notification_config_rest_bad_request( def test_update_notification_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -27506,7 +27496,7 @@ def test_update_notification_config_rest_flattened(): def test_update_notification_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -27524,7 +27514,7 @@ def test_update_notification_config_rest_flattened_error(transport: str = "rest" def test_update_notification_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -27537,7 +27527,7 @@ def test_update_notification_config_rest_error(): ) def test_update_organization_settings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -27671,14 +27661,14 @@ def test_update_organization_settings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_organization_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_organization_settings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -27687,7 +27677,7 @@ def test_update_organization_settings_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -27732,7 +27722,7 @@ def test_update_organization_settings_rest_required_fields( def test_update_organization_settings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_organization_settings._get_unset_required_fields({}) @@ -27742,7 +27732,7 @@ def test_update_organization_settings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_organization_settings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -27803,7 +27793,7 @@ def test_update_organization_settings_rest_bad_request( request_type=securitycenter_service.UpdateOrganizationSettingsRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -27827,7 +27817,7 @@ def test_update_organization_settings_rest_bad_request( def test_update_organization_settings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -27875,7 +27865,7 @@ def test_update_organization_settings_rest_flattened(): def test_update_organization_settings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -27892,7 +27882,7 @@ def test_update_organization_settings_rest_flattened_error(transport: str = "res def test_update_organization_settings_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -27905,7 +27895,7 @@ def test_update_organization_settings_rest_error(): ) def test_update_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -28078,7 +28068,7 @@ def test_update_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -28087,7 +28077,7 @@ def test_update_security_health_analytics_custom_module_rest_required_fields( # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -28098,7 +28088,7 @@ def test_update_security_health_analytics_custom_module_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -28145,7 +28135,7 @@ def test_update_security_health_analytics_custom_module_rest_required_fields( def test_update_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_security_health_analytics_custom_module._get_unset_required_fields( @@ -28161,7 +28151,7 @@ def test_update_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -28226,7 +28216,7 @@ def test_update_security_health_analytics_custom_module_rest_bad_request( request_type=securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -28252,7 +28242,7 @@ def test_update_security_health_analytics_custom_module_rest_bad_request( def test_update_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -28307,7 +28297,7 @@ def test_update_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -28325,7 +28315,7 @@ def test_update_security_health_analytics_custom_module_rest_flattened_error( def test_update_security_health_analytics_custom_module_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -28338,7 +28328,7 @@ def test_update_security_health_analytics_custom_module_rest_error(): ) def test_update_source_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -28467,14 +28457,14 @@ def test_update_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_source._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -28483,7 +28473,7 @@ def test_update_source_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -28526,7 +28516,7 @@ def test_update_source_rest_required_fields( def test_update_source_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_source._get_unset_required_fields({}) @@ -28536,7 +28526,7 @@ def test_update_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_source_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -28592,7 +28582,7 @@ def test_update_source_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.UpdateSourceRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -28614,7 +28604,7 @@ def test_update_source_rest_bad_request( def test_update_source_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -28655,7 +28645,7 @@ def test_update_source_rest_flattened(): def test_update_source_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -28670,7 +28660,7 @@ def test_update_source_rest_flattened_error(transport: str = "rest"): def test_update_source_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -28683,7 +28673,7 @@ def test_update_source_rest_error(): ) def test_update_security_marks_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -28811,14 +28801,14 @@ def test_update_security_marks_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_marks._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_marks._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -28832,7 +28822,7 @@ def test_update_security_marks_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -28875,7 +28865,7 @@ def test_update_security_marks_rest_required_fields( def test_update_security_marks_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_security_marks._get_unset_required_fields({}) @@ -28893,7 +28883,7 @@ def test_update_security_marks_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_security_marks_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -28952,7 +28942,7 @@ def test_update_security_marks_rest_bad_request( request_type=securitycenter_service.UpdateSecurityMarksRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -28976,7 +28966,7 @@ def test_update_security_marks_rest_bad_request( def test_update_security_marks_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -29022,7 +29012,7 @@ def test_update_security_marks_rest_flattened(): def test_update_security_marks_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -29037,7 +29027,7 @@ def test_update_security_marks_rest_flattened_error(transport: str = "rest"): def test_update_security_marks_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -29050,7 +29040,7 @@ def test_update_security_marks_rest_error(): ) def test_create_big_query_export_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -29192,7 +29182,7 @@ def test_create_big_query_export_rest_required_fields( assert "bigQueryExportId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_big_query_export._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -29204,7 +29194,7 @@ def test_create_big_query_export_rest_required_fields( jsonified_request["bigQueryExportId"] = "big_query_export_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_big_query_export._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("big_query_export_id",)) @@ -29217,7 +29207,7 @@ def test_create_big_query_export_rest_required_fields( assert jsonified_request["bigQueryExportId"] == "big_query_export_id_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -29266,7 +29256,7 @@ def test_create_big_query_export_rest_required_fields( def test_create_big_query_export_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_big_query_export._get_unset_required_fields({}) @@ -29285,7 +29275,7 @@ def test_create_big_query_export_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_big_query_export_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -29344,7 +29334,7 @@ def test_create_big_query_export_rest_bad_request( request_type=securitycenter_service.CreateBigQueryExportRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -29366,7 +29356,7 @@ def test_create_big_query_export_rest_bad_request( def test_create_big_query_export_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -29409,7 +29399,7 @@ def test_create_big_query_export_rest_flattened(): def test_create_big_query_export_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -29426,7 +29416,7 @@ def test_create_big_query_export_rest_flattened_error(transport: str = "rest"): def test_create_big_query_export_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -29439,7 +29429,7 @@ def test_create_big_query_export_rest_error(): ) def test_delete_big_query_export_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -29485,7 +29475,7 @@ def test_delete_big_query_export_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_big_query_export._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -29494,7 +29484,7 @@ def test_delete_big_query_export_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_big_query_export._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -29503,7 +29493,7 @@ def test_delete_big_query_export_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -29542,7 +29532,7 @@ def test_delete_big_query_export_rest_required_fields( def test_delete_big_query_export_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_big_query_export._get_unset_required_fields({}) @@ -29552,7 +29542,7 @@ def test_delete_big_query_export_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_big_query_export_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -29603,7 +29593,7 @@ def test_delete_big_query_export_rest_bad_request( request_type=securitycenter_service.DeleteBigQueryExportRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -29625,7 +29615,7 @@ def test_delete_big_query_export_rest_bad_request( def test_delete_big_query_export_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -29664,7 +29654,7 @@ def test_delete_big_query_export_rest_flattened(): def test_delete_big_query_export_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -29679,7 +29669,7 @@ def test_delete_big_query_export_rest_flattened_error(transport: str = "rest"): def test_delete_big_query_export_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -29692,7 +29682,7 @@ def test_delete_big_query_export_rest_error(): ) def test_update_big_query_export_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -29833,14 +29823,14 @@ def test_update_big_query_export_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_big_query_export._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_big_query_export._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -29849,7 +29839,7 @@ def test_update_big_query_export_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -29892,7 +29882,7 @@ def test_update_big_query_export_rest_required_fields( def test_update_big_query_export_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_big_query_export._get_unset_required_fields({}) @@ -29902,7 +29892,7 @@ def test_update_big_query_export_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_big_query_export_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -29961,7 +29951,7 @@ def test_update_big_query_export_rest_bad_request( request_type=securitycenter_service.UpdateBigQueryExportRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -29985,7 +29975,7 @@ def test_update_big_query_export_rest_bad_request( def test_update_big_query_export_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -30032,7 +30022,7 @@ def test_update_big_query_export_rest_flattened(): def test_update_big_query_export_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -30048,7 +30038,7 @@ def test_update_big_query_export_rest_flattened_error(transport: str = "rest"): def test_update_big_query_export_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -30061,7 +30051,7 @@ def test_update_big_query_export_rest_error(): ) def test_list_big_query_exports_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -30114,7 +30104,7 @@ def test_list_big_query_exports_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_big_query_exports._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -30123,7 +30113,7 @@ def test_list_big_query_exports_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_big_query_exports._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -30139,7 +30129,7 @@ def test_list_big_query_exports_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -30183,7 +30173,7 @@ def test_list_big_query_exports_rest_required_fields( def test_list_big_query_exports_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_big_query_exports._get_unset_required_fields({}) @@ -30201,7 +30191,7 @@ def test_list_big_query_exports_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_big_query_exports_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -30262,7 +30252,7 @@ def test_list_big_query_exports_rest_bad_request( request_type=securitycenter_service.ListBigQueryExportsRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -30284,7 +30274,7 @@ def test_list_big_query_exports_rest_bad_request( def test_list_big_query_exports_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -30327,7 +30317,7 @@ def test_list_big_query_exports_rest_flattened(): def test_list_big_query_exports_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -30342,7 +30332,7 @@ def test_list_big_query_exports_rest_flattened_error(transport: str = "rest"): def test_list_big_query_exports_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -30407,17 +30397,17 @@ def test_list_big_query_exports_rest_pager(transport: str = "rest"): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterClient( @@ -30427,7 +30417,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -30442,13 +30432,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SecurityCenterClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterClient( @@ -30460,7 +30449,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SecurityCenterClient(transport=transport) assert client.transport is transport @@ -30469,13 +30458,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SecurityCenterGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -30492,7 +30481,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -30506,7 +30495,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SecurityCenterClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -30514,7 +30503,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -30526,7 +30515,7 @@ def test_security_center_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SecurityCenterTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -30538,7 +30527,7 @@ def test_security_center_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SecurityCenterTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -30623,7 +30612,7 @@ def test_security_center_base_transport_with_credentials_file(): "google.cloud.securitycenter_v1.services.security_center.transports.SecurityCenterTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecurityCenterTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -30642,7 +30631,7 @@ def test_security_center_base_transport_with_adc(): "google.cloud.securitycenter_v1.services.security_center.transports.SecurityCenterTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecurityCenterTransport() adc.assert_called_once() @@ -30650,7 +30639,7 @@ def test_security_center_base_transport_with_adc(): def test_security_center_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SecurityCenterClient() adc.assert_called_once_with( scopes=None, @@ -30670,7 +30659,7 @@ def test_security_center_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -30717,7 +30706,7 @@ def test_security_center_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -30745,7 +30734,7 @@ def test_security_center_transport_create_channel(transport_class, grpc_helpers) ], ) def test_security_center_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -30783,7 +30772,7 @@ def test_security_center_grpc_transport_client_cert_source_for_mtls(transport_cl def test_security_center_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -30795,7 +30784,7 @@ def test_security_center_http_transport_client_cert_source_for_mtls(): def test_security_center_rest_lro_client(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -30820,7 +30809,7 @@ def test_security_center_rest_lro_client(): ) def test_security_center_host_no_port(transport_name): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securitycenter.googleapis.com" ), @@ -30843,7 +30832,7 @@ def test_security_center_host_no_port(transport_name): ) def test_security_center_host_with_port(transport_name): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securitycenter.googleapis.com:8000" ), @@ -30863,8 +30852,8 @@ def test_security_center_host_with_port(transport_name): ], ) def test_security_center_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SecurityCenterClient( credentials=creds1, transport=transport_name, @@ -31076,7 +31065,7 @@ def test_security_center_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -31154,7 +31143,7 @@ def test_security_center_transport_channel_mtls_with_adc(transport_class): def test_security_center_grpc_lro_client(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -31171,7 +31160,7 @@ def test_security_center_grpc_lro_client(): def test_security_center_grpc_lro_async_client(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -31644,7 +31633,7 @@ def test_client_with_default_client_info(): transports.SecurityCenterTransport, "_prep_wrapped_messages" ) as prep: client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -31654,7 +31643,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecurityCenterClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -31663,7 +31652,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -31678,7 +31667,7 @@ def test_cancel_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.CancelOperationRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -31708,7 +31697,7 @@ def test_cancel_operation_rest_bad_request( ) def test_cancel_operation_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "organizations/sample1/operations/sample2"} @@ -31736,7 +31725,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -31766,7 +31755,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "organizations/sample1/operations/sample2"} @@ -31794,7 +31783,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -31824,7 +31813,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "organizations/sample1/operations/sample2"} @@ -31852,7 +31841,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -31882,7 +31871,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "organizations/sample1/operations"} @@ -31908,7 +31897,7 @@ def test_list_operations_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -31933,7 +31922,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -31957,7 +31946,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -31986,7 +31975,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -32013,7 +32002,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -32031,7 +32020,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -32047,7 +32036,7 @@ async def test_delete_operation_from_dict_async(): def test_cancel_operation(transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -32072,7 +32061,7 @@ def test_cancel_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_cancel_operation_async(transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -32096,7 +32085,7 @@ async def test_cancel_operation_async(transport: str = "grpc_asyncio"): def test_cancel_operation_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -32125,7 +32114,7 @@ def test_cancel_operation_field_headers(): @pytest.mark.asyncio async def test_cancel_operation_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -32152,7 +32141,7 @@ async def test_cancel_operation_field_headers_async(): def test_cancel_operation_from_dict(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -32170,7 +32159,7 @@ def test_cancel_operation_from_dict(): @pytest.mark.asyncio async def test_cancel_operation_from_dict_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -32186,7 +32175,7 @@ async def test_cancel_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -32211,7 +32200,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -32237,7 +32226,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -32266,7 +32255,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -32295,7 +32284,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -32313,7 +32302,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -32331,7 +32320,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -32356,7 +32345,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -32382,7 +32371,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -32411,7 +32400,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -32440,7 +32429,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -32458,7 +32447,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -32482,7 +32471,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -32499,7 +32488,7 @@ def test_client_ctx(): ] for transport in transports: client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1beta1/test_security_center.py b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1beta1/test_security_center.py index 807ec6b0f212..c50561675fda 100644 --- a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1beta1/test_security_center.py +++ b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1beta1/test_security_center.py @@ -108,18 +108,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -346,7 +334,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -373,42 +361,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -419,7 +414,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_security_center_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -471,7 +466,7 @@ def test_security_center_client_service_account_always_use_jwt( ], ) def test_security_center_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -534,9 +529,7 @@ def test_security_center_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(SecurityCenterClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -935,20 +928,20 @@ def test_security_center_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -960,13 +953,11 @@ def test_security_center_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -982,8 +973,7 @@ def test_security_center_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1136,8 +1126,8 @@ def test_security_center_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1166,7 +1156,7 @@ def test_security_center_client_create_channel_credentials_file( ) def test_create_source(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1200,7 +1190,7 @@ def test_create_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1218,7 +1208,7 @@ async def test_create_source_async( request_type=securitycenter_service.CreateSourceRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1257,7 +1247,7 @@ async def test_create_source_async_from_dict(): def test_create_source_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1287,7 +1277,7 @@ def test_create_source_field_headers(): @pytest.mark.asyncio async def test_create_source_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1316,7 +1306,7 @@ async def test_create_source_field_headers_async(): def test_create_source_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1344,7 +1334,7 @@ def test_create_source_flattened(): def test_create_source_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1360,7 +1350,7 @@ def test_create_source_flattened_error(): @pytest.mark.asyncio async def test_create_source_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1391,7 +1381,7 @@ async def test_create_source_flattened_async(): @pytest.mark.asyncio async def test_create_source_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1413,7 +1403,7 @@ async def test_create_source_flattened_error_async(): ) def test_create_finding(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1453,7 +1443,7 @@ def test_create_finding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1471,7 +1461,7 @@ async def test_create_finding_async( request_type=securitycenter_service.CreateFindingRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1516,7 +1506,7 @@ async def test_create_finding_async_from_dict(): def test_create_finding_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1546,7 +1536,7 @@ def test_create_finding_field_headers(): @pytest.mark.asyncio async def test_create_finding_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1575,7 +1565,7 @@ async def test_create_finding_field_headers_async(): def test_create_finding_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1607,7 +1597,7 @@ def test_create_finding_flattened(): def test_create_finding_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1624,7 +1614,7 @@ def test_create_finding_flattened_error(): @pytest.mark.asyncio async def test_create_finding_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1659,7 +1649,7 @@ async def test_create_finding_flattened_async(): @pytest.mark.asyncio async def test_create_finding_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1682,7 +1672,7 @@ async def test_create_finding_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1714,7 +1704,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1731,7 +1721,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1768,7 +1758,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1798,7 +1788,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1827,7 +1817,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -1844,7 +1834,7 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1868,7 +1858,7 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1883,7 +1873,7 @@ def test_get_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1910,7 +1900,7 @@ async def test_get_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1931,7 +1921,7 @@ async def test_get_iam_policy_flattened_error_async(): ) def test_get_organization_settings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1965,7 +1955,7 @@ def test_get_organization_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1985,7 +1975,7 @@ async def test_get_organization_settings_async( request_type=securitycenter_service.GetOrganizationSettingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2024,7 +2014,7 @@ async def test_get_organization_settings_async_from_dict(): def test_get_organization_settings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2056,7 +2046,7 @@ def test_get_organization_settings_field_headers(): @pytest.mark.asyncio async def test_get_organization_settings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2089,7 +2079,7 @@ async def test_get_organization_settings_field_headers_async(): def test_get_organization_settings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2115,7 +2105,7 @@ def test_get_organization_settings_flattened(): def test_get_organization_settings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2130,7 +2120,7 @@ def test_get_organization_settings_flattened_error(): @pytest.mark.asyncio async def test_get_organization_settings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2161,7 +2151,7 @@ async def test_get_organization_settings_flattened_async(): @pytest.mark.asyncio async def test_get_organization_settings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2182,7 +2172,7 @@ async def test_get_organization_settings_flattened_error_async(): ) def test_get_source(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2216,7 +2206,7 @@ def test_get_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2234,7 +2224,7 @@ async def test_get_source_async( request_type=securitycenter_service.GetSourceRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2273,7 +2263,7 @@ async def test_get_source_async_from_dict(): def test_get_source_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2303,7 +2293,7 @@ def test_get_source_field_headers(): @pytest.mark.asyncio async def test_get_source_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2332,7 +2322,7 @@ async def test_get_source_field_headers_async(): def test_get_source_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2356,7 +2346,7 @@ def test_get_source_flattened(): def test_get_source_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2371,7 +2361,7 @@ def test_get_source_flattened_error(): @pytest.mark.asyncio async def test_get_source_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2398,7 +2388,7 @@ async def test_get_source_flattened_async(): @pytest.mark.asyncio async def test_get_source_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2419,7 +2409,7 @@ async def test_get_source_flattened_error_async(): ) def test_group_assets(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2449,7 +2439,7 @@ def test_group_assets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2467,7 +2457,7 @@ async def test_group_assets_async( request_type=securitycenter_service.GroupAssetsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2502,7 +2492,7 @@ async def test_group_assets_async_from_dict(): def test_group_assets_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2532,7 +2522,7 @@ def test_group_assets_field_headers(): @pytest.mark.asyncio async def test_group_assets_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2563,7 +2553,7 @@ async def test_group_assets_field_headers_async(): def test_group_assets_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2613,7 +2603,7 @@ def test_group_assets_pager(transport_name: str = "grpc"): def test_group_assets_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2655,7 +2645,7 @@ def test_group_assets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_group_assets_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2705,7 +2695,7 @@ async def test_group_assets_async_pager(): @pytest.mark.asyncio async def test_group_assets_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2760,7 +2750,7 @@ async def test_group_assets_async_pages(): ) def test_group_findings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2790,7 +2780,7 @@ def test_group_findings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2808,7 +2798,7 @@ async def test_group_findings_async( request_type=securitycenter_service.GroupFindingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2843,7 +2833,7 @@ async def test_group_findings_async_from_dict(): def test_group_findings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2873,7 +2863,7 @@ def test_group_findings_field_headers(): @pytest.mark.asyncio async def test_group_findings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2904,7 +2894,7 @@ async def test_group_findings_field_headers_async(): def test_group_findings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2932,7 +2922,7 @@ def test_group_findings_flattened(): def test_group_findings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2948,7 +2938,7 @@ def test_group_findings_flattened_error(): @pytest.mark.asyncio async def test_group_findings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2981,7 +2971,7 @@ async def test_group_findings_flattened_async(): @pytest.mark.asyncio async def test_group_findings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2996,7 +2986,7 @@ async def test_group_findings_flattened_error_async(): def test_group_findings_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3046,7 +3036,7 @@ def test_group_findings_pager(transport_name: str = "grpc"): def test_group_findings_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3088,7 +3078,7 @@ def test_group_findings_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_group_findings_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3138,7 +3128,7 @@ async def test_group_findings_async_pager(): @pytest.mark.asyncio async def test_group_findings_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3193,7 +3183,7 @@ async def test_group_findings_async_pages(): ) def test_list_assets(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3225,7 +3215,7 @@ def test_list_assets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3243,7 +3233,7 @@ async def test_list_assets_async( request_type=securitycenter_service.ListAssetsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3280,7 +3270,7 @@ async def test_list_assets_async_from_dict(): def test_list_assets_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3310,7 +3300,7 @@ def test_list_assets_field_headers(): @pytest.mark.asyncio async def test_list_assets_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3341,7 +3331,7 @@ async def test_list_assets_field_headers_async(): def test_list_assets_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3394,7 +3384,7 @@ def test_list_assets_pager(transport_name: str = "grpc"): def test_list_assets_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3436,7 +3426,7 @@ def test_list_assets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_assets_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3489,7 +3479,7 @@ async def test_list_assets_async_pager(): @pytest.mark.asyncio async def test_list_assets_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3544,7 +3534,7 @@ async def test_list_assets_async_pages(): ) def test_list_findings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3576,7 +3566,7 @@ def test_list_findings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3594,7 +3584,7 @@ async def test_list_findings_async( request_type=securitycenter_service.ListFindingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3631,7 +3621,7 @@ async def test_list_findings_async_from_dict(): def test_list_findings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3661,7 +3651,7 @@ def test_list_findings_field_headers(): @pytest.mark.asyncio async def test_list_findings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3692,7 +3682,7 @@ async def test_list_findings_field_headers_async(): def test_list_findings_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3742,7 +3732,7 @@ def test_list_findings_pager(transport_name: str = "grpc"): def test_list_findings_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3784,7 +3774,7 @@ def test_list_findings_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_findings_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3834,7 +3824,7 @@ async def test_list_findings_async_pager(): @pytest.mark.asyncio async def test_list_findings_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3889,7 +3879,7 @@ async def test_list_findings_async_pages(): ) def test_list_sources(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3919,7 +3909,7 @@ def test_list_sources_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3937,7 +3927,7 @@ async def test_list_sources_async( request_type=securitycenter_service.ListSourcesRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3972,7 +3962,7 @@ async def test_list_sources_async_from_dict(): def test_list_sources_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4002,7 +3992,7 @@ def test_list_sources_field_headers(): @pytest.mark.asyncio async def test_list_sources_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4033,7 +4023,7 @@ async def test_list_sources_field_headers_async(): def test_list_sources_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4057,7 +4047,7 @@ def test_list_sources_flattened(): def test_list_sources_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4072,7 +4062,7 @@ def test_list_sources_flattened_error(): @pytest.mark.asyncio async def test_list_sources_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4101,7 +4091,7 @@ async def test_list_sources_flattened_async(): @pytest.mark.asyncio async def test_list_sources_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4115,7 +4105,7 @@ async def test_list_sources_flattened_error_async(): def test_list_sources_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4165,7 +4155,7 @@ def test_list_sources_pager(transport_name: str = "grpc"): def test_list_sources_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4207,7 +4197,7 @@ def test_list_sources_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_sources_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4257,7 +4247,7 @@ async def test_list_sources_async_pager(): @pytest.mark.asyncio async def test_list_sources_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4312,7 +4302,7 @@ async def test_list_sources_async_pages(): ) def test_run_asset_discovery(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4341,7 +4331,7 @@ def test_run_asset_discovery_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4361,7 +4351,7 @@ async def test_run_asset_discovery_async( request_type=securitycenter_service.RunAssetDiscoveryRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4395,7 +4385,7 @@ async def test_run_asset_discovery_async_from_dict(): def test_run_asset_discovery_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4427,7 +4417,7 @@ def test_run_asset_discovery_field_headers(): @pytest.mark.asyncio async def test_run_asset_discovery_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4460,7 +4450,7 @@ async def test_run_asset_discovery_field_headers_async(): def test_run_asset_discovery_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4486,7 +4476,7 @@ def test_run_asset_discovery_flattened(): def test_run_asset_discovery_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4501,7 +4491,7 @@ def test_run_asset_discovery_flattened_error(): @pytest.mark.asyncio async def test_run_asset_discovery_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4532,7 +4522,7 @@ async def test_run_asset_discovery_flattened_async(): @pytest.mark.asyncio async def test_run_asset_discovery_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4553,7 +4543,7 @@ async def test_run_asset_discovery_flattened_error_async(): ) def test_set_finding_state(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4595,7 +4585,7 @@ def test_set_finding_state_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4615,7 +4605,7 @@ async def test_set_finding_state_async( request_type=securitycenter_service.SetFindingStateRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4662,7 +4652,7 @@ async def test_set_finding_state_async_from_dict(): def test_set_finding_state_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4694,7 +4684,7 @@ def test_set_finding_state_field_headers(): @pytest.mark.asyncio async def test_set_finding_state_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4725,7 +4715,7 @@ async def test_set_finding_state_field_headers_async(): def test_set_finding_state_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4759,7 +4749,7 @@ def test_set_finding_state_flattened(): def test_set_finding_state_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4776,7 +4766,7 @@ def test_set_finding_state_flattened_error(): @pytest.mark.asyncio async def test_set_finding_state_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4813,7 +4803,7 @@ async def test_set_finding_state_flattened_async(): @pytest.mark.asyncio async def test_set_finding_state_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4836,7 +4826,7 @@ async def test_set_finding_state_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4868,7 +4858,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4885,7 +4875,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4922,7 +4912,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4952,7 +4942,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4981,7 +4971,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -4999,7 +4989,7 @@ def test_set_iam_policy_from_dict_foreign(): def test_set_iam_policy_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5023,7 +5013,7 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5038,7 +5028,7 @@ def test_set_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5065,7 +5055,7 @@ async def test_set_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5086,7 +5076,7 @@ async def test_set_iam_policy_flattened_error_async(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5118,7 +5108,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5138,7 +5128,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5175,7 +5165,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5207,7 +5197,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5240,7 +5230,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5259,7 +5249,7 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5289,7 +5279,7 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5305,7 +5295,7 @@ def test_test_iam_permissions_flattened_error(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5340,7 +5330,7 @@ async def test_test_iam_permissions_flattened_async(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5362,7 +5352,7 @@ async def test_test_iam_permissions_flattened_error_async(): ) def test_update_finding(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5402,7 +5392,7 @@ def test_update_finding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5420,7 +5410,7 @@ async def test_update_finding_async( request_type=securitycenter_service.UpdateFindingRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5465,7 +5455,7 @@ async def test_update_finding_async_from_dict(): def test_update_finding_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5495,7 +5485,7 @@ def test_update_finding_field_headers(): @pytest.mark.asyncio async def test_update_finding_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5524,7 +5514,7 @@ async def test_update_finding_field_headers_async(): def test_update_finding_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5548,7 +5538,7 @@ def test_update_finding_flattened(): def test_update_finding_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5563,7 +5553,7 @@ def test_update_finding_flattened_error(): @pytest.mark.asyncio async def test_update_finding_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5590,7 +5580,7 @@ async def test_update_finding_flattened_async(): @pytest.mark.asyncio async def test_update_finding_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5611,7 +5601,7 @@ async def test_update_finding_flattened_error_async(): ) def test_update_organization_settings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5645,7 +5635,7 @@ def test_update_organization_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5665,7 +5655,7 @@ async def test_update_organization_settings_async( request_type=securitycenter_service.UpdateOrganizationSettingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5704,7 +5694,7 @@ async def test_update_organization_settings_async_from_dict(): def test_update_organization_settings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5736,7 +5726,7 @@ def test_update_organization_settings_field_headers(): @pytest.mark.asyncio async def test_update_organization_settings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5769,7 +5759,7 @@ async def test_update_organization_settings_field_headers_async(): def test_update_organization_settings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5797,7 +5787,7 @@ def test_update_organization_settings_flattened(): def test_update_organization_settings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5814,7 +5804,7 @@ def test_update_organization_settings_flattened_error(): @pytest.mark.asyncio async def test_update_organization_settings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5847,7 +5837,7 @@ async def test_update_organization_settings_flattened_async(): @pytest.mark.asyncio async def test_update_organization_settings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5870,7 +5860,7 @@ async def test_update_organization_settings_flattened_error_async(): ) def test_update_source(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5904,7 +5894,7 @@ def test_update_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5922,7 +5912,7 @@ async def test_update_source_async( request_type=securitycenter_service.UpdateSourceRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5961,7 +5951,7 @@ async def test_update_source_async_from_dict(): def test_update_source_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5991,7 +5981,7 @@ def test_update_source_field_headers(): @pytest.mark.asyncio async def test_update_source_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6020,7 +6010,7 @@ async def test_update_source_field_headers_async(): def test_update_source_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6044,7 +6034,7 @@ def test_update_source_flattened(): def test_update_source_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6059,7 +6049,7 @@ def test_update_source_flattened_error(): @pytest.mark.asyncio async def test_update_source_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6086,7 +6076,7 @@ async def test_update_source_flattened_async(): @pytest.mark.asyncio async def test_update_source_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6107,7 +6097,7 @@ async def test_update_source_flattened_error_async(): ) def test_update_security_marks(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6139,7 +6129,7 @@ def test_update_security_marks_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6159,7 +6149,7 @@ async def test_update_security_marks_async( request_type=securitycenter_service.UpdateSecurityMarksRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6196,7 +6186,7 @@ async def test_update_security_marks_async_from_dict(): def test_update_security_marks_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6228,7 +6218,7 @@ def test_update_security_marks_field_headers(): @pytest.mark.asyncio async def test_update_security_marks_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6261,7 +6251,7 @@ async def test_update_security_marks_field_headers_async(): def test_update_security_marks_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6287,7 +6277,7 @@ def test_update_security_marks_flattened(): def test_update_security_marks_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6302,7 +6292,7 @@ def test_update_security_marks_flattened_error(): @pytest.mark.asyncio async def test_update_security_marks_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6333,7 +6323,7 @@ async def test_update_security_marks_flattened_async(): @pytest.mark.asyncio async def test_update_security_marks_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6354,7 +6344,7 @@ async def test_update_security_marks_flattened_error_async(): ) def test_create_source_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6481,7 +6471,7 @@ def test_create_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6490,7 +6480,7 @@ def test_create_source_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6499,7 +6489,7 @@ def test_create_source_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6542,7 +6532,7 @@ def test_create_source_rest_required_fields( def test_create_source_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_source._get_unset_required_fields({}) @@ -6560,7 +6550,7 @@ def test_create_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_source_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -6616,7 +6606,7 @@ def test_create_source_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.CreateSourceRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6638,7 +6628,7 @@ def test_create_source_rest_bad_request( def test_create_source_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6680,7 +6670,7 @@ def test_create_source_rest_flattened(): def test_create_source_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6696,7 +6686,7 @@ def test_create_source_rest_flattened_error(transport: str = "rest"): def test_create_source_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6709,7 +6699,7 @@ def test_create_source_rest_error(): ) def test_create_finding_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6851,7 +6841,7 @@ def test_create_finding_rest_required_fields( assert "findingId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_finding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6863,7 +6853,7 @@ def test_create_finding_rest_required_fields( jsonified_request["findingId"] = "finding_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_finding._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("finding_id",)) @@ -6876,7 +6866,7 @@ def test_create_finding_rest_required_fields( assert jsonified_request["findingId"] == "finding_id_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6925,7 +6915,7 @@ def test_create_finding_rest_required_fields( def test_create_finding_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_finding._get_unset_required_fields({}) @@ -6944,7 +6934,7 @@ def test_create_finding_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_finding_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -7000,7 +6990,7 @@ def test_create_finding_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.CreateFindingRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7022,7 +7012,7 @@ def test_create_finding_rest_bad_request( def test_create_finding_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7066,7 +7056,7 @@ def test_create_finding_rest_flattened(): def test_create_finding_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7083,7 +7073,7 @@ def test_create_finding_rest_flattened_error(transport: str = "rest"): def test_create_finding_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7096,7 +7086,7 @@ def test_create_finding_rest_error(): ) def test_get_iam_policy_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7147,7 +7137,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7156,7 +7146,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7165,7 +7155,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7206,7 +7196,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -7216,7 +7206,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -7270,7 +7260,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7292,7 +7282,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7332,7 +7322,7 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7347,7 +7337,7 @@ def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): def test_get_iam_policy_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7360,7 +7350,7 @@ def test_get_iam_policy_rest_error(): ) def test_get_organization_settings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7413,7 +7403,7 @@ def test_get_organization_settings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7422,7 +7412,7 @@ def test_get_organization_settings_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7431,7 +7421,7 @@ def test_get_organization_settings_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7473,7 +7463,7 @@ def test_get_organization_settings_rest_required_fields( def test_get_organization_settings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_organization_settings._get_unset_required_fields({}) @@ -7483,7 +7473,7 @@ def test_get_organization_settings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_organization_settings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -7542,7 +7532,7 @@ def test_get_organization_settings_rest_bad_request( request_type=securitycenter_service.GetOrganizationSettingsRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7564,7 +7554,7 @@ def test_get_organization_settings_rest_bad_request( def test_get_organization_settings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7606,7 +7596,7 @@ def test_get_organization_settings_rest_flattened(): def test_get_organization_settings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7621,7 +7611,7 @@ def test_get_organization_settings_rest_flattened_error(transport: str = "rest") def test_get_organization_settings_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7634,7 +7624,7 @@ def test_get_organization_settings_rest_error(): ) def test_get_source_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7689,7 +7679,7 @@ def test_get_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7698,7 +7688,7 @@ def test_get_source_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7707,7 +7697,7 @@ def test_get_source_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7749,7 +7739,7 @@ def test_get_source_rest_required_fields( def test_get_source_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_source._get_unset_required_fields({}) @@ -7759,7 +7749,7 @@ def test_get_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_source_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -7815,7 +7805,7 @@ def test_get_source_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GetSourceRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7837,7 +7827,7 @@ def test_get_source_rest_bad_request( def test_get_source_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7878,7 +7868,7 @@ def test_get_source_rest_flattened(): def test_get_source_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7893,7 +7883,7 @@ def test_get_source_rest_flattened_error(transport: str = "rest"): def test_get_source_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7906,7 +7896,7 @@ def test_get_source_rest_error(): ) def test_group_assets_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7958,7 +7948,7 @@ def test_group_assets_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_assets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7968,7 +7958,7 @@ def test_group_assets_rest_required_fields( jsonified_request["groupBy"] = "group_by_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_assets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7979,7 +7969,7 @@ def test_group_assets_rest_required_fields( assert jsonified_request["groupBy"] == "group_by_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8022,7 +8012,7 @@ def test_group_assets_rest_required_fields( def test_group_assets_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.group_assets._get_unset_required_fields({}) @@ -8040,7 +8030,7 @@ def test_group_assets_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_group_assets_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -8098,7 +8088,7 @@ def test_group_assets_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GroupAssetsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8120,7 +8110,7 @@ def test_group_assets_rest_bad_request( def test_group_assets_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8190,7 +8180,7 @@ def test_group_assets_rest_pager(transport: str = "rest"): ) def test_group_findings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8242,7 +8232,7 @@ def test_group_findings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8252,7 +8242,7 @@ def test_group_findings_rest_required_fields( jsonified_request["groupBy"] = "group_by_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8263,7 +8253,7 @@ def test_group_findings_rest_required_fields( assert jsonified_request["groupBy"] == "group_by_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8306,7 +8296,7 @@ def test_group_findings_rest_required_fields( def test_group_findings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.group_findings._get_unset_required_fields({}) @@ -8324,7 +8314,7 @@ def test_group_findings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_group_findings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -8384,7 +8374,7 @@ def test_group_findings_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GroupFindingsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8406,7 +8396,7 @@ def test_group_findings_rest_bad_request( def test_group_findings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8449,7 +8439,7 @@ def test_group_findings_rest_flattened(): def test_group_findings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8465,7 +8455,7 @@ def test_group_findings_rest_flattened_error(transport: str = "rest"): def test_group_findings_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8535,7 +8525,7 @@ def test_group_findings_rest_pager(transport: str = "rest"): ) def test_list_assets_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8588,7 +8578,7 @@ def test_list_assets_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_assets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8597,7 +8587,7 @@ def test_list_assets_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_assets._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -8618,7 +8608,7 @@ def test_list_assets_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8660,7 +8650,7 @@ def test_list_assets_rest_required_fields( def test_list_assets_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_assets._get_unset_required_fields({}) @@ -8683,7 +8673,7 @@ def test_list_assets_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_assets_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -8741,7 +8731,7 @@ def test_list_assets_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListAssetsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8763,7 +8753,7 @@ def test_list_assets_rest_bad_request( def test_list_assets_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8836,7 +8826,7 @@ def test_list_assets_rest_pager(transport: str = "rest"): ) def test_list_findings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8889,7 +8879,7 @@ def test_list_findings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8898,7 +8888,7 @@ def test_list_findings_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_findings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -8918,7 +8908,7 @@ def test_list_findings_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8960,7 +8950,7 @@ def test_list_findings_rest_required_fields( def test_list_findings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_findings._get_unset_required_fields({}) @@ -8982,7 +8972,7 @@ def test_list_findings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_findings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -9040,7 +9030,7 @@ def test_list_findings_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListFindingsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9062,7 +9052,7 @@ def test_list_findings_rest_bad_request( def test_list_findings_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9132,7 +9122,7 @@ def test_list_findings_rest_pager(transport: str = "rest"): ) def test_list_sources_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9183,7 +9173,7 @@ def test_list_sources_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_sources._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9192,7 +9182,7 @@ def test_list_sources_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_sources._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -9208,7 +9198,7 @@ def test_list_sources_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9250,7 +9240,7 @@ def test_list_sources_rest_required_fields( def test_list_sources_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_sources._get_unset_required_fields({}) @@ -9268,7 +9258,7 @@ def test_list_sources_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_sources_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -9326,7 +9316,7 @@ def test_list_sources_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListSourcesRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9348,7 +9338,7 @@ def test_list_sources_rest_bad_request( def test_list_sources_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9389,7 +9379,7 @@ def test_list_sources_rest_flattened(): def test_list_sources_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9404,7 +9394,7 @@ def test_list_sources_rest_flattened_error(transport: str = "rest"): def test_list_sources_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9474,7 +9464,7 @@ def test_list_sources_rest_pager(transport: str = "rest"): ) def test_run_asset_discovery_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9520,7 +9510,7 @@ def test_run_asset_discovery_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_asset_discovery._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9529,7 +9519,7 @@ def test_run_asset_discovery_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_asset_discovery._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9538,7 +9528,7 @@ def test_run_asset_discovery_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9578,7 +9568,7 @@ def test_run_asset_discovery_rest_required_fields( def test_run_asset_discovery_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.run_asset_discovery._get_unset_required_fields({}) @@ -9588,7 +9578,7 @@ def test_run_asset_discovery_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_run_asset_discovery_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -9649,7 +9639,7 @@ def test_run_asset_discovery_rest_bad_request( request_type=securitycenter_service.RunAssetDiscoveryRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9671,7 +9661,7 @@ def test_run_asset_discovery_rest_bad_request( def test_run_asset_discovery_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9711,7 +9701,7 @@ def test_run_asset_discovery_rest_flattened(): def test_run_asset_discovery_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9726,7 +9716,7 @@ def test_run_asset_discovery_rest_flattened_error(transport: str = "rest"): def test_run_asset_discovery_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9739,7 +9729,7 @@ def test_run_asset_discovery_rest_error(): ) def test_set_finding_state_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9800,7 +9790,7 @@ def test_set_finding_state_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_finding_state._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9809,7 +9799,7 @@ def test_set_finding_state_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_finding_state._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9818,7 +9808,7 @@ def test_set_finding_state_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9861,7 +9851,7 @@ def test_set_finding_state_rest_required_fields( def test_set_finding_state_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_finding_state._get_unset_required_fields({}) @@ -9880,7 +9870,7 @@ def test_set_finding_state_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_finding_state_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -9936,7 +9926,7 @@ def test_set_finding_state_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.SetFindingStateRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9958,7 +9948,7 @@ def test_set_finding_state_rest_bad_request( def test_set_finding_state_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10004,7 +9994,7 @@ def test_set_finding_state_rest_flattened(): def test_set_finding_state_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10021,7 +10011,7 @@ def test_set_finding_state_rest_flattened_error(transport: str = "rest"): def test_set_finding_state_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10034,7 +10024,7 @@ def test_set_finding_state_rest_error(): ) def test_set_iam_policy_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10085,7 +10075,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10094,7 +10084,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10103,7 +10093,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10144,7 +10134,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -10162,7 +10152,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -10216,7 +10206,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10238,7 +10228,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10278,7 +10268,7 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10293,7 +10283,7 @@ def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): def test_set_iam_policy_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10306,7 +10296,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10356,7 +10346,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10366,7 +10356,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10377,7 +10367,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10418,7 +10408,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -10436,7 +10426,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -10492,7 +10482,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10514,7 +10504,7 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10555,7 +10545,7 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10571,7 +10561,7 @@ def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): def test_test_iam_permissions_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10584,7 +10574,7 @@ def test_test_iam_permissions_rest_error(): ) def test_update_finding_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10725,14 +10715,14 @@ def test_update_finding_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_finding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_finding._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -10741,7 +10731,7 @@ def test_update_finding_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10784,7 +10774,7 @@ def test_update_finding_rest_required_fields( def test_update_finding_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_finding._get_unset_required_fields({}) @@ -10794,7 +10784,7 @@ def test_update_finding_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_finding_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -10850,7 +10840,7 @@ def test_update_finding_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.UpdateFindingRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10874,7 +10864,7 @@ def test_update_finding_rest_bad_request( def test_update_finding_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10920,7 +10910,7 @@ def test_update_finding_rest_flattened(): def test_update_finding_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10935,7 +10925,7 @@ def test_update_finding_rest_flattened_error(transport: str = "rest"): def test_update_finding_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10948,7 +10938,7 @@ def test_update_finding_rest_error(): ) def test_update_organization_settings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11081,14 +11071,14 @@ def test_update_organization_settings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_organization_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_organization_settings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -11097,7 +11087,7 @@ def test_update_organization_settings_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11142,7 +11132,7 @@ def test_update_organization_settings_rest_required_fields( def test_update_organization_settings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_organization_settings._get_unset_required_fields({}) @@ -11152,7 +11142,7 @@ def test_update_organization_settings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_organization_settings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -11213,7 +11203,7 @@ def test_update_organization_settings_rest_bad_request( request_type=securitycenter_service.UpdateOrganizationSettingsRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11237,7 +11227,7 @@ def test_update_organization_settings_rest_bad_request( def test_update_organization_settings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11285,7 +11275,7 @@ def test_update_organization_settings_rest_flattened(): def test_update_organization_settings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11302,7 +11292,7 @@ def test_update_organization_settings_rest_flattened_error(transport: str = "res def test_update_organization_settings_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -11315,7 +11305,7 @@ def test_update_organization_settings_rest_error(): ) def test_update_source_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11441,14 +11431,14 @@ def test_update_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_source._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -11457,7 +11447,7 @@ def test_update_source_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11500,7 +11490,7 @@ def test_update_source_rest_required_fields( def test_update_source_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_source._get_unset_required_fields({}) @@ -11510,7 +11500,7 @@ def test_update_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_source_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -11566,7 +11556,7 @@ def test_update_source_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.UpdateSourceRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11588,7 +11578,7 @@ def test_update_source_rest_bad_request( def test_update_source_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11630,7 +11620,7 @@ def test_update_source_rest_flattened(): def test_update_source_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11645,7 +11635,7 @@ def test_update_source_rest_flattened_error(transport: str = "rest"): def test_update_source_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -11658,7 +11648,7 @@ def test_update_source_rest_error(): ) def test_update_security_marks_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11783,14 +11773,14 @@ def test_update_security_marks_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_marks._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_marks._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -11804,7 +11794,7 @@ def test_update_security_marks_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11847,7 +11837,7 @@ def test_update_security_marks_rest_required_fields( def test_update_security_marks_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_security_marks._get_unset_required_fields({}) @@ -11865,7 +11855,7 @@ def test_update_security_marks_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_security_marks_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -11924,7 +11914,7 @@ def test_update_security_marks_rest_bad_request( request_type=securitycenter_service.UpdateSecurityMarksRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11948,7 +11938,7 @@ def test_update_security_marks_rest_bad_request( def test_update_security_marks_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11994,7 +11984,7 @@ def test_update_security_marks_rest_flattened(): def test_update_security_marks_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12009,24 +11999,24 @@ def test_update_security_marks_rest_flattened_error(transport: str = "rest"): def test_update_security_marks_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterClient( @@ -12036,7 +12026,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -12051,13 +12041,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SecurityCenterClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterClient( @@ -12069,7 +12058,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SecurityCenterClient(transport=transport) assert client.transport is transport @@ -12078,13 +12067,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SecurityCenterGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -12101,7 +12090,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -12115,7 +12104,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SecurityCenterClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -12123,7 +12112,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -12135,7 +12124,7 @@ def test_security_center_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SecurityCenterTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -12147,7 +12136,7 @@ def test_security_center_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SecurityCenterTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -12201,7 +12190,7 @@ def test_security_center_base_transport_with_credentials_file(): "google.cloud.securitycenter_v1beta1.services.security_center.transports.SecurityCenterTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecurityCenterTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -12220,7 +12209,7 @@ def test_security_center_base_transport_with_adc(): "google.cloud.securitycenter_v1beta1.services.security_center.transports.SecurityCenterTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecurityCenterTransport() adc.assert_called_once() @@ -12228,7 +12217,7 @@ def test_security_center_base_transport_with_adc(): def test_security_center_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SecurityCenterClient() adc.assert_called_once_with( scopes=None, @@ -12248,7 +12237,7 @@ def test_security_center_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -12295,7 +12284,7 @@ def test_security_center_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -12323,7 +12312,7 @@ def test_security_center_transport_create_channel(transport_class, grpc_helpers) ], ) def test_security_center_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -12361,7 +12350,7 @@ def test_security_center_grpc_transport_client_cert_source_for_mtls(transport_cl def test_security_center_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -12373,7 +12362,7 @@ def test_security_center_http_transport_client_cert_source_for_mtls(): def test_security_center_rest_lro_client(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -12398,7 +12387,7 @@ def test_security_center_rest_lro_client(): ) def test_security_center_host_no_port(transport_name): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securitycenter.googleapis.com" ), @@ -12421,7 +12410,7 @@ def test_security_center_host_no_port(transport_name): ) def test_security_center_host_with_port(transport_name): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securitycenter.googleapis.com:8000" ), @@ -12441,8 +12430,8 @@ def test_security_center_host_with_port(transport_name): ], ) def test_security_center_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SecurityCenterClient( credentials=creds1, transport=transport_name, @@ -12557,7 +12546,7 @@ def test_security_center_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -12635,7 +12624,7 @@ def test_security_center_transport_channel_mtls_with_adc(transport_class): def test_security_center_grpc_lro_client(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -12652,7 +12641,7 @@ def test_security_center_grpc_lro_client(): def test_security_center_grpc_lro_async_client(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -12894,7 +12883,7 @@ def test_client_with_default_client_info(): transports.SecurityCenterTransport, "_prep_wrapped_messages" ) as prep: client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -12904,7 +12893,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecurityCenterClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -12913,7 +12902,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -12932,7 +12921,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -12949,7 +12938,7 @@ def test_client_ctx(): ] for transport in transports: client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1p1beta1/test_security_center.py b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1p1beta1/test_security_center.py index 7bb5982aab37..e7930a8d6643 100644 --- a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1p1beta1/test_security_center.py +++ b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1p1beta1/test_security_center.py @@ -113,18 +113,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -351,7 +339,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -378,42 +366,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -424,7 +419,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_security_center_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -476,7 +471,7 @@ def test_security_center_client_service_account_always_use_jwt( ], ) def test_security_center_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -539,9 +534,7 @@ def test_security_center_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(SecurityCenterClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -940,20 +933,20 @@ def test_security_center_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -965,13 +958,11 @@ def test_security_center_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -987,8 +978,7 @@ def test_security_center_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1141,8 +1131,8 @@ def test_security_center_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1171,7 +1161,7 @@ def test_security_center_client_create_channel_credentials_file( ) def test_create_source(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1207,7 +1197,7 @@ def test_create_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1225,7 +1215,7 @@ async def test_create_source_async( request_type=securitycenter_service.CreateSourceRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1266,7 +1256,7 @@ async def test_create_source_async_from_dict(): def test_create_source_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1296,7 +1286,7 @@ def test_create_source_field_headers(): @pytest.mark.asyncio async def test_create_source_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1325,7 +1315,7 @@ async def test_create_source_field_headers_async(): def test_create_source_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1353,7 +1343,7 @@ def test_create_source_flattened(): def test_create_source_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1369,7 +1359,7 @@ def test_create_source_flattened_error(): @pytest.mark.asyncio async def test_create_source_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1400,7 +1390,7 @@ async def test_create_source_flattened_async(): @pytest.mark.asyncio async def test_create_source_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1422,7 +1412,7 @@ async def test_create_source_flattened_error_async(): ) def test_create_finding(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1466,7 +1456,7 @@ def test_create_finding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1484,7 +1474,7 @@ async def test_create_finding_async( request_type=securitycenter_service.CreateFindingRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1533,7 +1523,7 @@ async def test_create_finding_async_from_dict(): def test_create_finding_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1563,7 +1553,7 @@ def test_create_finding_field_headers(): @pytest.mark.asyncio async def test_create_finding_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1592,7 +1582,7 @@ async def test_create_finding_field_headers_async(): def test_create_finding_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1624,7 +1614,7 @@ def test_create_finding_flattened(): def test_create_finding_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1641,7 +1631,7 @@ def test_create_finding_flattened_error(): @pytest.mark.asyncio async def test_create_finding_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1676,7 +1666,7 @@ async def test_create_finding_flattened_async(): @pytest.mark.asyncio async def test_create_finding_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1699,7 +1689,7 @@ async def test_create_finding_flattened_error_async(): ) def test_create_notification_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1742,7 +1732,7 @@ def test_create_notification_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1762,7 +1752,7 @@ async def test_create_notification_config_async( request_type=securitycenter_service.CreateNotificationConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1810,7 +1800,7 @@ async def test_create_notification_config_async_from_dict(): def test_create_notification_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1842,7 +1832,7 @@ def test_create_notification_config_field_headers(): @pytest.mark.asyncio async def test_create_notification_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1875,7 +1865,7 @@ async def test_create_notification_config_field_headers_async(): def test_create_notification_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1911,7 +1901,7 @@ def test_create_notification_config_flattened(): def test_create_notification_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1930,7 +1920,7 @@ def test_create_notification_config_flattened_error(): @pytest.mark.asyncio async def test_create_notification_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1971,7 +1961,7 @@ async def test_create_notification_config_flattened_async(): @pytest.mark.asyncio async def test_create_notification_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1996,7 +1986,7 @@ async def test_create_notification_config_flattened_error_async(): ) def test_delete_notification_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2025,7 +2015,7 @@ def test_delete_notification_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2045,7 +2035,7 @@ async def test_delete_notification_config_async( request_type=securitycenter_service.DeleteNotificationConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2077,7 +2067,7 @@ async def test_delete_notification_config_async_from_dict(): def test_delete_notification_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2109,7 +2099,7 @@ def test_delete_notification_config_field_headers(): @pytest.mark.asyncio async def test_delete_notification_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2140,7 +2130,7 @@ async def test_delete_notification_config_field_headers_async(): def test_delete_notification_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2166,7 +2156,7 @@ def test_delete_notification_config_flattened(): def test_delete_notification_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2181,7 +2171,7 @@ def test_delete_notification_config_flattened_error(): @pytest.mark.asyncio async def test_delete_notification_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2210,7 +2200,7 @@ async def test_delete_notification_config_flattened_async(): @pytest.mark.asyncio async def test_delete_notification_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2231,7 +2221,7 @@ async def test_delete_notification_config_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2263,7 +2253,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2280,7 +2270,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2317,7 +2307,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2347,7 +2337,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2376,7 +2366,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -2393,7 +2383,7 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2417,7 +2407,7 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2432,7 +2422,7 @@ def test_get_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2459,7 +2449,7 @@ async def test_get_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_get_iam_policy_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2480,7 +2470,7 @@ async def test_get_iam_policy_flattened_error_async(): ) def test_get_notification_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2522,7 +2512,7 @@ def test_get_notification_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2542,7 +2532,7 @@ async def test_get_notification_config_async( request_type=securitycenter_service.GetNotificationConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2589,7 +2579,7 @@ async def test_get_notification_config_async_from_dict(): def test_get_notification_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2621,7 +2611,7 @@ def test_get_notification_config_field_headers(): @pytest.mark.asyncio async def test_get_notification_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2654,7 +2644,7 @@ async def test_get_notification_config_field_headers_async(): def test_get_notification_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2680,7 +2670,7 @@ def test_get_notification_config_flattened(): def test_get_notification_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2695,7 +2685,7 @@ def test_get_notification_config_flattened_error(): @pytest.mark.asyncio async def test_get_notification_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2726,7 +2716,7 @@ async def test_get_notification_config_flattened_async(): @pytest.mark.asyncio async def test_get_notification_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2747,7 +2737,7 @@ async def test_get_notification_config_flattened_error_async(): ) def test_get_organization_settings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2781,7 +2771,7 @@ def test_get_organization_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2801,7 +2791,7 @@ async def test_get_organization_settings_async( request_type=securitycenter_service.GetOrganizationSettingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2840,7 +2830,7 @@ async def test_get_organization_settings_async_from_dict(): def test_get_organization_settings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2872,7 +2862,7 @@ def test_get_organization_settings_field_headers(): @pytest.mark.asyncio async def test_get_organization_settings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2905,7 +2895,7 @@ async def test_get_organization_settings_field_headers_async(): def test_get_organization_settings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2931,7 +2921,7 @@ def test_get_organization_settings_flattened(): def test_get_organization_settings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2946,7 +2936,7 @@ def test_get_organization_settings_flattened_error(): @pytest.mark.asyncio async def test_get_organization_settings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2977,7 +2967,7 @@ async def test_get_organization_settings_flattened_async(): @pytest.mark.asyncio async def test_get_organization_settings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2998,7 +2988,7 @@ async def test_get_organization_settings_flattened_error_async(): ) def test_get_source(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3034,7 +3024,7 @@ def test_get_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3052,7 +3042,7 @@ async def test_get_source_async( request_type=securitycenter_service.GetSourceRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3093,7 +3083,7 @@ async def test_get_source_async_from_dict(): def test_get_source_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3123,7 +3113,7 @@ def test_get_source_field_headers(): @pytest.mark.asyncio async def test_get_source_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3152,7 +3142,7 @@ async def test_get_source_field_headers_async(): def test_get_source_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3176,7 +3166,7 @@ def test_get_source_flattened(): def test_get_source_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3191,7 +3181,7 @@ def test_get_source_flattened_error(): @pytest.mark.asyncio async def test_get_source_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3218,7 +3208,7 @@ async def test_get_source_flattened_async(): @pytest.mark.asyncio async def test_get_source_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3239,7 +3229,7 @@ async def test_get_source_flattened_error_async(): ) def test_group_assets(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3271,7 +3261,7 @@ def test_group_assets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3289,7 +3279,7 @@ async def test_group_assets_async( request_type=securitycenter_service.GroupAssetsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3326,7 +3316,7 @@ async def test_group_assets_async_from_dict(): def test_group_assets_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3356,7 +3346,7 @@ def test_group_assets_field_headers(): @pytest.mark.asyncio async def test_group_assets_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3387,7 +3377,7 @@ async def test_group_assets_field_headers_async(): def test_group_assets_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3437,7 +3427,7 @@ def test_group_assets_pager(transport_name: str = "grpc"): def test_group_assets_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3479,7 +3469,7 @@ def test_group_assets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_group_assets_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3529,7 +3519,7 @@ async def test_group_assets_async_pager(): @pytest.mark.asyncio async def test_group_assets_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3584,7 +3574,7 @@ async def test_group_assets_async_pages(): ) def test_group_findings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3616,7 +3606,7 @@ def test_group_findings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3634,7 +3624,7 @@ async def test_group_findings_async( request_type=securitycenter_service.GroupFindingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3671,7 +3661,7 @@ async def test_group_findings_async_from_dict(): def test_group_findings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3701,7 +3691,7 @@ def test_group_findings_field_headers(): @pytest.mark.asyncio async def test_group_findings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3732,7 +3722,7 @@ async def test_group_findings_field_headers_async(): def test_group_findings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3760,7 +3750,7 @@ def test_group_findings_flattened(): def test_group_findings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3776,7 +3766,7 @@ def test_group_findings_flattened_error(): @pytest.mark.asyncio async def test_group_findings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3809,7 +3799,7 @@ async def test_group_findings_flattened_async(): @pytest.mark.asyncio async def test_group_findings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3824,7 +3814,7 @@ async def test_group_findings_flattened_error_async(): def test_group_findings_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3874,7 +3864,7 @@ def test_group_findings_pager(transport_name: str = "grpc"): def test_group_findings_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3916,7 +3906,7 @@ def test_group_findings_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_group_findings_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3966,7 +3956,7 @@ async def test_group_findings_async_pager(): @pytest.mark.asyncio async def test_group_findings_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4021,7 +4011,7 @@ async def test_group_findings_async_pages(): ) def test_list_assets(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4053,7 +4043,7 @@ def test_list_assets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4071,7 +4061,7 @@ async def test_list_assets_async( request_type=securitycenter_service.ListAssetsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4108,7 +4098,7 @@ async def test_list_assets_async_from_dict(): def test_list_assets_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4138,7 +4128,7 @@ def test_list_assets_field_headers(): @pytest.mark.asyncio async def test_list_assets_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4169,7 +4159,7 @@ async def test_list_assets_field_headers_async(): def test_list_assets_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4193,7 +4183,7 @@ def test_list_assets_flattened(): def test_list_assets_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4208,7 +4198,7 @@ def test_list_assets_flattened_error(): @pytest.mark.asyncio async def test_list_assets_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4237,7 +4227,7 @@ async def test_list_assets_flattened_async(): @pytest.mark.asyncio async def test_list_assets_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4251,7 +4241,7 @@ async def test_list_assets_flattened_error_async(): def test_list_assets_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4304,7 +4294,7 @@ def test_list_assets_pager(transport_name: str = "grpc"): def test_list_assets_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4346,7 +4336,7 @@ def test_list_assets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_assets_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4399,7 +4389,7 @@ async def test_list_assets_async_pager(): @pytest.mark.asyncio async def test_list_assets_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4454,7 +4444,7 @@ async def test_list_assets_async_pages(): ) def test_list_findings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4486,7 +4476,7 @@ def test_list_findings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4504,7 +4494,7 @@ async def test_list_findings_async( request_type=securitycenter_service.ListFindingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4541,7 +4531,7 @@ async def test_list_findings_async_from_dict(): def test_list_findings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4571,7 +4561,7 @@ def test_list_findings_field_headers(): @pytest.mark.asyncio async def test_list_findings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4602,7 +4592,7 @@ async def test_list_findings_field_headers_async(): def test_list_findings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4626,7 +4616,7 @@ def test_list_findings_flattened(): def test_list_findings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4641,7 +4631,7 @@ def test_list_findings_flattened_error(): @pytest.mark.asyncio async def test_list_findings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4670,7 +4660,7 @@ async def test_list_findings_flattened_async(): @pytest.mark.asyncio async def test_list_findings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4684,7 +4674,7 @@ async def test_list_findings_flattened_error_async(): def test_list_findings_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4739,7 +4729,7 @@ def test_list_findings_pager(transport_name: str = "grpc"): def test_list_findings_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4781,7 +4771,7 @@ def test_list_findings_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_findings_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4836,7 +4826,7 @@ async def test_list_findings_async_pager(): @pytest.mark.asyncio async def test_list_findings_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4891,7 +4881,7 @@ async def test_list_findings_async_pages(): ) def test_list_notification_configs(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4923,7 +4913,7 @@ def test_list_notification_configs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4943,7 +4933,7 @@ async def test_list_notification_configs_async( request_type=securitycenter_service.ListNotificationConfigsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4980,7 +4970,7 @@ async def test_list_notification_configs_async_from_dict(): def test_list_notification_configs_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5012,7 +5002,7 @@ def test_list_notification_configs_field_headers(): @pytest.mark.asyncio async def test_list_notification_configs_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5045,7 +5035,7 @@ async def test_list_notification_configs_field_headers_async(): def test_list_notification_configs_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5071,7 +5061,7 @@ def test_list_notification_configs_flattened(): def test_list_notification_configs_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5086,7 +5076,7 @@ def test_list_notification_configs_flattened_error(): @pytest.mark.asyncio async def test_list_notification_configs_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5117,7 +5107,7 @@ async def test_list_notification_configs_flattened_async(): @pytest.mark.asyncio async def test_list_notification_configs_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5131,7 +5121,7 @@ async def test_list_notification_configs_flattened_error_async(): def test_list_notification_configs_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -5185,7 +5175,7 @@ def test_list_notification_configs_pager(transport_name: str = "grpc"): def test_list_notification_configs_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -5229,7 +5219,7 @@ def test_list_notification_configs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_notification_configs_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5283,7 +5273,7 @@ async def test_list_notification_configs_async_pager(): @pytest.mark.asyncio async def test_list_notification_configs_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5340,7 +5330,7 @@ async def test_list_notification_configs_async_pages(): ) def test_list_sources(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5370,7 +5360,7 @@ def test_list_sources_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5388,7 +5378,7 @@ async def test_list_sources_async( request_type=securitycenter_service.ListSourcesRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5423,7 +5413,7 @@ async def test_list_sources_async_from_dict(): def test_list_sources_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5453,7 +5443,7 @@ def test_list_sources_field_headers(): @pytest.mark.asyncio async def test_list_sources_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5484,7 +5474,7 @@ async def test_list_sources_field_headers_async(): def test_list_sources_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5508,7 +5498,7 @@ def test_list_sources_flattened(): def test_list_sources_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5523,7 +5513,7 @@ def test_list_sources_flattened_error(): @pytest.mark.asyncio async def test_list_sources_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5552,7 +5542,7 @@ async def test_list_sources_flattened_async(): @pytest.mark.asyncio async def test_list_sources_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5566,7 +5556,7 @@ async def test_list_sources_flattened_error_async(): def test_list_sources_pager(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -5616,7 +5606,7 @@ def test_list_sources_pager(transport_name: str = "grpc"): def test_list_sources_pages(transport_name: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -5658,7 +5648,7 @@ def test_list_sources_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_sources_async_pager(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5708,7 +5698,7 @@ async def test_list_sources_async_pager(): @pytest.mark.asyncio async def test_list_sources_async_pages(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5763,7 +5753,7 @@ async def test_list_sources_async_pages(): ) def test_run_asset_discovery(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5792,7 +5782,7 @@ def test_run_asset_discovery_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5812,7 +5802,7 @@ async def test_run_asset_discovery_async( request_type=securitycenter_service.RunAssetDiscoveryRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5846,7 +5836,7 @@ async def test_run_asset_discovery_async_from_dict(): def test_run_asset_discovery_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5878,7 +5868,7 @@ def test_run_asset_discovery_field_headers(): @pytest.mark.asyncio async def test_run_asset_discovery_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5911,7 +5901,7 @@ async def test_run_asset_discovery_field_headers_async(): def test_run_asset_discovery_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5937,7 +5927,7 @@ def test_run_asset_discovery_flattened(): def test_run_asset_discovery_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5952,7 +5942,7 @@ def test_run_asset_discovery_flattened_error(): @pytest.mark.asyncio async def test_run_asset_discovery_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5983,7 +5973,7 @@ async def test_run_asset_discovery_flattened_async(): @pytest.mark.asyncio async def test_run_asset_discovery_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6004,7 +5994,7 @@ async def test_run_asset_discovery_flattened_error_async(): ) def test_set_finding_state(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6050,7 +6040,7 @@ def test_set_finding_state_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6070,7 +6060,7 @@ async def test_set_finding_state_async( request_type=securitycenter_service.SetFindingStateRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6121,7 +6111,7 @@ async def test_set_finding_state_async_from_dict(): def test_set_finding_state_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6153,7 +6143,7 @@ def test_set_finding_state_field_headers(): @pytest.mark.asyncio async def test_set_finding_state_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6184,7 +6174,7 @@ async def test_set_finding_state_field_headers_async(): def test_set_finding_state_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6218,7 +6208,7 @@ def test_set_finding_state_flattened(): def test_set_finding_state_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6235,7 +6225,7 @@ def test_set_finding_state_flattened_error(): @pytest.mark.asyncio async def test_set_finding_state_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6272,7 +6262,7 @@ async def test_set_finding_state_flattened_async(): @pytest.mark.asyncio async def test_set_finding_state_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6295,7 +6285,7 @@ async def test_set_finding_state_flattened_error_async(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6327,7 +6317,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6344,7 +6334,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6381,7 +6371,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6411,7 +6401,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6440,7 +6430,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -6458,7 +6448,7 @@ def test_set_iam_policy_from_dict_foreign(): def test_set_iam_policy_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6482,7 +6472,7 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6497,7 +6487,7 @@ def test_set_iam_policy_flattened_error(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6524,7 +6514,7 @@ async def test_set_iam_policy_flattened_async(): @pytest.mark.asyncio async def test_set_iam_policy_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6545,7 +6535,7 @@ async def test_set_iam_policy_flattened_error_async(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6577,7 +6567,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6597,7 +6587,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6634,7 +6624,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6666,7 +6656,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6699,7 +6689,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6718,7 +6708,7 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6748,7 +6738,7 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6764,7 +6754,7 @@ def test_test_iam_permissions_flattened_error(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6799,7 +6789,7 @@ async def test_test_iam_permissions_flattened_async(): @pytest.mark.asyncio async def test_test_iam_permissions_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6821,7 +6811,7 @@ async def test_test_iam_permissions_flattened_error_async(): ) def test_update_finding(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6865,7 +6855,7 @@ def test_update_finding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6883,7 +6873,7 @@ async def test_update_finding_async( request_type=securitycenter_service.UpdateFindingRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6932,7 +6922,7 @@ async def test_update_finding_async_from_dict(): def test_update_finding_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6962,7 +6952,7 @@ def test_update_finding_field_headers(): @pytest.mark.asyncio async def test_update_finding_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6991,7 +6981,7 @@ async def test_update_finding_field_headers_async(): def test_update_finding_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7019,7 +7009,7 @@ def test_update_finding_flattened(): def test_update_finding_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7035,7 +7025,7 @@ def test_update_finding_flattened_error(): @pytest.mark.asyncio async def test_update_finding_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7066,7 +7056,7 @@ async def test_update_finding_flattened_async(): @pytest.mark.asyncio async def test_update_finding_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7088,7 +7078,7 @@ async def test_update_finding_flattened_error_async(): ) def test_update_notification_config(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7131,7 +7121,7 @@ def test_update_notification_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7151,7 +7141,7 @@ async def test_update_notification_config_async( request_type=securitycenter_service.UpdateNotificationConfigRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7199,7 +7189,7 @@ async def test_update_notification_config_async_from_dict(): def test_update_notification_config_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7231,7 +7221,7 @@ def test_update_notification_config_field_headers(): @pytest.mark.asyncio async def test_update_notification_config_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7264,7 +7254,7 @@ async def test_update_notification_config_field_headers_async(): def test_update_notification_config_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7296,7 +7286,7 @@ def test_update_notification_config_flattened(): def test_update_notification_config_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7314,7 +7304,7 @@ def test_update_notification_config_flattened_error(): @pytest.mark.asyncio async def test_update_notification_config_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7351,7 +7341,7 @@ async def test_update_notification_config_flattened_async(): @pytest.mark.asyncio async def test_update_notification_config_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7375,7 +7365,7 @@ async def test_update_notification_config_flattened_error_async(): ) def test_update_organization_settings(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7409,7 +7399,7 @@ def test_update_organization_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7429,7 +7419,7 @@ async def test_update_organization_settings_async( request_type=securitycenter_service.UpdateOrganizationSettingsRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7468,7 +7458,7 @@ async def test_update_organization_settings_async_from_dict(): def test_update_organization_settings_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7500,7 +7490,7 @@ def test_update_organization_settings_field_headers(): @pytest.mark.asyncio async def test_update_organization_settings_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7533,7 +7523,7 @@ async def test_update_organization_settings_field_headers_async(): def test_update_organization_settings_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7561,7 +7551,7 @@ def test_update_organization_settings_flattened(): def test_update_organization_settings_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7578,7 +7568,7 @@ def test_update_organization_settings_flattened_error(): @pytest.mark.asyncio async def test_update_organization_settings_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7611,7 +7601,7 @@ async def test_update_organization_settings_flattened_async(): @pytest.mark.asyncio async def test_update_organization_settings_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7634,7 +7624,7 @@ async def test_update_organization_settings_flattened_error_async(): ) def test_update_source(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7670,7 +7660,7 @@ def test_update_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7688,7 +7678,7 @@ async def test_update_source_async( request_type=securitycenter_service.UpdateSourceRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7729,7 +7719,7 @@ async def test_update_source_async_from_dict(): def test_update_source_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7759,7 +7749,7 @@ def test_update_source_field_headers(): @pytest.mark.asyncio async def test_update_source_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7788,7 +7778,7 @@ async def test_update_source_field_headers_async(): def test_update_source_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7816,7 +7806,7 @@ def test_update_source_flattened(): def test_update_source_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7832,7 +7822,7 @@ def test_update_source_flattened_error(): @pytest.mark.asyncio async def test_update_source_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7863,7 +7853,7 @@ async def test_update_source_flattened_async(): @pytest.mark.asyncio async def test_update_source_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7885,7 +7875,7 @@ async def test_update_source_flattened_error_async(): ) def test_update_security_marks(request_type, transport: str = "grpc"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7919,7 +7909,7 @@ def test_update_security_marks_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7939,7 +7929,7 @@ async def test_update_security_marks_async( request_type=securitycenter_service.UpdateSecurityMarksRequest, ): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7978,7 +7968,7 @@ async def test_update_security_marks_async_from_dict(): def test_update_security_marks_field_headers(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8010,7 +8000,7 @@ def test_update_security_marks_field_headers(): @pytest.mark.asyncio async def test_update_security_marks_field_headers_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8043,7 +8033,7 @@ async def test_update_security_marks_field_headers_async(): def test_update_security_marks_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8073,7 +8063,7 @@ def test_update_security_marks_flattened(): def test_update_security_marks_flattened_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -8089,7 +8079,7 @@ def test_update_security_marks_flattened_error(): @pytest.mark.asyncio async def test_update_security_marks_flattened_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -8124,7 +8114,7 @@ async def test_update_security_marks_flattened_async(): @pytest.mark.asyncio async def test_update_security_marks_flattened_error_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -8146,7 +8136,7 @@ async def test_update_security_marks_flattened_error_async(): ) def test_create_source_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8276,7 +8266,7 @@ def test_create_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8285,7 +8275,7 @@ def test_create_source_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8294,7 +8284,7 @@ def test_create_source_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8337,7 +8327,7 @@ def test_create_source_rest_required_fields( def test_create_source_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_source._get_unset_required_fields({}) @@ -8355,7 +8345,7 @@ def test_create_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_source_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -8411,7 +8401,7 @@ def test_create_source_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.CreateSourceRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8433,7 +8423,7 @@ def test_create_source_rest_bad_request( def test_create_source_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8475,7 +8465,7 @@ def test_create_source_rest_flattened(): def test_create_source_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8491,7 +8481,7 @@ def test_create_source_rest_flattened_error(transport: str = "rest"): def test_create_source_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8504,7 +8494,7 @@ def test_create_source_rest_error(): ) def test_create_finding_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8656,7 +8646,7 @@ def test_create_finding_rest_required_fields( assert "findingId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_finding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8668,7 +8658,7 @@ def test_create_finding_rest_required_fields( jsonified_request["findingId"] = "finding_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_finding._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("finding_id",)) @@ -8681,7 +8671,7 @@ def test_create_finding_rest_required_fields( assert jsonified_request["findingId"] == "finding_id_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8730,7 +8720,7 @@ def test_create_finding_rest_required_fields( def test_create_finding_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_finding._get_unset_required_fields({}) @@ -8749,7 +8739,7 @@ def test_create_finding_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_finding_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -8805,7 +8795,7 @@ def test_create_finding_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.CreateFindingRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8827,7 +8817,7 @@ def test_create_finding_rest_bad_request( def test_create_finding_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8871,7 +8861,7 @@ def test_create_finding_rest_flattened(): def test_create_finding_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8888,7 +8878,7 @@ def test_create_finding_rest_flattened_error(transport: str = "rest"): def test_create_finding_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8901,7 +8891,7 @@ def test_create_finding_rest_error(): ) def test_create_notification_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9042,7 +9032,7 @@ def test_create_notification_config_rest_required_fields( assert "configId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9054,7 +9044,7 @@ def test_create_notification_config_rest_required_fields( jsonified_request["configId"] = "config_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_notification_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("config_id",)) @@ -9067,7 +9057,7 @@ def test_create_notification_config_rest_required_fields( assert jsonified_request["configId"] == "config_id_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9116,7 +9106,7 @@ def test_create_notification_config_rest_required_fields( def test_create_notification_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_notification_config._get_unset_required_fields({}) @@ -9135,7 +9125,7 @@ def test_create_notification_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_notification_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -9194,7 +9184,7 @@ def test_create_notification_config_rest_bad_request( request_type=securitycenter_service.CreateNotificationConfigRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9216,7 +9206,7 @@ def test_create_notification_config_rest_bad_request( def test_create_notification_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9262,7 +9252,7 @@ def test_create_notification_config_rest_flattened(): def test_create_notification_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9281,7 +9271,7 @@ def test_create_notification_config_rest_flattened_error(transport: str = "rest" def test_create_notification_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9294,7 +9284,7 @@ def test_create_notification_config_rest_error(): ) def test_delete_notification_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9340,7 +9330,7 @@ def test_delete_notification_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9349,7 +9339,7 @@ def test_delete_notification_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9358,7 +9348,7 @@ def test_delete_notification_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9397,7 +9387,7 @@ def test_delete_notification_config_rest_required_fields( def test_delete_notification_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_notification_config._get_unset_required_fields({}) @@ -9407,7 +9397,7 @@ def test_delete_notification_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_notification_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -9458,7 +9448,7 @@ def test_delete_notification_config_rest_bad_request( request_type=securitycenter_service.DeleteNotificationConfigRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9480,7 +9470,7 @@ def test_delete_notification_config_rest_bad_request( def test_delete_notification_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9520,7 +9510,7 @@ def test_delete_notification_config_rest_flattened(): def test_delete_notification_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9535,7 +9525,7 @@ def test_delete_notification_config_rest_flattened_error(transport: str = "rest" def test_delete_notification_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9548,7 +9538,7 @@ def test_delete_notification_config_rest_error(): ) def test_get_iam_policy_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9599,7 +9589,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9608,7 +9598,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9617,7 +9607,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9658,7 +9648,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -9668,7 +9658,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -9722,7 +9712,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9744,7 +9734,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9784,7 +9774,7 @@ def test_get_iam_policy_rest_flattened(): def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9799,7 +9789,7 @@ def test_get_iam_policy_rest_flattened_error(transport: str = "rest"): def test_get_iam_policy_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9812,7 +9802,7 @@ def test_get_iam_policy_rest_error(): ) def test_get_notification_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9873,7 +9863,7 @@ def test_get_notification_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9882,7 +9872,7 @@ def test_get_notification_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9891,7 +9881,7 @@ def test_get_notification_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9933,7 +9923,7 @@ def test_get_notification_config_rest_required_fields( def test_get_notification_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_notification_config._get_unset_required_fields({}) @@ -9943,7 +9933,7 @@ def test_get_notification_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_notification_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -10002,7 +9992,7 @@ def test_get_notification_config_rest_bad_request( request_type=securitycenter_service.GetNotificationConfigRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10024,7 +10014,7 @@ def test_get_notification_config_rest_bad_request( def test_get_notification_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10066,7 +10056,7 @@ def test_get_notification_config_rest_flattened(): def test_get_notification_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10081,7 +10071,7 @@ def test_get_notification_config_rest_flattened_error(transport: str = "rest"): def test_get_notification_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10094,7 +10084,7 @@ def test_get_notification_config_rest_error(): ) def test_get_organization_settings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10147,7 +10137,7 @@ def test_get_organization_settings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10156,7 +10146,7 @@ def test_get_organization_settings_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10165,7 +10155,7 @@ def test_get_organization_settings_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10207,7 +10197,7 @@ def test_get_organization_settings_rest_required_fields( def test_get_organization_settings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_organization_settings._get_unset_required_fields({}) @@ -10217,7 +10207,7 @@ def test_get_organization_settings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_organization_settings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -10276,7 +10266,7 @@ def test_get_organization_settings_rest_bad_request( request_type=securitycenter_service.GetOrganizationSettingsRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10298,7 +10288,7 @@ def test_get_organization_settings_rest_bad_request( def test_get_organization_settings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10340,7 +10330,7 @@ def test_get_organization_settings_rest_flattened(): def test_get_organization_settings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10355,7 +10345,7 @@ def test_get_organization_settings_rest_flattened_error(transport: str = "rest") def test_get_organization_settings_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10368,7 +10358,7 @@ def test_get_organization_settings_rest_error(): ) def test_get_source_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10425,7 +10415,7 @@ def test_get_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10434,7 +10424,7 @@ def test_get_source_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10443,7 +10433,7 @@ def test_get_source_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10485,7 +10475,7 @@ def test_get_source_rest_required_fields( def test_get_source_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_source._get_unset_required_fields({}) @@ -10495,7 +10485,7 @@ def test_get_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_source_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -10551,7 +10541,7 @@ def test_get_source_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GetSourceRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10573,7 +10563,7 @@ def test_get_source_rest_bad_request( def test_get_source_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10614,7 +10604,7 @@ def test_get_source_rest_flattened(): def test_get_source_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10629,7 +10619,7 @@ def test_get_source_rest_flattened_error(transport: str = "rest"): def test_get_source_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10642,7 +10632,7 @@ def test_get_source_rest_error(): ) def test_group_assets_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10696,7 +10686,7 @@ def test_group_assets_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_assets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10706,7 +10696,7 @@ def test_group_assets_rest_required_fields( jsonified_request["groupBy"] = "group_by_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_assets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10717,7 +10707,7 @@ def test_group_assets_rest_required_fields( assert jsonified_request["groupBy"] == "group_by_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10760,7 +10750,7 @@ def test_group_assets_rest_required_fields( def test_group_assets_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.group_assets._get_unset_required_fields({}) @@ -10778,7 +10768,7 @@ def test_group_assets_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_group_assets_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -10836,7 +10826,7 @@ def test_group_assets_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GroupAssetsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10858,7 +10848,7 @@ def test_group_assets_rest_bad_request( def test_group_assets_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10928,7 +10918,7 @@ def test_group_assets_rest_pager(transport: str = "rest"): ) def test_group_findings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10982,7 +10972,7 @@ def test_group_findings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10992,7 +10982,7 @@ def test_group_findings_rest_required_fields( jsonified_request["groupBy"] = "group_by_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).group_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11003,7 +10993,7 @@ def test_group_findings_rest_required_fields( assert jsonified_request["groupBy"] == "group_by_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11046,7 +11036,7 @@ def test_group_findings_rest_required_fields( def test_group_findings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.group_findings._get_unset_required_fields({}) @@ -11064,7 +11054,7 @@ def test_group_findings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_group_findings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -11124,7 +11114,7 @@ def test_group_findings_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.GroupFindingsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11146,7 +11136,7 @@ def test_group_findings_rest_bad_request( def test_group_findings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11189,7 +11179,7 @@ def test_group_findings_rest_flattened(): def test_group_findings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11205,7 +11195,7 @@ def test_group_findings_rest_flattened_error(transport: str = "rest"): def test_group_findings_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11275,7 +11265,7 @@ def test_group_findings_rest_pager(transport: str = "rest"): ) def test_list_assets_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11328,7 +11318,7 @@ def test_list_assets_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_assets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11337,7 +11327,7 @@ def test_list_assets_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_assets._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -11358,7 +11348,7 @@ def test_list_assets_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11400,7 +11390,7 @@ def test_list_assets_rest_required_fields( def test_list_assets_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_assets._get_unset_required_fields({}) @@ -11423,7 +11413,7 @@ def test_list_assets_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_assets_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -11481,7 +11471,7 @@ def test_list_assets_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListAssetsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11503,7 +11493,7 @@ def test_list_assets_rest_bad_request( def test_list_assets_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11544,7 +11534,7 @@ def test_list_assets_rest_flattened(): def test_list_assets_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11559,7 +11549,7 @@ def test_list_assets_rest_flattened_error(transport: str = "rest"): def test_list_assets_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11632,7 +11622,7 @@ def test_list_assets_rest_pager(transport: str = "rest"): ) def test_list_findings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11685,7 +11675,7 @@ def test_list_findings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_findings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11694,7 +11684,7 @@ def test_list_findings_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_findings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -11715,7 +11705,7 @@ def test_list_findings_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11757,7 +11747,7 @@ def test_list_findings_rest_required_fields( def test_list_findings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_findings._get_unset_required_fields({}) @@ -11780,7 +11770,7 @@ def test_list_findings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_findings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -11838,7 +11828,7 @@ def test_list_findings_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListFindingsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11860,7 +11850,7 @@ def test_list_findings_rest_bad_request( def test_list_findings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11902,7 +11892,7 @@ def test_list_findings_rest_flattened(): def test_list_findings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11917,7 +11907,7 @@ def test_list_findings_rest_flattened_error(transport: str = "rest"): def test_list_findings_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11992,7 +11982,7 @@ def test_list_findings_rest_pager(transport: str = "rest"): ) def test_list_notification_configs_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12045,7 +12035,7 @@ def test_list_notification_configs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_notification_configs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -12054,7 +12044,7 @@ def test_list_notification_configs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_notification_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -12070,7 +12060,7 @@ def test_list_notification_configs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -12114,7 +12104,7 @@ def test_list_notification_configs_rest_required_fields( def test_list_notification_configs_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_notification_configs._get_unset_required_fields({}) @@ -12132,7 +12122,7 @@ def test_list_notification_configs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_notification_configs_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -12193,7 +12183,7 @@ def test_list_notification_configs_rest_bad_request( request_type=securitycenter_service.ListNotificationConfigsRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12215,7 +12205,7 @@ def test_list_notification_configs_rest_bad_request( def test_list_notification_configs_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12259,7 +12249,7 @@ def test_list_notification_configs_rest_flattened(): def test_list_notification_configs_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12274,7 +12264,7 @@ def test_list_notification_configs_rest_flattened_error(transport: str = "rest") def test_list_notification_configs_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12347,7 +12337,7 @@ def test_list_notification_configs_rest_pager(transport: str = "rest"): ) def test_list_sources_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12398,7 +12388,7 @@ def test_list_sources_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_sources._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -12407,7 +12397,7 @@ def test_list_sources_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_sources._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -12423,7 +12413,7 @@ def test_list_sources_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -12465,7 +12455,7 @@ def test_list_sources_rest_required_fields( def test_list_sources_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_sources._get_unset_required_fields({}) @@ -12483,7 +12473,7 @@ def test_list_sources_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_sources_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -12541,7 +12531,7 @@ def test_list_sources_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.ListSourcesRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12563,7 +12553,7 @@ def test_list_sources_rest_bad_request( def test_list_sources_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12604,7 +12594,7 @@ def test_list_sources_rest_flattened(): def test_list_sources_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12619,7 +12609,7 @@ def test_list_sources_rest_flattened_error(transport: str = "rest"): def test_list_sources_rest_pager(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12689,7 +12679,7 @@ def test_list_sources_rest_pager(transport: str = "rest"): ) def test_run_asset_discovery_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12735,7 +12725,7 @@ def test_run_asset_discovery_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_asset_discovery._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -12744,7 +12734,7 @@ def test_run_asset_discovery_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_asset_discovery._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -12753,7 +12743,7 @@ def test_run_asset_discovery_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -12793,7 +12783,7 @@ def test_run_asset_discovery_rest_required_fields( def test_run_asset_discovery_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.run_asset_discovery._get_unset_required_fields({}) @@ -12803,7 +12793,7 @@ def test_run_asset_discovery_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_run_asset_discovery_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -12864,7 +12854,7 @@ def test_run_asset_discovery_rest_bad_request( request_type=securitycenter_service.RunAssetDiscoveryRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12886,7 +12876,7 @@ def test_run_asset_discovery_rest_bad_request( def test_run_asset_discovery_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12926,7 +12916,7 @@ def test_run_asset_discovery_rest_flattened(): def test_run_asset_discovery_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12941,7 +12931,7 @@ def test_run_asset_discovery_rest_flattened_error(transport: str = "rest"): def test_run_asset_discovery_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -12954,7 +12944,7 @@ def test_run_asset_discovery_rest_error(): ) def test_set_finding_state_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13019,7 +13009,7 @@ def test_set_finding_state_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_finding_state._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -13028,7 +13018,7 @@ def test_set_finding_state_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_finding_state._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -13037,7 +13027,7 @@ def test_set_finding_state_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -13080,7 +13070,7 @@ def test_set_finding_state_rest_required_fields( def test_set_finding_state_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_finding_state._get_unset_required_fields({}) @@ -13099,7 +13089,7 @@ def test_set_finding_state_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_finding_state_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -13155,7 +13145,7 @@ def test_set_finding_state_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.SetFindingStateRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13177,7 +13167,7 @@ def test_set_finding_state_rest_bad_request( def test_set_finding_state_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13223,7 +13213,7 @@ def test_set_finding_state_rest_flattened(): def test_set_finding_state_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13240,7 +13230,7 @@ def test_set_finding_state_rest_flattened_error(transport: str = "rest"): def test_set_finding_state_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -13253,7 +13243,7 @@ def test_set_finding_state_rest_error(): ) def test_set_iam_policy_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13304,7 +13294,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -13313,7 +13303,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -13322,7 +13312,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -13363,7 +13353,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -13381,7 +13371,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -13435,7 +13425,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13457,7 +13447,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13497,7 +13487,7 @@ def test_set_iam_policy_rest_flattened(): def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13512,7 +13502,7 @@ def test_set_iam_policy_rest_flattened_error(transport: str = "rest"): def test_set_iam_policy_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -13525,7 +13515,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13575,7 +13565,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -13585,7 +13575,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -13596,7 +13586,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -13637,7 +13627,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -13655,7 +13645,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -13711,7 +13701,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13733,7 +13723,7 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13774,7 +13764,7 @@ def test_test_iam_permissions_rest_flattened(): def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13790,7 +13780,7 @@ def test_test_iam_permissions_rest_flattened_error(transport: str = "rest"): def test_test_iam_permissions_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -13803,7 +13793,7 @@ def test_test_iam_permissions_rest_error(): ) def test_update_finding_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13954,14 +13944,14 @@ def test_update_finding_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_finding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_finding._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -13970,7 +13960,7 @@ def test_update_finding_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -14013,7 +14003,7 @@ def test_update_finding_rest_required_fields( def test_update_finding_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_finding._get_unset_required_fields({}) @@ -14023,7 +14013,7 @@ def test_update_finding_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_finding_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -14079,7 +14069,7 @@ def test_update_finding_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.UpdateFindingRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14103,7 +14093,7 @@ def test_update_finding_rest_bad_request( def test_update_finding_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -14150,7 +14140,7 @@ def test_update_finding_rest_flattened(): def test_update_finding_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14166,7 +14156,7 @@ def test_update_finding_rest_flattened_error(transport: str = "rest"): def test_update_finding_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -14179,7 +14169,7 @@ def test_update_finding_rest_error(): ) def test_update_notification_config_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -14321,14 +14311,14 @@ def test_update_notification_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_notification_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_notification_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -14337,7 +14327,7 @@ def test_update_notification_config_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -14380,7 +14370,7 @@ def test_update_notification_config_rest_required_fields( def test_update_notification_config_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_notification_config._get_unset_required_fields({}) @@ -14390,7 +14380,7 @@ def test_update_notification_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_notification_config_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -14449,7 +14439,7 @@ def test_update_notification_config_rest_bad_request( request_type=securitycenter_service.UpdateNotificationConfigRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14475,7 +14465,7 @@ def test_update_notification_config_rest_bad_request( def test_update_notification_config_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -14524,7 +14514,7 @@ def test_update_notification_config_rest_flattened(): def test_update_notification_config_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14542,7 +14532,7 @@ def test_update_notification_config_rest_flattened_error(transport: str = "rest" def test_update_notification_config_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -14555,7 +14545,7 @@ def test_update_notification_config_rest_error(): ) def test_update_organization_settings_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -14689,14 +14679,14 @@ def test_update_organization_settings_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_organization_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_organization_settings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -14705,7 +14695,7 @@ def test_update_organization_settings_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -14750,7 +14740,7 @@ def test_update_organization_settings_rest_required_fields( def test_update_organization_settings_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_organization_settings._get_unset_required_fields({}) @@ -14760,7 +14750,7 @@ def test_update_organization_settings_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_organization_settings_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -14821,7 +14811,7 @@ def test_update_organization_settings_rest_bad_request( request_type=securitycenter_service.UpdateOrganizationSettingsRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14845,7 +14835,7 @@ def test_update_organization_settings_rest_bad_request( def test_update_organization_settings_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -14893,7 +14883,7 @@ def test_update_organization_settings_rest_flattened(): def test_update_organization_settings_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14910,7 +14900,7 @@ def test_update_organization_settings_rest_flattened_error(transport: str = "res def test_update_organization_settings_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -14923,7 +14913,7 @@ def test_update_organization_settings_rest_error(): ) def test_update_source_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -15052,14 +15042,14 @@ def test_update_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_source._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -15068,7 +15058,7 @@ def test_update_source_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -15111,7 +15101,7 @@ def test_update_source_rest_required_fields( def test_update_source_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_source._get_unset_required_fields({}) @@ -15121,7 +15111,7 @@ def test_update_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_source_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -15177,7 +15167,7 @@ def test_update_source_rest_bad_request( transport: str = "rest", request_type=securitycenter_service.UpdateSourceRequest ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15199,7 +15189,7 @@ def test_update_source_rest_bad_request( def test_update_source_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -15242,7 +15232,7 @@ def test_update_source_rest_flattened(): def test_update_source_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15258,7 +15248,7 @@ def test_update_source_rest_flattened_error(transport: str = "rest"): def test_update_source_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -15271,7 +15261,7 @@ def test_update_source_rest_error(): ) def test_update_security_marks_rest(request_type): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -15399,14 +15389,14 @@ def test_update_security_marks_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_marks._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_marks._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -15420,7 +15410,7 @@ def test_update_security_marks_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -15463,7 +15453,7 @@ def test_update_security_marks_rest_required_fields( def test_update_security_marks_rest_unset_required_fields(): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_security_marks._get_unset_required_fields({}) @@ -15481,7 +15471,7 @@ def test_update_security_marks_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_security_marks_rest_interceptors(null_interceptor): transport = transports.SecurityCenterRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterRestInterceptor(), @@ -15540,7 +15530,7 @@ def test_update_security_marks_rest_bad_request( request_type=securitycenter_service.UpdateSecurityMarksRequest, ): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15564,7 +15554,7 @@ def test_update_security_marks_rest_bad_request( def test_update_security_marks_rest_flattened(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -15611,7 +15601,7 @@ def test_update_security_marks_rest_flattened(): def test_update_security_marks_rest_flattened_error(transport: str = "rest"): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15627,24 +15617,24 @@ def test_update_security_marks_rest_flattened_error(transport: str = "rest"): def test_update_security_marks_rest_error(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterClient( @@ -15654,7 +15644,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -15669,13 +15659,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SecurityCenterClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterClient( @@ -15687,7 +15676,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SecurityCenterClient(transport=transport) assert client.transport is transport @@ -15696,13 +15685,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SecurityCenterGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SecurityCenterGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -15719,7 +15708,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -15733,7 +15722,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SecurityCenterClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -15741,7 +15730,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -15753,7 +15742,7 @@ def test_security_center_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SecurityCenterTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -15765,7 +15754,7 @@ def test_security_center_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SecurityCenterTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -15824,7 +15813,7 @@ def test_security_center_base_transport_with_credentials_file(): "google.cloud.securitycenter_v1p1beta1.services.security_center.transports.SecurityCenterTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecurityCenterTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -15843,7 +15832,7 @@ def test_security_center_base_transport_with_adc(): "google.cloud.securitycenter_v1p1beta1.services.security_center.transports.SecurityCenterTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecurityCenterTransport() adc.assert_called_once() @@ -15851,7 +15840,7 @@ def test_security_center_base_transport_with_adc(): def test_security_center_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SecurityCenterClient() adc.assert_called_once_with( scopes=None, @@ -15871,7 +15860,7 @@ def test_security_center_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -15918,7 +15907,7 @@ def test_security_center_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -15946,7 +15935,7 @@ def test_security_center_transport_create_channel(transport_class, grpc_helpers) ], ) def test_security_center_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -15984,7 +15973,7 @@ def test_security_center_grpc_transport_client_cert_source_for_mtls(transport_cl def test_security_center_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -15996,7 +15985,7 @@ def test_security_center_http_transport_client_cert_source_for_mtls(): def test_security_center_rest_lro_client(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -16021,7 +16010,7 @@ def test_security_center_rest_lro_client(): ) def test_security_center_host_no_port(transport_name): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securitycenter.googleapis.com" ), @@ -16044,7 +16033,7 @@ def test_security_center_host_no_port(transport_name): ) def test_security_center_host_with_port(transport_name): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securitycenter.googleapis.com:8000" ), @@ -16064,8 +16053,8 @@ def test_security_center_host_with_port(transport_name): ], ) def test_security_center_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SecurityCenterClient( credentials=creds1, transport=transport_name, @@ -16195,7 +16184,7 @@ def test_security_center_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -16273,7 +16262,7 @@ def test_security_center_transport_channel_mtls_with_adc(transport_class): def test_security_center_grpc_lro_client(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -16290,7 +16279,7 @@ def test_security_center_grpc_lro_client(): def test_security_center_grpc_lro_async_client(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -16582,7 +16571,7 @@ def test_client_with_default_client_info(): transports.SecurityCenterTransport, "_prep_wrapped_messages" ) as prep: client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -16592,7 +16581,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecurityCenterClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -16601,7 +16590,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SecurityCenterAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -16620,7 +16609,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -16637,7 +16626,7 @@ def test_client_ctx(): ] for transport in transports: client = SecurityCenterClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement/gapic_version.py b/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement/gapic_version.py index 286ce4ad5531..360a0d13ebdd 100644 --- a/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement/gapic_version.py +++ b/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.4" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement_v1/gapic_version.py b/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement_v1/gapic_version.py index 286ce4ad5531..360a0d13ebdd 100644 --- a/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement_v1/gapic_version.py +++ b/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.4" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement_v1/services/security_center_management/client.py b/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement_v1/services/security_center_management/client.py index 20d85cd37566..48a663fc3e1f 100644 --- a/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement_v1/services/security_center_management/client.py +++ b/packages/google-cloud-securitycentermanagement/google/cloud/securitycentermanagement_v1/services/security_center_management/client.py @@ -483,6 +483,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -501,6 +502,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -577,17 +579,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SecurityCenterManagementClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SecurityCenterManagementClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-securitycentermanagement/samples/generated_samples/snippet_metadata_google.cloud.securitycentermanagement.v1.json b/packages/google-cloud-securitycentermanagement/samples/generated_samples/snippet_metadata_google.cloud.securitycentermanagement.v1.json index f298da1d7500..8e50d8fef945 100644 --- a/packages/google-cloud-securitycentermanagement/samples/generated_samples/snippet_metadata_google.cloud.securitycentermanagement.v1.json +++ b/packages/google-cloud-securitycentermanagement/samples/generated_samples/snippet_metadata_google.cloud.securitycentermanagement.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-securitycentermanagement", - "version": "0.1.4" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-securitycentermanagement/setup.py b/packages/google-cloud-securitycentermanagement/setup.py index 49cbebae5963..f44a400790e1 100644 --- a/packages/google-cloud-securitycentermanagement/setup.py +++ b/packages/google-cloud-securitycentermanagement/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", diff --git a/packages/google-cloud-securitycentermanagement/testing/constraints-3.7.txt b/packages/google-cloud-securitycentermanagement/testing/constraints-3.7.txt index 44ffd04543a8..712d45b4c5ea 100644 --- a/packages/google-cloud-securitycentermanagement/testing/constraints-3.7.txt +++ b/packages/google-cloud-securitycentermanagement/testing/constraints-3.7.txt @@ -5,6 +5,7 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 grpc-google-iam-v1==0.12.4 diff --git a/packages/google-cloud-securitycentermanagement/tests/unit/gapic/securitycentermanagement_v1/test_security_center_management.py b/packages/google-cloud-securitycentermanagement/tests/unit/gapic/securitycentermanagement_v1/test_security_center_management.py index 09158420219f..d4b1cc2da937 100644 --- a/packages/google-cloud-securitycentermanagement/tests/unit/gapic/securitycentermanagement_v1/test_security_center_management.py +++ b/packages/google-cloud-securitycentermanagement/tests/unit/gapic/securitycentermanagement_v1/test_security_center_management.py @@ -83,18 +83,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -346,7 +334,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -373,42 +361,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -421,7 +416,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_security_center_management_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -475,7 +470,7 @@ def test_security_center_management_client_service_account_always_use_jwt( def test_security_center_management_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -548,9 +543,7 @@ def test_security_center_management_client_client_options( with mock.patch.object( SecurityCenterManagementClient, "get_transport_class" ) as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -975,20 +968,20 @@ def test_security_center_management_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -1000,13 +993,11 @@ def test_security_center_management_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1022,8 +1013,7 @@ def test_security_center_management_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1189,8 +1179,8 @@ def test_security_center_management_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1221,7 +1211,7 @@ def test_list_effective_security_health_analytics_custom_modules( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1261,7 +1251,7 @@ def test_list_effective_security_health_analytics_custom_modules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1285,7 +1275,7 @@ async def test_list_effective_security_health_analytics_custom_modules_async( request_type=security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1332,7 +1322,7 @@ async def test_list_effective_security_health_analytics_custom_modules_async_fro def test_list_effective_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1369,7 +1359,7 @@ def test_list_effective_security_health_analytics_custom_modules_field_headers() @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1405,7 +1395,7 @@ async def test_list_effective_security_health_analytics_custom_modules_field_hea def test_list_effective_security_health_analytics_custom_modules_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1434,7 +1424,7 @@ def test_list_effective_security_health_analytics_custom_modules_flattened(): def test_list_effective_security_health_analytics_custom_modules_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1449,7 +1439,7 @@ def test_list_effective_security_health_analytics_custom_modules_flattened_error @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1483,7 +1473,7 @@ async def test_list_effective_security_health_analytics_custom_modules_flattened @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1499,7 +1489,7 @@ def test_list_effective_security_health_analytics_custom_modules_pager( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1562,7 +1552,7 @@ def test_list_effective_security_health_analytics_custom_modules_pages( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1611,7 +1601,7 @@ def test_list_effective_security_health_analytics_custom_modules_pages( @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_async_pager(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1671,7 +1661,7 @@ async def test_list_effective_security_health_analytics_custom_modules_async_pag @pytest.mark.asyncio async def test_list_effective_security_health_analytics_custom_modules_async_pages(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1732,7 +1722,7 @@ def test_get_effective_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1778,7 +1768,7 @@ def test_get_effective_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1802,7 +1792,7 @@ async def test_get_effective_security_health_analytics_custom_module_async( request_type=security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1857,7 +1847,7 @@ async def test_get_effective_security_health_analytics_custom_module_async_from_ def test_get_effective_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1894,7 +1884,7 @@ def test_get_effective_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_get_effective_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1930,7 +1920,7 @@ async def test_get_effective_security_health_analytics_custom_module_field_heade def test_get_effective_security_health_analytics_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1959,7 +1949,7 @@ def test_get_effective_security_health_analytics_custom_module_flattened(): def test_get_effective_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1974,7 +1964,7 @@ def test_get_effective_security_health_analytics_custom_module_flattened_error() @pytest.mark.asyncio async def test_get_effective_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2008,7 +1998,7 @@ async def test_get_effective_security_health_analytics_custom_module_flattened_a @pytest.mark.asyncio async def test_get_effective_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2031,7 +2021,7 @@ def test_list_security_health_analytics_custom_modules( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2068,7 +2058,7 @@ def test_list_security_health_analytics_custom_modules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2091,7 +2081,7 @@ async def test_list_security_health_analytics_custom_modules_async( request_type=security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2133,7 +2123,7 @@ async def test_list_security_health_analytics_custom_modules_async_from_dict(): def test_list_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2169,7 +2159,7 @@ def test_list_security_health_analytics_custom_modules_field_headers(): @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2204,7 +2194,7 @@ async def test_list_security_health_analytics_custom_modules_field_headers_async def test_list_security_health_analytics_custom_modules_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2232,7 +2222,7 @@ def test_list_security_health_analytics_custom_modules_flattened(): def test_list_security_health_analytics_custom_modules_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2247,7 +2237,7 @@ def test_list_security_health_analytics_custom_modules_flattened_error(): @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2280,7 +2270,7 @@ async def test_list_security_health_analytics_custom_modules_flattened_async(): @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2296,7 +2286,7 @@ def test_list_security_health_analytics_custom_modules_pager( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2355,7 +2345,7 @@ def test_list_security_health_analytics_custom_modules_pages( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2401,7 +2391,7 @@ def test_list_security_health_analytics_custom_modules_pages( @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_async_pager(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2458,7 +2448,7 @@ async def test_list_security_health_analytics_custom_modules_async_pager(): @pytest.mark.asyncio async def test_list_security_health_analytics_custom_modules_async_pages(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2517,7 +2507,7 @@ def test_list_descendant_security_health_analytics_custom_modules( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2557,7 +2547,7 @@ def test_list_descendant_security_health_analytics_custom_modules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2581,7 +2571,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_async( request_type=security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2630,7 +2620,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_async_fr def test_list_descendant_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2667,7 +2657,7 @@ def test_list_descendant_security_health_analytics_custom_modules_field_headers( @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2703,7 +2693,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_field_he def test_list_descendant_security_health_analytics_custom_modules_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2732,7 +2722,7 @@ def test_list_descendant_security_health_analytics_custom_modules_flattened(): def test_list_descendant_security_health_analytics_custom_modules_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2747,7 +2737,7 @@ def test_list_descendant_security_health_analytics_custom_modules_flattened_erro @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2783,7 +2773,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_flattene @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2799,7 +2789,7 @@ def test_list_descendant_security_health_analytics_custom_modules_pager( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2861,7 +2851,7 @@ def test_list_descendant_security_health_analytics_custom_modules_pages( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2910,7 +2900,7 @@ def test_list_descendant_security_health_analytics_custom_modules_pages( @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_async_pager(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2969,7 +2959,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_async_pa @pytest.mark.asyncio async def test_list_descendant_security_health_analytics_custom_modules_async_pages(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3030,7 +3020,7 @@ def test_get_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3078,7 +3068,7 @@ def test_get_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3101,7 +3091,7 @@ async def test_get_security_health_analytics_custom_module_async( request_type=security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3154,7 +3144,7 @@ async def test_get_security_health_analytics_custom_module_async_from_dict(): def test_get_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3188,7 +3178,7 @@ def test_get_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_get_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3221,7 +3211,7 @@ async def test_get_security_health_analytics_custom_module_field_headers_async() def test_get_security_health_analytics_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3249,7 +3239,7 @@ def test_get_security_health_analytics_custom_module_flattened(): def test_get_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3264,7 +3254,7 @@ def test_get_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_get_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3297,7 +3287,7 @@ async def test_get_security_health_analytics_custom_module_flattened_async(): @pytest.mark.asyncio async def test_get_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3320,7 +3310,7 @@ def test_create_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3369,7 +3359,7 @@ def test_create_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3393,7 +3383,7 @@ async def test_create_security_health_analytics_custom_module_async( request_type=security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3447,7 +3437,7 @@ async def test_create_security_health_analytics_custom_module_async_from_dict(): def test_create_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3484,7 +3474,7 @@ def test_create_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_create_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3520,7 +3510,7 @@ async def test_create_security_health_analytics_custom_module_field_headers_asyn def test_create_security_health_analytics_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3557,7 +3547,7 @@ def test_create_security_health_analytics_custom_module_flattened(): def test_create_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3575,7 +3565,7 @@ def test_create_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_create_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3617,7 +3607,7 @@ async def test_create_security_health_analytics_custom_module_flattened_async(): @pytest.mark.asyncio async def test_create_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3643,7 +3633,7 @@ def test_update_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3692,7 +3682,7 @@ def test_update_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3716,7 +3706,7 @@ async def test_update_security_health_analytics_custom_module_async( request_type=security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3770,7 +3760,7 @@ async def test_update_security_health_analytics_custom_module_async_from_dict(): def test_update_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3807,7 +3797,7 @@ def test_update_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_update_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3843,7 +3833,7 @@ async def test_update_security_health_analytics_custom_module_field_headers_asyn def test_update_security_health_analytics_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3880,7 +3870,7 @@ def test_update_security_health_analytics_custom_module_flattened(): def test_update_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3898,7 +3888,7 @@ def test_update_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_update_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3940,7 +3930,7 @@ async def test_update_security_health_analytics_custom_module_flattened_async(): @pytest.mark.asyncio async def test_update_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3966,7 +3956,7 @@ def test_delete_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3999,7 +3989,7 @@ def test_delete_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4023,7 +4013,7 @@ async def test_delete_security_health_analytics_custom_module_async( request_type=security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4059,7 +4049,7 @@ async def test_delete_security_health_analytics_custom_module_async_from_dict(): def test_delete_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4094,7 +4084,7 @@ def test_delete_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_delete_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4128,7 +4118,7 @@ async def test_delete_security_health_analytics_custom_module_field_headers_asyn def test_delete_security_health_analytics_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4155,7 +4145,7 @@ def test_delete_security_health_analytics_custom_module_flattened(): def test_delete_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4170,7 +4160,7 @@ def test_delete_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_delete_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4200,7 +4190,7 @@ async def test_delete_security_health_analytics_custom_module_flattened_async(): @pytest.mark.asyncio async def test_delete_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4223,7 +4213,7 @@ def test_simulate_security_health_analytics_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4261,7 +4251,7 @@ def test_simulate_security_health_analytics_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4285,7 +4275,7 @@ async def test_simulate_security_health_analytics_custom_module_async( request_type=security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4328,7 +4318,7 @@ async def test_simulate_security_health_analytics_custom_module_async_from_dict( def test_simulate_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4365,7 +4355,7 @@ def test_simulate_security_health_analytics_custom_module_field_headers(): @pytest.mark.asyncio async def test_simulate_security_health_analytics_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4401,7 +4391,7 @@ async def test_simulate_security_health_analytics_custom_module_field_headers_as def test_simulate_security_health_analytics_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4446,7 +4436,7 @@ def test_simulate_security_health_analytics_custom_module_flattened(): def test_simulate_security_health_analytics_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4467,7 +4457,7 @@ def test_simulate_security_health_analytics_custom_module_flattened_error(): @pytest.mark.asyncio async def test_simulate_security_health_analytics_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4517,7 +4507,7 @@ async def test_simulate_security_health_analytics_custom_module_flattened_async( @pytest.mark.asyncio async def test_simulate_security_health_analytics_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4546,7 +4536,7 @@ def test_list_effective_event_threat_detection_custom_modules( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4584,7 +4574,7 @@ def test_list_effective_event_threat_detection_custom_modules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4608,7 +4598,7 @@ async def test_list_effective_event_threat_detection_custom_modules_async( request_type=security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4655,7 +4645,7 @@ async def test_list_effective_event_threat_detection_custom_modules_async_from_d def test_list_effective_event_threat_detection_custom_modules_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4692,7 +4682,7 @@ def test_list_effective_event_threat_detection_custom_modules_field_headers(): @pytest.mark.asyncio async def test_list_effective_event_threat_detection_custom_modules_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4728,7 +4718,7 @@ async def test_list_effective_event_threat_detection_custom_modules_field_header def test_list_effective_event_threat_detection_custom_modules_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4757,7 +4747,7 @@ def test_list_effective_event_threat_detection_custom_modules_flattened(): def test_list_effective_event_threat_detection_custom_modules_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4772,7 +4762,7 @@ def test_list_effective_event_threat_detection_custom_modules_flattened_error(): @pytest.mark.asyncio async def test_list_effective_event_threat_detection_custom_modules_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4806,7 +4796,7 @@ async def test_list_effective_event_threat_detection_custom_modules_flattened_as @pytest.mark.asyncio async def test_list_effective_event_threat_detection_custom_modules_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4822,7 +4812,7 @@ def test_list_effective_event_threat_detection_custom_modules_pager( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4882,7 +4872,7 @@ def test_list_effective_event_threat_detection_custom_modules_pages( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4931,7 +4921,7 @@ def test_list_effective_event_threat_detection_custom_modules_pages( @pytest.mark.asyncio async def test_list_effective_event_threat_detection_custom_modules_async_pager(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4988,7 +4978,7 @@ async def test_list_effective_event_threat_detection_custom_modules_async_pager( @pytest.mark.asyncio async def test_list_effective_event_threat_detection_custom_modules_async_pages(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5049,7 +5039,7 @@ def test_get_effective_event_threat_detection_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5098,7 +5088,7 @@ def test_get_effective_event_threat_detection_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5122,7 +5112,7 @@ async def test_get_effective_event_threat_detection_custom_module_async( request_type=security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5180,7 +5170,7 @@ async def test_get_effective_event_threat_detection_custom_module_async_from_dic def test_get_effective_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5217,7 +5207,7 @@ def test_get_effective_event_threat_detection_custom_module_field_headers(): @pytest.mark.asyncio async def test_get_effective_event_threat_detection_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5253,7 +5243,7 @@ async def test_get_effective_event_threat_detection_custom_module_field_headers_ def test_get_effective_event_threat_detection_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5282,7 +5272,7 @@ def test_get_effective_event_threat_detection_custom_module_flattened(): def test_get_effective_event_threat_detection_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5297,7 +5287,7 @@ def test_get_effective_event_threat_detection_custom_module_flattened_error(): @pytest.mark.asyncio async def test_get_effective_event_threat_detection_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5331,7 +5321,7 @@ async def test_get_effective_event_threat_detection_custom_module_flattened_asyn @pytest.mark.asyncio async def test_get_effective_event_threat_detection_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5354,7 +5344,7 @@ def test_list_event_threat_detection_custom_modules( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5391,7 +5381,7 @@ def test_list_event_threat_detection_custom_modules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5414,7 +5404,7 @@ async def test_list_event_threat_detection_custom_modules_async( request_type=security_center_management.ListEventThreatDetectionCustomModulesRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5454,7 +5444,7 @@ async def test_list_event_threat_detection_custom_modules_async_from_dict(): def test_list_event_threat_detection_custom_modules_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5488,7 +5478,7 @@ def test_list_event_threat_detection_custom_modules_field_headers(): @pytest.mark.asyncio async def test_list_event_threat_detection_custom_modules_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5521,7 +5511,7 @@ async def test_list_event_threat_detection_custom_modules_field_headers_async(): def test_list_event_threat_detection_custom_modules_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5549,7 +5539,7 @@ def test_list_event_threat_detection_custom_modules_flattened(): def test_list_event_threat_detection_custom_modules_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5564,7 +5554,7 @@ def test_list_event_threat_detection_custom_modules_flattened_error(): @pytest.mark.asyncio async def test_list_event_threat_detection_custom_modules_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5597,7 +5587,7 @@ async def test_list_event_threat_detection_custom_modules_flattened_async(): @pytest.mark.asyncio async def test_list_event_threat_detection_custom_modules_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5611,7 +5601,7 @@ async def test_list_event_threat_detection_custom_modules_flattened_error_async( def test_list_event_threat_detection_custom_modules_pager(transport_name: str = "grpc"): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -5666,7 +5656,7 @@ def test_list_event_threat_detection_custom_modules_pager(transport_name: str = def test_list_event_threat_detection_custom_modules_pages(transport_name: str = "grpc"): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -5712,7 +5702,7 @@ def test_list_event_threat_detection_custom_modules_pages(transport_name: str = @pytest.mark.asyncio async def test_list_event_threat_detection_custom_modules_async_pager(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5767,7 +5757,7 @@ async def test_list_event_threat_detection_custom_modules_async_pager(): @pytest.mark.asyncio async def test_list_event_threat_detection_custom_modules_async_pages(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5826,7 +5816,7 @@ def test_list_descendant_event_threat_detection_custom_modules( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5864,7 +5854,7 @@ def test_list_descendant_event_threat_detection_custom_modules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5888,7 +5878,7 @@ async def test_list_descendant_event_threat_detection_custom_modules_async( request_type=security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5935,7 +5925,7 @@ async def test_list_descendant_event_threat_detection_custom_modules_async_from_ def test_list_descendant_event_threat_detection_custom_modules_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5972,7 +5962,7 @@ def test_list_descendant_event_threat_detection_custom_modules_field_headers(): @pytest.mark.asyncio async def test_list_descendant_event_threat_detection_custom_modules_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6008,7 +5998,7 @@ async def test_list_descendant_event_threat_detection_custom_modules_field_heade def test_list_descendant_event_threat_detection_custom_modules_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6037,7 +6027,7 @@ def test_list_descendant_event_threat_detection_custom_modules_flattened(): def test_list_descendant_event_threat_detection_custom_modules_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6052,7 +6042,7 @@ def test_list_descendant_event_threat_detection_custom_modules_flattened_error() @pytest.mark.asyncio async def test_list_descendant_event_threat_detection_custom_modules_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6086,7 +6076,7 @@ async def test_list_descendant_event_threat_detection_custom_modules_flattened_a @pytest.mark.asyncio async def test_list_descendant_event_threat_detection_custom_modules_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6102,7 +6092,7 @@ def test_list_descendant_event_threat_detection_custom_modules_pager( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -6160,7 +6150,7 @@ def test_list_descendant_event_threat_detection_custom_modules_pages( transport_name: str = "grpc", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -6209,7 +6199,7 @@ def test_list_descendant_event_threat_detection_custom_modules_pages( @pytest.mark.asyncio async def test_list_descendant_event_threat_detection_custom_modules_async_pager(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6266,7 +6256,7 @@ async def test_list_descendant_event_threat_detection_custom_modules_async_pager @pytest.mark.asyncio async def test_list_descendant_event_threat_detection_custom_modules_async_pages(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6327,7 +6317,7 @@ def test_get_event_threat_detection_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6379,7 +6369,7 @@ def test_get_event_threat_detection_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6402,7 +6392,7 @@ async def test_get_event_threat_detection_custom_module_async( request_type=security_center_management.GetEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6459,7 +6449,7 @@ async def test_get_event_threat_detection_custom_module_async_from_dict(): def test_get_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6493,7 +6483,7 @@ def test_get_event_threat_detection_custom_module_field_headers(): @pytest.mark.asyncio async def test_get_event_threat_detection_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6526,7 +6516,7 @@ async def test_get_event_threat_detection_custom_module_field_headers_async(): def test_get_event_threat_detection_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6554,7 +6544,7 @@ def test_get_event_threat_detection_custom_module_flattened(): def test_get_event_threat_detection_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6569,7 +6559,7 @@ def test_get_event_threat_detection_custom_module_flattened_error(): @pytest.mark.asyncio async def test_get_event_threat_detection_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6602,7 +6592,7 @@ async def test_get_event_threat_detection_custom_module_flattened_async(): @pytest.mark.asyncio async def test_get_event_threat_detection_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6625,7 +6615,7 @@ def test_create_event_threat_detection_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6677,7 +6667,7 @@ def test_create_event_threat_detection_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6700,7 +6690,7 @@ async def test_create_event_threat_detection_custom_module_async( request_type=security_center_management.CreateEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6757,7 +6747,7 @@ async def test_create_event_threat_detection_custom_module_async_from_dict(): def test_create_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6791,7 +6781,7 @@ def test_create_event_threat_detection_custom_module_field_headers(): @pytest.mark.asyncio async def test_create_event_threat_detection_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6824,7 +6814,7 @@ async def test_create_event_threat_detection_custom_module_field_headers_async() def test_create_event_threat_detection_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6860,7 +6850,7 @@ def test_create_event_threat_detection_custom_module_flattened(): def test_create_event_threat_detection_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6878,7 +6868,7 @@ def test_create_event_threat_detection_custom_module_flattened_error(): @pytest.mark.asyncio async def test_create_event_threat_detection_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6919,7 +6909,7 @@ async def test_create_event_threat_detection_custom_module_flattened_async(): @pytest.mark.asyncio async def test_create_event_threat_detection_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6945,7 +6935,7 @@ def test_update_event_threat_detection_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6997,7 +6987,7 @@ def test_update_event_threat_detection_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7020,7 +7010,7 @@ async def test_update_event_threat_detection_custom_module_async( request_type=security_center_management.UpdateEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7077,7 +7067,7 @@ async def test_update_event_threat_detection_custom_module_async_from_dict(): def test_update_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7111,7 +7101,7 @@ def test_update_event_threat_detection_custom_module_field_headers(): @pytest.mark.asyncio async def test_update_event_threat_detection_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7144,7 +7134,7 @@ async def test_update_event_threat_detection_custom_module_field_headers_async() def test_update_event_threat_detection_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7180,7 +7170,7 @@ def test_update_event_threat_detection_custom_module_flattened(): def test_update_event_threat_detection_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7198,7 +7188,7 @@ def test_update_event_threat_detection_custom_module_flattened_error(): @pytest.mark.asyncio async def test_update_event_threat_detection_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7239,7 +7229,7 @@ async def test_update_event_threat_detection_custom_module_flattened_async(): @pytest.mark.asyncio async def test_update_event_threat_detection_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7265,7 +7255,7 @@ def test_delete_event_threat_detection_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7297,7 +7287,7 @@ def test_delete_event_threat_detection_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7320,7 +7310,7 @@ async def test_delete_event_threat_detection_custom_module_async( request_type=security_center_management.DeleteEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7355,7 +7345,7 @@ async def test_delete_event_threat_detection_custom_module_async_from_dict(): def test_delete_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7387,7 +7377,7 @@ def test_delete_event_threat_detection_custom_module_field_headers(): @pytest.mark.asyncio async def test_delete_event_threat_detection_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7418,7 +7408,7 @@ async def test_delete_event_threat_detection_custom_module_field_headers_async() def test_delete_event_threat_detection_custom_module_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7444,7 +7434,7 @@ def test_delete_event_threat_detection_custom_module_flattened(): def test_delete_event_threat_detection_custom_module_flattened_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7459,7 +7449,7 @@ def test_delete_event_threat_detection_custom_module_flattened_error(): @pytest.mark.asyncio async def test_delete_event_threat_detection_custom_module_flattened_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7488,7 +7478,7 @@ async def test_delete_event_threat_detection_custom_module_flattened_async(): @pytest.mark.asyncio async def test_delete_event_threat_detection_custom_module_flattened_error_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7511,7 +7501,7 @@ def test_validate_event_threat_detection_custom_module( request_type, transport: str = "grpc" ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7548,7 +7538,7 @@ def test_validate_event_threat_detection_custom_module_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7571,7 +7561,7 @@ async def test_validate_event_threat_detection_custom_module_async( request_type=security_center_management.ValidateEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7611,7 +7601,7 @@ async def test_validate_event_threat_detection_custom_module_async_from_dict(): def test_validate_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7647,7 +7637,7 @@ def test_validate_event_threat_detection_custom_module_field_headers(): @pytest.mark.asyncio async def test_validate_event_threat_detection_custom_module_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7689,7 +7679,7 @@ async def test_validate_event_threat_detection_custom_module_field_headers_async ) def test_list_effective_security_health_analytics_custom_modules_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7746,7 +7736,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_required_f # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_effective_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -7757,7 +7747,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_required_f jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_effective_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -7775,7 +7765,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_required_f assert jsonified_request["parent"] == "parent_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7823,7 +7813,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_required_f def test_list_effective_security_health_analytics_custom_modules_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_effective_security_health_analytics_custom_modules._get_unset_required_fields( @@ -7845,7 +7835,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_intercepto null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -7910,7 +7900,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_bad_reques request_type=security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7932,7 +7922,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_bad_reques def test_list_effective_security_health_analytics_custom_modules_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7980,7 +7970,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_flattened_ transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7997,7 +7987,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_pager( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8082,7 +8072,7 @@ def test_list_effective_security_health_analytics_custom_modules_rest_pager( ) def test_get_effective_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8149,7 +8139,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_required_fie # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_effective_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -8160,7 +8150,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_required_fie jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_effective_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -8171,7 +8161,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_required_fie assert jsonified_request["name"] == "name_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8219,7 +8209,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_required_fie def test_get_effective_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_effective_security_health_analytics_custom_module._get_unset_required_fields( @@ -8233,7 +8223,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_interceptors null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -8298,7 +8288,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_bad_request( request_type=security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8322,7 +8312,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_bad_request( def test_get_effective_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8374,7 +8364,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_flattened_er transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8389,7 +8379,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_flattened_er def test_get_effective_security_health_analytics_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8402,7 +8392,7 @@ def test_get_effective_security_health_analytics_custom_module_rest_error(): ) def test_list_security_health_analytics_custom_modules_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8457,7 +8447,7 @@ def test_list_security_health_analytics_custom_modules_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -8468,7 +8458,7 @@ def test_list_security_health_analytics_custom_modules_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -8486,7 +8476,7 @@ def test_list_security_health_analytics_custom_modules_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8532,7 +8522,7 @@ def test_list_security_health_analytics_custom_modules_rest_required_fields( def test_list_security_health_analytics_custom_modules_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_security_health_analytics_custom_modules._get_unset_required_fields( @@ -8554,7 +8544,7 @@ def test_list_security_health_analytics_custom_modules_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -8619,7 +8609,7 @@ def test_list_security_health_analytics_custom_modules_rest_bad_request( request_type=security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8641,7 +8631,7 @@ def test_list_security_health_analytics_custom_modules_rest_bad_request( def test_list_security_health_analytics_custom_modules_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8689,7 +8679,7 @@ def test_list_security_health_analytics_custom_modules_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8706,7 +8696,7 @@ def test_list_security_health_analytics_custom_modules_rest_pager( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8790,7 +8780,7 @@ def test_list_security_health_analytics_custom_modules_rest_pager( ) def test_list_descendant_security_health_analytics_custom_modules_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8847,7 +8837,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_required_ # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_descendant_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -8858,7 +8848,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_required_ jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_descendant_security_health_analytics_custom_modules._get_unset_required_fields( jsonified_request ) @@ -8876,7 +8866,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_required_ assert jsonified_request["parent"] == "parent_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8924,7 +8914,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_required_ def test_list_descendant_security_health_analytics_custom_modules_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_descendant_security_health_analytics_custom_modules._get_unset_required_fields( @@ -8946,7 +8936,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_intercept null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -9011,7 +9001,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_bad_reque request_type=security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9033,7 +9023,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_bad_reque def test_list_descendant_security_health_analytics_custom_modules_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9081,7 +9071,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_flattened transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9098,7 +9088,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_pager( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9182,7 +9172,7 @@ def test_list_descendant_security_health_analytics_custom_modules_rest_pager( ) def test_get_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9252,7 +9242,7 @@ def test_get_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -9263,7 +9253,7 @@ def test_get_security_health_analytics_custom_module_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -9274,7 +9264,7 @@ def test_get_security_health_analytics_custom_module_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9320,7 +9310,7 @@ def test_get_security_health_analytics_custom_module_rest_required_fields( def test_get_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_security_health_analytics_custom_module._get_unset_required_fields( @@ -9334,7 +9324,7 @@ def test_get_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -9401,7 +9391,7 @@ def test_get_security_health_analytics_custom_module_rest_bad_request( request_type=security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9425,7 +9415,7 @@ def test_get_security_health_analytics_custom_module_rest_bad_request( def test_get_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9475,7 +9465,7 @@ def test_get_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9490,7 +9480,7 @@ def test_get_security_health_analytics_custom_module_rest_flattened_error( def test_get_security_health_analytics_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9503,7 +9493,7 @@ def test_get_security_health_analytics_custom_module_rest_error(): ) def test_create_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9674,7 +9664,7 @@ def test_create_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -9685,7 +9675,7 @@ def test_create_security_health_analytics_custom_module_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -9698,7 +9688,7 @@ def test_create_security_health_analytics_custom_module_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9745,7 +9735,7 @@ def test_create_security_health_analytics_custom_module_rest_required_fields( def test_create_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_security_health_analytics_custom_module._get_unset_required_fields( @@ -9767,7 +9757,7 @@ def test_create_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -9834,7 +9824,7 @@ def test_create_security_health_analytics_custom_module_rest_bad_request( request_type=security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9856,7 +9846,7 @@ def test_create_security_health_analytics_custom_module_rest_bad_request( def test_create_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9907,7 +9897,7 @@ def test_create_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9925,7 +9915,7 @@ def test_create_security_health_analytics_custom_module_rest_flattened_error( def test_create_security_health_analytics_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9938,7 +9928,7 @@ def test_create_security_health_analytics_custom_module_rest_error(): ) def test_update_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10112,7 +10102,7 @@ def test_update_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -10121,7 +10111,7 @@ def test_update_security_health_analytics_custom_module_rest_required_fields( # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -10137,7 +10127,7 @@ def test_update_security_health_analytics_custom_module_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10184,7 +10174,7 @@ def test_update_security_health_analytics_custom_module_rest_required_fields( def test_update_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_security_health_analytics_custom_module._get_unset_required_fields( @@ -10211,7 +10201,7 @@ def test_update_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -10278,7 +10268,7 @@ def test_update_security_health_analytics_custom_module_rest_bad_request( request_type=security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10304,7 +10294,7 @@ def test_update_security_health_analytics_custom_module_rest_bad_request( def test_update_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10359,7 +10349,7 @@ def test_update_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10377,7 +10367,7 @@ def test_update_security_health_analytics_custom_module_rest_flattened_error( def test_update_security_health_analytics_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10390,7 +10380,7 @@ def test_update_security_health_analytics_custom_module_rest_error(): ) def test_delete_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10438,7 +10428,7 @@ def test_delete_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -10449,7 +10439,7 @@ def test_delete_security_health_analytics_custom_module_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -10462,7 +10452,7 @@ def test_delete_security_health_analytics_custom_module_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10501,7 +10491,7 @@ def test_delete_security_health_analytics_custom_module_rest_required_fields( def test_delete_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_security_health_analytics_custom_module._get_unset_required_fields( @@ -10515,7 +10505,7 @@ def test_delete_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -10569,7 +10559,7 @@ def test_delete_security_health_analytics_custom_module_rest_bad_request( request_type=security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10593,7 +10583,7 @@ def test_delete_security_health_analytics_custom_module_rest_bad_request( def test_delete_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10637,7 +10627,7 @@ def test_delete_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10652,7 +10642,7 @@ def test_delete_security_health_analytics_custom_module_rest_flattened_error( def test_delete_security_health_analytics_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10665,7 +10655,7 @@ def test_delete_security_health_analytics_custom_module_rest_error(): ) def test_simulate_security_health_analytics_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10720,7 +10710,7 @@ def test_simulate_security_health_analytics_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).simulate_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -10731,7 +10721,7 @@ def test_simulate_security_health_analytics_custom_module_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).simulate_security_health_analytics_custom_module._get_unset_required_fields( jsonified_request ) @@ -10742,7 +10732,7 @@ def test_simulate_security_health_analytics_custom_module_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10789,7 +10779,7 @@ def test_simulate_security_health_analytics_custom_module_rest_required_fields( def test_simulate_security_health_analytics_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.simulate_security_health_analytics_custom_module._get_unset_required_fields( @@ -10812,7 +10802,7 @@ def test_simulate_security_health_analytics_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -10877,7 +10867,7 @@ def test_simulate_security_health_analytics_custom_module_rest_bad_request( request_type=security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10899,7 +10889,7 @@ def test_simulate_security_health_analytics_custom_module_rest_bad_request( def test_simulate_security_health_analytics_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10953,7 +10943,7 @@ def test_simulate_security_health_analytics_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10974,7 +10964,7 @@ def test_simulate_security_health_analytics_custom_module_rest_flattened_error( def test_simulate_security_health_analytics_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10987,7 +10977,7 @@ def test_simulate_security_health_analytics_custom_module_rest_error(): ) def test_list_effective_event_threat_detection_custom_modules_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11042,7 +11032,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_required_fiel # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_effective_event_threat_detection_custom_modules._get_unset_required_fields( jsonified_request ) @@ -11053,7 +11043,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_required_fiel jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_effective_event_threat_detection_custom_modules._get_unset_required_fields( jsonified_request ) @@ -11071,7 +11061,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_required_fiel assert jsonified_request["parent"] == "parent_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11119,7 +11109,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_required_fiel def test_list_effective_event_threat_detection_custom_modules_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_effective_event_threat_detection_custom_modules._get_unset_required_fields( @@ -11141,7 +11131,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -11206,7 +11196,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_bad_request( request_type=security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11228,7 +11218,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_bad_request( def test_list_effective_event_threat_detection_custom_modules_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11276,7 +11266,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_flattened_err transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11293,7 +11283,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_pager( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11377,7 +11367,7 @@ def test_list_effective_event_threat_detection_custom_modules_rest_pager( ) def test_get_effective_event_threat_detection_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11447,7 +11437,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_required_fields # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_effective_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -11458,7 +11448,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_required_fields jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_effective_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -11469,7 +11459,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_required_fields assert jsonified_request["name"] == "name_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11519,7 +11509,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_required_fields def test_get_effective_event_threat_detection_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_effective_event_threat_detection_custom_module._get_unset_required_fields( @@ -11533,7 +11523,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -11598,7 +11588,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_bad_request( request_type=security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11622,7 +11612,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_bad_request( def test_get_effective_event_threat_detection_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11674,7 +11664,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_flattened_error transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11689,7 +11679,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_flattened_error def test_get_effective_event_threat_detection_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -11702,7 +11692,7 @@ def test_get_effective_event_threat_detection_custom_module_rest_error(): ) def test_list_event_threat_detection_custom_modules_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11759,7 +11749,7 @@ def test_list_event_threat_detection_custom_modules_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_event_threat_detection_custom_modules._get_unset_required_fields( jsonified_request ) @@ -11770,7 +11760,7 @@ def test_list_event_threat_detection_custom_modules_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_event_threat_detection_custom_modules._get_unset_required_fields( jsonified_request ) @@ -11788,7 +11778,7 @@ def test_list_event_threat_detection_custom_modules_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11834,7 +11824,7 @@ def test_list_event_threat_detection_custom_modules_rest_required_fields( def test_list_event_threat_detection_custom_modules_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = ( @@ -11856,7 +11846,7 @@ def test_list_event_threat_detection_custom_modules_rest_unset_required_fields() @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_event_threat_detection_custom_modules_rest_interceptors(null_interceptor): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -11921,7 +11911,7 @@ def test_list_event_threat_detection_custom_modules_rest_bad_request( request_type=security_center_management.ListEventThreatDetectionCustomModulesRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11943,7 +11933,7 @@ def test_list_event_threat_detection_custom_modules_rest_bad_request( def test_list_event_threat_detection_custom_modules_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11993,7 +11983,7 @@ def test_list_event_threat_detection_custom_modules_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12008,7 +11998,7 @@ def test_list_event_threat_detection_custom_modules_rest_flattened_error( def test_list_event_threat_detection_custom_modules_rest_pager(transport: str = "rest"): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12090,7 +12080,7 @@ def test_list_event_threat_detection_custom_modules_rest_pager(transport: str = ) def test_list_descendant_event_threat_detection_custom_modules_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12145,7 +12135,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_required_fie # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_descendant_event_threat_detection_custom_modules._get_unset_required_fields( jsonified_request ) @@ -12156,7 +12146,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_required_fie jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_descendant_event_threat_detection_custom_modules._get_unset_required_fields( jsonified_request ) @@ -12174,7 +12164,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_required_fie assert jsonified_request["parent"] == "parent_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -12222,7 +12212,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_required_fie def test_list_descendant_event_threat_detection_custom_modules_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_descendant_event_threat_detection_custom_modules._get_unset_required_fields( @@ -12244,7 +12234,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_interceptors null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -12309,7 +12299,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_bad_request( request_type=security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12331,7 +12321,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_bad_request( def test_list_descendant_event_threat_detection_custom_modules_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12379,7 +12369,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_flattened_er transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12396,7 +12386,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_pager( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12478,7 +12468,7 @@ def test_list_descendant_event_threat_detection_custom_modules_rest_pager( ) def test_get_event_threat_detection_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12550,7 +12540,7 @@ def test_get_event_threat_detection_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -12561,7 +12551,7 @@ def test_get_event_threat_detection_custom_module_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -12572,7 +12562,7 @@ def test_get_event_threat_detection_custom_module_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -12618,7 +12608,7 @@ def test_get_event_threat_detection_custom_module_rest_required_fields( def test_get_event_threat_detection_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = ( @@ -12632,7 +12622,7 @@ def test_get_event_threat_detection_custom_module_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_event_threat_detection_custom_module_rest_interceptors(null_interceptor): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -12701,7 +12691,7 @@ def test_get_event_threat_detection_custom_module_rest_bad_request( request_type=security_center_management.GetEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12725,7 +12715,7 @@ def test_get_event_threat_detection_custom_module_rest_bad_request( def test_get_event_threat_detection_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12773,7 +12763,7 @@ def test_get_event_threat_detection_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12788,7 +12778,7 @@ def test_get_event_threat_detection_custom_module_rest_flattened_error( def test_get_event_threat_detection_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -12801,7 +12791,7 @@ def test_get_event_threat_detection_custom_module_rest_error(): ) def test_create_event_threat_detection_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12959,7 +12949,7 @@ def test_create_event_threat_detection_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -12970,7 +12960,7 @@ def test_create_event_threat_detection_custom_module_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -12983,7 +12973,7 @@ def test_create_event_threat_detection_custom_module_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -13030,7 +13020,7 @@ def test_create_event_threat_detection_custom_module_rest_required_fields( def test_create_event_threat_detection_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_event_threat_detection_custom_module._get_unset_required_fields( @@ -13052,7 +13042,7 @@ def test_create_event_threat_detection_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -13119,7 +13109,7 @@ def test_create_event_threat_detection_custom_module_rest_bad_request( request_type=security_center_management.CreateEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13141,7 +13131,7 @@ def test_create_event_threat_detection_custom_module_rest_bad_request( def test_create_event_threat_detection_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13190,7 +13180,7 @@ def test_create_event_threat_detection_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13208,7 +13198,7 @@ def test_create_event_threat_detection_custom_module_rest_flattened_error( def test_create_event_threat_detection_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -13221,7 +13211,7 @@ def test_create_event_threat_detection_custom_module_rest_error(): ) def test_update_event_threat_detection_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13382,7 +13372,7 @@ def test_update_event_threat_detection_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -13391,7 +13381,7 @@ def test_update_event_threat_detection_custom_module_rest_required_fields( # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -13407,7 +13397,7 @@ def test_update_event_threat_detection_custom_module_rest_required_fields( # verify required fields with non-default values are left alone client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -13454,7 +13444,7 @@ def test_update_event_threat_detection_custom_module_rest_required_fields( def test_update_event_threat_detection_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_event_threat_detection_custom_module._get_unset_required_fields( @@ -13481,7 +13471,7 @@ def test_update_event_threat_detection_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -13548,7 +13538,7 @@ def test_update_event_threat_detection_custom_module_rest_bad_request( request_type=security_center_management.UpdateEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13574,7 +13564,7 @@ def test_update_event_threat_detection_custom_module_rest_bad_request( def test_update_event_threat_detection_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13627,7 +13617,7 @@ def test_update_event_threat_detection_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13645,7 +13635,7 @@ def test_update_event_threat_detection_custom_module_rest_flattened_error( def test_update_event_threat_detection_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -13658,7 +13648,7 @@ def test_update_event_threat_detection_custom_module_rest_error(): ) def test_delete_event_threat_detection_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13706,7 +13696,7 @@ def test_delete_event_threat_detection_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -13717,7 +13707,7 @@ def test_delete_event_threat_detection_custom_module_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -13730,7 +13720,7 @@ def test_delete_event_threat_detection_custom_module_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -13769,7 +13759,7 @@ def test_delete_event_threat_detection_custom_module_rest_required_fields( def test_delete_event_threat_detection_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_event_threat_detection_custom_module._get_unset_required_fields( @@ -13783,7 +13773,7 @@ def test_delete_event_threat_detection_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -13837,7 +13827,7 @@ def test_delete_event_threat_detection_custom_module_rest_bad_request( request_type=security_center_management.DeleteEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13861,7 +13851,7 @@ def test_delete_event_threat_detection_custom_module_rest_bad_request( def test_delete_event_threat_detection_custom_module_rest_flattened(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13905,7 +13895,7 @@ def test_delete_event_threat_detection_custom_module_rest_flattened_error( transport: str = "rest", ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13920,7 +13910,7 @@ def test_delete_event_threat_detection_custom_module_rest_flattened_error( def test_delete_event_threat_detection_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -13933,7 +13923,7 @@ def test_delete_event_threat_detection_custom_module_rest_error(): ) def test_validate_event_threat_detection_custom_module_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13990,7 +13980,7 @@ def test_validate_event_threat_detection_custom_module_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).validate_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -14003,7 +13993,7 @@ def test_validate_event_threat_detection_custom_module_rest_required_fields( jsonified_request["type"] = "type__value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).validate_event_threat_detection_custom_module._get_unset_required_fields( jsonified_request ) @@ -14018,7 +14008,7 @@ def test_validate_event_threat_detection_custom_module_rest_required_fields( assert jsonified_request["type"] == "type__value" client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -14065,7 +14055,7 @@ def test_validate_event_threat_detection_custom_module_rest_required_fields( def test_validate_event_threat_detection_custom_module_rest_unset_required_fields(): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.validate_event_threat_detection_custom_module._get_unset_required_fields( @@ -14088,7 +14078,7 @@ def test_validate_event_threat_detection_custom_module_rest_interceptors( null_interceptor, ): transport = transports.SecurityCenterManagementRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SecurityCenterManagementRestInterceptor(), @@ -14153,7 +14143,7 @@ def test_validate_event_threat_detection_custom_module_rest_bad_request( request_type=security_center_management.ValidateEventThreatDetectionCustomModuleRequest, ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14175,24 +14165,24 @@ def test_validate_event_threat_detection_custom_module_rest_bad_request( def test_validate_event_threat_detection_custom_module_rest_error(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SecurityCenterManagementGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SecurityCenterManagementGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterManagementClient( @@ -14202,7 +14192,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SecurityCenterManagementGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -14217,13 +14207,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SecurityCenterManagementClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SecurityCenterManagementGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SecurityCenterManagementClient( @@ -14235,7 +14224,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SecurityCenterManagementGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SecurityCenterManagementClient(transport=transport) assert client.transport is transport @@ -14244,13 +14233,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SecurityCenterManagementGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SecurityCenterManagementGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -14267,7 +14256,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -14281,7 +14270,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SecurityCenterManagementClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -14289,7 +14278,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -14301,7 +14290,7 @@ def test_security_center_management_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SecurityCenterManagementTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -14313,7 +14302,7 @@ def test_security_center_management_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SecurityCenterManagementTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -14364,7 +14353,7 @@ def test_security_center_management_base_transport_with_credentials_file(): "google.cloud.securitycentermanagement_v1.services.security_center_management.transports.SecurityCenterManagementTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecurityCenterManagementTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -14383,7 +14372,7 @@ def test_security_center_management_base_transport_with_adc(): "google.cloud.securitycentermanagement_v1.services.security_center_management.transports.SecurityCenterManagementTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecurityCenterManagementTransport() adc.assert_called_once() @@ -14391,7 +14380,7 @@ def test_security_center_management_base_transport_with_adc(): def test_security_center_management_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SecurityCenterManagementClient() adc.assert_called_once_with( scopes=None, @@ -14411,7 +14400,7 @@ def test_security_center_management_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -14460,7 +14449,7 @@ def test_security_center_management_transport_create_channel( ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -14490,7 +14479,7 @@ def test_security_center_management_transport_create_channel( def test_security_center_management_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -14528,7 +14517,7 @@ def test_security_center_management_grpc_transport_client_cert_source_for_mtls( def test_security_center_management_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -14548,7 +14537,7 @@ def test_security_center_management_http_transport_client_cert_source_for_mtls() ) def test_security_center_management_host_no_port(transport_name): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securitycentermanagement.googleapis.com" ), @@ -14571,7 +14560,7 @@ def test_security_center_management_host_no_port(transport_name): ) def test_security_center_management_host_with_port(transport_name): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="securitycentermanagement.googleapis.com:8000" ), @@ -14591,8 +14580,8 @@ def test_security_center_management_host_with_port(transport_name): ], ) def test_security_center_management_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SecurityCenterManagementClient( credentials=creds1, transport=transport_name, @@ -14735,7 +14724,7 @@ def test_security_center_management_transport_channel_mtls_with_client_cert_sour mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -15081,7 +15070,7 @@ def test_client_with_default_client_info(): transports.SecurityCenterManagementTransport, "_prep_wrapped_messages" ) as prep: client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -15091,7 +15080,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecurityCenterManagementClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -15100,7 +15089,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -15115,7 +15104,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15145,7 +15134,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -15173,7 +15162,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15201,7 +15190,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -15227,7 +15216,7 @@ def test_list_locations_rest(request_type): def test_list_locations(transport: str = "grpc"): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15252,7 +15241,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15278,7 +15267,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15307,7 +15296,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15336,7 +15325,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -15354,7 +15343,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -15372,7 +15361,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15397,7 +15386,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15423,7 +15412,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15452,7 +15441,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15481,7 +15470,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -15499,7 +15488,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = SecurityCenterManagementAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -15523,7 +15512,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -15540,7 +15529,7 @@ def test_client_ctx(): ] for transport in transports: client = SecurityCenterManagementClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-service-control/google/cloud/servicecontrol/gapic_version.py b/packages/google-cloud-service-control/google/cloud/servicecontrol/gapic_version.py index 4316e0e5df1f..360a0d13ebdd 100644 --- a/packages/google-cloud-service-control/google/cloud/servicecontrol/gapic_version.py +++ b/packages/google-cloud-service-control/google/cloud/servicecontrol/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.11.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/gapic_version.py b/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/gapic_version.py index 4316e0e5df1f..360a0d13ebdd 100644 --- a/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/gapic_version.py +++ b/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.11.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/services/quota_controller/client.py b/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/services/quota_controller/client.py index 32057d533207..5e50037de96c 100644 --- a/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/services/quota_controller/client.py +++ b/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/services/quota_controller/client.py @@ -363,6 +363,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -381,6 +382,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -455,17 +457,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = QuotaControllerClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = QuotaControllerClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/services/service_controller/client.py b/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/services/service_controller/client.py index 9efd22128684..b289007bc6fa 100644 --- a/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/services/service_controller/client.py +++ b/packages/google-cloud-service-control/google/cloud/servicecontrol_v1/services/service_controller/client.py @@ -363,6 +363,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -381,6 +382,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -455,17 +457,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ServiceControllerClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ServiceControllerClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-service-control/google/cloud/servicecontrol_v2/gapic_version.py b/packages/google-cloud-service-control/google/cloud/servicecontrol_v2/gapic_version.py index 4316e0e5df1f..360a0d13ebdd 100644 --- a/packages/google-cloud-service-control/google/cloud/servicecontrol_v2/gapic_version.py +++ b/packages/google-cloud-service-control/google/cloud/servicecontrol_v2/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.11.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-control/google/cloud/servicecontrol_v2/services/service_controller/client.py b/packages/google-cloud-service-control/google/cloud/servicecontrol_v2/services/service_controller/client.py index e32276290f90..4d53c4725469 100644 --- a/packages/google-cloud-service-control/google/cloud/servicecontrol_v2/services/service_controller/client.py +++ b/packages/google-cloud-service-control/google/cloud/servicecontrol_v2/services/service_controller/client.py @@ -370,6 +370,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -388,6 +389,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -462,17 +464,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ServiceControllerClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ServiceControllerClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-service-control/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v1.json b/packages/google-cloud-service-control/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v1.json index 431a9a2ac0c0..ae2dfb3a75ea 100644 --- a/packages/google-cloud-service-control/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v1.json +++ b/packages/google-cloud-service-control/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-service-control", - "version": "1.11.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-service-control/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v2.json b/packages/google-cloud-service-control/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v2.json index 06440fe84db5..2b78179c69f8 100644 --- a/packages/google-cloud-service-control/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v2.json +++ b/packages/google-cloud-service-control/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-service-control", - "version": "1.11.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-service-control/setup.py b/packages/google-cloud-service-control/setup.py index f5b486cd58ca..b6cb051391b1 100644 --- a/packages/google-cloud-service-control/setup.py +++ b/packages/google-cloud-service-control/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-service-control/testing/constraints-3.7.txt b/packages/google-cloud-service-control/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-service-control/testing/constraints-3.7.txt +++ b/packages/google-cloud-service-control/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py index 1fb45b10759a..714e47154f3d 100644 --- a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py +++ b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py @@ -80,18 +80,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -318,7 +306,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -345,42 +333,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -393,7 +388,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_quota_controller_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -447,7 +442,7 @@ def test_quota_controller_client_service_account_always_use_jwt( def test_quota_controller_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -510,9 +505,7 @@ def test_quota_controller_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(QuotaControllerClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -931,20 +924,20 @@ def test_quota_controller_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -956,13 +949,11 @@ def test_quota_controller_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -978,8 +969,7 @@ def test_quota_controller_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1132,8 +1122,8 @@ def test_quota_controller_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1165,7 +1155,7 @@ def test_quota_controller_client_create_channel_credentials_file( ) def test_allocate_quota(request_type, transport: str = "grpc"): client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1197,7 +1187,7 @@ def test_allocate_quota_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1214,7 +1204,7 @@ async def test_allocate_quota_async( transport: str = "grpc_asyncio", request_type=quota_controller.AllocateQuotaRequest ): client = QuotaControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1251,7 +1241,7 @@ async def test_allocate_quota_async_from_dict(): def test_allocate_quota_field_headers(): client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1281,7 +1271,7 @@ def test_allocate_quota_field_headers(): @pytest.mark.asyncio async def test_allocate_quota_field_headers_async(): client = QuotaControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1319,7 +1309,7 @@ async def test_allocate_quota_field_headers_async(): ) def test_allocate_quota_rest(request_type): client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1355,7 +1345,7 @@ def test_allocate_quota_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_allocate_quota_rest_interceptors(null_interceptor): transport = transports.QuotaControllerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.QuotaControllerRestInterceptor(), @@ -1413,7 +1403,7 @@ def test_allocate_quota_rest_bad_request( transport: str = "rest", request_type=quota_controller.AllocateQuotaRequest ): client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1435,24 +1425,24 @@ def test_allocate_quota_rest_bad_request( def test_allocate_quota_rest_error(): client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.QuotaControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.QuotaControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = QuotaControllerClient( @@ -1462,7 +1452,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.QuotaControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1477,13 +1467,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = QuotaControllerClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.QuotaControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = QuotaControllerClient( @@ -1495,7 +1484,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.QuotaControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = QuotaControllerClient(transport=transport) assert client.transport is transport @@ -1504,13 +1493,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.QuotaControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.QuotaControllerGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1527,7 +1516,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1541,7 +1530,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = QuotaControllerClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1549,7 +1538,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1561,7 +1550,7 @@ def test_quota_controller_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.QuotaControllerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1573,7 +1562,7 @@ def test_quota_controller_base_transport(): ) as Transport: Transport.return_value = None transport = transports.QuotaControllerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1603,7 +1592,7 @@ def test_quota_controller_base_transport_with_credentials_file(): "google.cloud.servicecontrol_v1.services.quota_controller.transports.QuotaControllerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.QuotaControllerTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1625,7 +1614,7 @@ def test_quota_controller_base_transport_with_adc(): "google.cloud.servicecontrol_v1.services.quota_controller.transports.QuotaControllerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.QuotaControllerTransport() adc.assert_called_once() @@ -1633,7 +1622,7 @@ def test_quota_controller_base_transport_with_adc(): def test_quota_controller_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) QuotaControllerClient() adc.assert_called_once_with( scopes=None, @@ -1656,7 +1645,7 @@ def test_quota_controller_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -1706,7 +1695,7 @@ def test_quota_controller_transport_create_channel(transport_class, grpc_helpers ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -1737,7 +1726,7 @@ def test_quota_controller_transport_create_channel(transport_class, grpc_helpers ], ) def test_quota_controller_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1775,7 +1764,7 @@ def test_quota_controller_grpc_transport_client_cert_source_for_mtls(transport_c def test_quota_controller_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -1795,7 +1784,7 @@ def test_quota_controller_http_transport_client_cert_source_for_mtls(): ) def test_quota_controller_host_no_port(transport_name): client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicecontrol.googleapis.com" ), @@ -1818,7 +1807,7 @@ def test_quota_controller_host_no_port(transport_name): ) def test_quota_controller_host_with_port(transport_name): client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicecontrol.googleapis.com:8000" ), @@ -1838,8 +1827,8 @@ def test_quota_controller_host_with_port(transport_name): ], ) def test_quota_controller_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = QuotaControllerClient( credentials=creds1, transport=transport_name, @@ -1903,7 +1892,7 @@ def test_quota_controller_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2089,7 +2078,7 @@ def test_client_with_default_client_info(): transports.QuotaControllerTransport, "_prep_wrapped_messages" ) as prep: client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2099,7 +2088,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = QuotaControllerClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2108,7 +2097,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = QuotaControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2127,7 +2116,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2144,7 +2133,7 @@ def test_client_ctx(): ] for transport in transports: client = QuotaControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_service_controller.py b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_service_controller.py index 47079eb1a496..1bd84a82ec8a 100644 --- a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_service_controller.py +++ b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_service_controller.py @@ -90,18 +90,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -337,7 +325,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -364,42 +352,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -412,7 +407,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_service_controller_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -466,7 +461,7 @@ def test_service_controller_client_service_account_always_use_jwt( def test_service_controller_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -529,9 +524,7 @@ def test_service_controller_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ServiceControllerClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -950,20 +943,20 @@ def test_service_controller_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -975,13 +968,11 @@ def test_service_controller_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -997,8 +988,7 @@ def test_service_controller_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1156,8 +1146,8 @@ def test_service_controller_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1189,7 +1179,7 @@ def test_service_controller_client_create_channel_credentials_file( ) def test_check(request_type, transport: str = "grpc"): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1223,7 +1213,7 @@ def test_check_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1240,7 +1230,7 @@ async def test_check_async( transport: str = "grpc_asyncio", request_type=service_controller.CheckRequest ): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1279,7 +1269,7 @@ async def test_check_async_from_dict(): def test_check_field_headers(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1309,7 +1299,7 @@ def test_check_field_headers(): @pytest.mark.asyncio async def test_check_field_headers_async(): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1347,7 +1337,7 @@ async def test_check_field_headers_async(): ) def test_report(request_type, transport: str = "grpc"): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1379,7 +1369,7 @@ def test_report_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1396,7 +1386,7 @@ async def test_report_async( transport: str = "grpc_asyncio", request_type=service_controller.ReportRequest ): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1433,7 +1423,7 @@ async def test_report_async_from_dict(): def test_report_field_headers(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1463,7 +1453,7 @@ def test_report_field_headers(): @pytest.mark.asyncio async def test_report_field_headers_async(): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1501,7 +1491,7 @@ async def test_report_field_headers_async(): ) def test_check_rest(request_type): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1539,7 +1529,7 @@ def test_check_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_check_rest_interceptors(null_interceptor): transport = transports.ServiceControllerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceControllerRestInterceptor(), @@ -1597,7 +1587,7 @@ def test_check_rest_bad_request( transport: str = "rest", request_type=service_controller.CheckRequest ): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1619,7 +1609,7 @@ def test_check_rest_bad_request( def test_check_rest_error(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -1632,7 +1622,7 @@ def test_check_rest_error(): ) def test_report_rest(request_type): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1668,7 +1658,7 @@ def test_report_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_report_rest_interceptors(null_interceptor): transport = transports.ServiceControllerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceControllerRestInterceptor(), @@ -1726,7 +1716,7 @@ def test_report_rest_bad_request( transport: str = "rest", request_type=service_controller.ReportRequest ): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1748,24 +1738,24 @@ def test_report_rest_bad_request( def test_report_rest_error(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceControllerClient( @@ -1775,7 +1765,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1790,13 +1780,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ServiceControllerClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceControllerClient( @@ -1808,7 +1797,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServiceControllerClient(transport=transport) assert client.transport is transport @@ -1817,13 +1806,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServiceControllerGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1840,7 +1829,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1854,7 +1843,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ServiceControllerClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1862,7 +1851,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1874,7 +1863,7 @@ def test_service_controller_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServiceControllerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1886,7 +1875,7 @@ def test_service_controller_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServiceControllerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1919,7 +1908,7 @@ def test_service_controller_base_transport_with_credentials_file(): "google.cloud.servicecontrol_v1.services.service_controller.transports.ServiceControllerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceControllerTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1941,7 +1930,7 @@ def test_service_controller_base_transport_with_adc(): "google.cloud.servicecontrol_v1.services.service_controller.transports.ServiceControllerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceControllerTransport() adc.assert_called_once() @@ -1949,7 +1938,7 @@ def test_service_controller_base_transport_with_adc(): def test_service_controller_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ServiceControllerClient() adc.assert_called_once_with( scopes=None, @@ -1972,7 +1961,7 @@ def test_service_controller_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2022,7 +2011,7 @@ def test_service_controller_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2053,7 +2042,7 @@ def test_service_controller_transport_create_channel(transport_class, grpc_helpe ], ) def test_service_controller_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2091,7 +2080,7 @@ def test_service_controller_grpc_transport_client_cert_source_for_mtls(transport def test_service_controller_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2111,7 +2100,7 @@ def test_service_controller_http_transport_client_cert_source_for_mtls(): ) def test_service_controller_host_no_port(transport_name): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicecontrol.googleapis.com" ), @@ -2134,7 +2123,7 @@ def test_service_controller_host_no_port(transport_name): ) def test_service_controller_host_with_port(transport_name): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicecontrol.googleapis.com:8000" ), @@ -2154,8 +2143,8 @@ def test_service_controller_host_with_port(transport_name): ], ) def test_service_controller_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ServiceControllerClient( credentials=creds1, transport=transport_name, @@ -2222,7 +2211,7 @@ def test_service_controller_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2408,7 +2397,7 @@ def test_client_with_default_client_info(): transports.ServiceControllerTransport, "_prep_wrapped_messages" ) as prep: client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2418,7 +2407,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServiceControllerClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2427,7 +2416,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2446,7 +2435,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2463,7 +2452,7 @@ def test_client_ctx(): ] for transport in transports: client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v2/test_service_controller.py b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v2/test_service_controller.py index 53143a9d1c61..7a8bc40ef5a5 100644 --- a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v2/test_service_controller.py +++ b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v2/test_service_controller.py @@ -82,18 +82,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -329,7 +317,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -356,42 +344,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -404,7 +399,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_service_controller_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -458,7 +453,7 @@ def test_service_controller_client_service_account_always_use_jwt( def test_service_controller_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -521,9 +516,7 @@ def test_service_controller_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ServiceControllerClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -942,20 +935,20 @@ def test_service_controller_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -967,13 +960,11 @@ def test_service_controller_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -989,8 +980,7 @@ def test_service_controller_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1148,8 +1138,8 @@ def test_service_controller_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1181,7 +1171,7 @@ def test_service_controller_client_create_channel_credentials_file( ) def test_check(request_type, transport: str = "grpc"): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1208,7 +1198,7 @@ def test_check_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1225,7 +1215,7 @@ async def test_check_async( transport: str = "grpc_asyncio", request_type=service_controller.CheckRequest ): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1257,7 +1247,7 @@ async def test_check_async_from_dict(): def test_check_field_headers(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1287,7 +1277,7 @@ def test_check_field_headers(): @pytest.mark.asyncio async def test_check_field_headers_async(): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1325,7 +1315,7 @@ async def test_check_field_headers_async(): ) def test_report(request_type, transport: str = "grpc"): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1352,7 +1342,7 @@ def test_report_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1369,7 +1359,7 @@ async def test_report_async( transport: str = "grpc_asyncio", request_type=service_controller.ReportRequest ): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1401,7 +1391,7 @@ async def test_report_async_from_dict(): def test_report_field_headers(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1431,7 +1421,7 @@ def test_report_field_headers(): @pytest.mark.asyncio async def test_report_field_headers_async(): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1469,7 +1459,7 @@ async def test_report_field_headers_async(): ) def test_check_rest(request_type): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1500,7 +1490,7 @@ def test_check_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_check_rest_interceptors(null_interceptor): transport = transports.ServiceControllerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceControllerRestInterceptor(), @@ -1558,7 +1548,7 @@ def test_check_rest_bad_request( transport: str = "rest", request_type=service_controller.CheckRequest ): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1580,7 +1570,7 @@ def test_check_rest_bad_request( def test_check_rest_error(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -1593,7 +1583,7 @@ def test_check_rest_error(): ) def test_report_rest(request_type): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1624,7 +1614,7 @@ def test_report_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_report_rest_interceptors(null_interceptor): transport = transports.ServiceControllerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceControllerRestInterceptor(), @@ -1682,7 +1672,7 @@ def test_report_rest_bad_request( transport: str = "rest", request_type=service_controller.ReportRequest ): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1704,24 +1694,24 @@ def test_report_rest_bad_request( def test_report_rest_error(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceControllerClient( @@ -1731,7 +1721,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1746,13 +1736,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ServiceControllerClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceControllerClient( @@ -1764,7 +1753,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServiceControllerClient(transport=transport) assert client.transport is transport @@ -1773,13 +1762,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceControllerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServiceControllerGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1796,7 +1785,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1810,7 +1799,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ServiceControllerClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1818,7 +1807,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1830,7 +1819,7 @@ def test_service_controller_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServiceControllerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1842,7 +1831,7 @@ def test_service_controller_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServiceControllerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1875,7 +1864,7 @@ def test_service_controller_base_transport_with_credentials_file(): "google.cloud.servicecontrol_v2.services.service_controller.transports.ServiceControllerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceControllerTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1897,7 +1886,7 @@ def test_service_controller_base_transport_with_adc(): "google.cloud.servicecontrol_v2.services.service_controller.transports.ServiceControllerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceControllerTransport() adc.assert_called_once() @@ -1905,7 +1894,7 @@ def test_service_controller_base_transport_with_adc(): def test_service_controller_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ServiceControllerClient() adc.assert_called_once_with( scopes=None, @@ -1928,7 +1917,7 @@ def test_service_controller_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -1978,7 +1967,7 @@ def test_service_controller_transport_create_channel(transport_class, grpc_helpe ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2009,7 +1998,7 @@ def test_service_controller_transport_create_channel(transport_class, grpc_helpe ], ) def test_service_controller_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2047,7 +2036,7 @@ def test_service_controller_grpc_transport_client_cert_source_for_mtls(transport def test_service_controller_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2067,7 +2056,7 @@ def test_service_controller_http_transport_client_cert_source_for_mtls(): ) def test_service_controller_host_no_port(transport_name): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicecontrol.googleapis.com" ), @@ -2090,7 +2079,7 @@ def test_service_controller_host_no_port(transport_name): ) def test_service_controller_host_with_port(transport_name): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicecontrol.googleapis.com:8000" ), @@ -2110,8 +2099,8 @@ def test_service_controller_host_with_port(transport_name): ], ) def test_service_controller_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ServiceControllerClient( credentials=creds1, transport=transport_name, @@ -2178,7 +2167,7 @@ def test_service_controller_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2364,7 +2353,7 @@ def test_client_with_default_client_info(): transports.ServiceControllerTransport, "_prep_wrapped_messages" ) as prep: client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2374,7 +2363,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServiceControllerClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2383,7 +2372,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServiceControllerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2402,7 +2391,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2419,7 +2408,7 @@ def test_client_ctx(): ] for transport in transports: client = ServiceControllerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-service-directory/google/cloud/servicedirectory/gapic_version.py b/packages/google-cloud-service-directory/google/cloud/servicedirectory/gapic_version.py index 4316e0e5df1f..360a0d13ebdd 100644 --- a/packages/google-cloud-service-directory/google/cloud/servicedirectory/gapic_version.py +++ b/packages/google-cloud-service-directory/google/cloud/servicedirectory/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.11.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/gapic_version.py b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/gapic_version.py index 4316e0e5df1f..360a0d13ebdd 100644 --- a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/gapic_version.py +++ b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.11.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/services/lookup_service/client.py b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/services/lookup_service/client.py index b5dab652cbe0..4a4b7aea808e 100644 --- a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/services/lookup_service/client.py +++ b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/services/lookup_service/client.py @@ -429,6 +429,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -447,6 +448,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -521,17 +523,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = LookupServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = LookupServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/services/registration_service/client.py b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/services/registration_service/client.py index 922c93374b2e..33948e7d42c3 100644 --- a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/services/registration_service/client.py +++ b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1/services/registration_service/client.py @@ -478,6 +478,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -496,6 +497,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -570,17 +572,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = RegistrationServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = RegistrationServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/gapic_version.py b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/gapic_version.py index 4316e0e5df1f..360a0d13ebdd 100644 --- a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/gapic_version.py +++ b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.11.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/services/lookup_service/client.py b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/services/lookup_service/client.py index 0e624b47bf3c..2673f5c06cce 100644 --- a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/services/lookup_service/client.py +++ b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/services/lookup_service/client.py @@ -429,6 +429,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -447,6 +448,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -521,17 +523,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = LookupServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = LookupServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py index e146d441f8ed..28fc2402edcb 100644 --- a/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py +++ b/packages/google-cloud-service-directory/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py @@ -480,6 +480,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -498,6 +499,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -572,17 +574,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = RegistrationServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = RegistrationServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-service-directory/samples/generated_samples/snippet_metadata_google.cloud.servicedirectory.v1.json b/packages/google-cloud-service-directory/samples/generated_samples/snippet_metadata_google.cloud.servicedirectory.v1.json index 6e036f108f12..a0b20f7bef18 100644 --- a/packages/google-cloud-service-directory/samples/generated_samples/snippet_metadata_google.cloud.servicedirectory.v1.json +++ b/packages/google-cloud-service-directory/samples/generated_samples/snippet_metadata_google.cloud.servicedirectory.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-service-directory", - "version": "1.11.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-service-directory/samples/generated_samples/snippet_metadata_google.cloud.servicedirectory.v1beta1.json b/packages/google-cloud-service-directory/samples/generated_samples/snippet_metadata_google.cloud.servicedirectory.v1beta1.json index 217f22eb1e7c..8cb020ecf895 100644 --- a/packages/google-cloud-service-directory/samples/generated_samples/snippet_metadata_google.cloud.servicedirectory.v1beta1.json +++ b/packages/google-cloud-service-directory/samples/generated_samples/snippet_metadata_google.cloud.servicedirectory.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-service-directory", - "version": "1.11.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-service-directory/servicedirectory-v1-py.tar.gz b/packages/google-cloud-service-directory/servicedirectory-v1-py.tar.gz new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/google-cloud-service-directory/setup.py b/packages/google-cloud-service-directory/setup.py index d48f6daca858..94a4029a96d6 100644 --- a/packages/google-cloud-service-directory/setup.py +++ b/packages/google-cloud-service-directory/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", diff --git a/packages/google-cloud-service-directory/testing/constraints-3.7.txt b/packages/google-cloud-service-directory/testing/constraints-3.7.txt index 44ffd04543a8..712d45b4c5ea 100644 --- a/packages/google-cloud-service-directory/testing/constraints-3.7.txt +++ b/packages/google-cloud-service-directory/testing/constraints-3.7.txt @@ -5,6 +5,7 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 grpc-google-iam-v1==0.12.4 diff --git a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_lookup_service.py b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_lookup_service.py index 91747e092feb..b70afbea3d54 100644 --- a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_lookup_service.py +++ b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_lookup_service.py @@ -77,18 +77,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -311,7 +299,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -338,42 +326,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -384,7 +379,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_lookup_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -436,7 +431,7 @@ def test_lookup_service_client_service_account_always_use_jwt( ], ) def test_lookup_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -499,9 +494,7 @@ def test_lookup_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(LookupServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -900,20 +893,20 @@ def test_lookup_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -925,13 +918,11 @@ def test_lookup_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -947,8 +938,7 @@ def test_lookup_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1101,8 +1091,8 @@ def test_lookup_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1131,7 +1121,7 @@ def test_lookup_service_client_create_channel_credentials_file( ) def test_resolve_service(request_type, transport: str = "grpc"): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1158,7 +1148,7 @@ def test_resolve_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1175,7 +1165,7 @@ async def test_resolve_service_async( transport: str = "grpc_asyncio", request_type=lookup_service.ResolveServiceRequest ): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1207,7 +1197,7 @@ async def test_resolve_service_async_from_dict(): def test_resolve_service_field_headers(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1237,7 +1227,7 @@ def test_resolve_service_field_headers(): @pytest.mark.asyncio async def test_resolve_service_field_headers_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1275,7 +1265,7 @@ async def test_resolve_service_field_headers_async(): ) def test_resolve_service_rest(request_type): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1325,7 +1315,7 @@ def test_resolve_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resolve_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1334,7 +1324,7 @@ def test_resolve_service_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resolve_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1343,7 +1333,7 @@ def test_resolve_service_rest_required_fields( assert jsonified_request["name"] == "name_value" client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1386,7 +1376,7 @@ def test_resolve_service_rest_required_fields( def test_resolve_service_rest_unset_required_fields(): transport = transports.LookupServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.resolve_service._get_unset_required_fields({}) @@ -1396,7 +1386,7 @@ def test_resolve_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_resolve_service_rest_interceptors(null_interceptor): transport = transports.LookupServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.LookupServiceRestInterceptor(), @@ -1454,7 +1444,7 @@ def test_resolve_service_rest_bad_request( transport: str = "rest", request_type=lookup_service.ResolveServiceRequest ): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1478,24 +1468,24 @@ def test_resolve_service_rest_bad_request( def test_resolve_service_rest_error(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = LookupServiceClient( @@ -1505,7 +1495,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1520,13 +1510,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = LookupServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = LookupServiceClient( @@ -1538,7 +1527,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = LookupServiceClient(transport=transport) assert client.transport is transport @@ -1547,13 +1536,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.LookupServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1570,7 +1559,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1584,7 +1573,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = LookupServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1592,7 +1581,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1604,7 +1593,7 @@ def test_lookup_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.LookupServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1616,7 +1605,7 @@ def test_lookup_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.LookupServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1650,7 +1639,7 @@ def test_lookup_service_base_transport_with_credentials_file(): "google.cloud.servicedirectory_v1.services.lookup_service.transports.LookupServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.LookupServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1669,7 +1658,7 @@ def test_lookup_service_base_transport_with_adc(): "google.cloud.servicedirectory_v1.services.lookup_service.transports.LookupServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.LookupServiceTransport() adc.assert_called_once() @@ -1677,7 +1666,7 @@ def test_lookup_service_base_transport_with_adc(): def test_lookup_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) LookupServiceClient() adc.assert_called_once_with( scopes=None, @@ -1697,7 +1686,7 @@ def test_lookup_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -1744,7 +1733,7 @@ def test_lookup_service_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -1772,7 +1761,7 @@ def test_lookup_service_transport_create_channel(transport_class, grpc_helpers): ], ) def test_lookup_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1810,7 +1799,7 @@ def test_lookup_service_grpc_transport_client_cert_source_for_mtls(transport_cla def test_lookup_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -1830,7 +1819,7 @@ def test_lookup_service_http_transport_client_cert_source_for_mtls(): ) def test_lookup_service_host_no_port(transport_name): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicedirectory.googleapis.com" ), @@ -1853,7 +1842,7 @@ def test_lookup_service_host_no_port(transport_name): ) def test_lookup_service_host_with_port(transport_name): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicedirectory.googleapis.com:8000" ), @@ -1873,8 +1862,8 @@ def test_lookup_service_host_with_port(transport_name): ], ) def test_lookup_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = LookupServiceClient( credentials=creds1, transport=transport_name, @@ -1936,7 +1925,7 @@ def test_lookup_service_transport_channel_mtls_with_client_cert_source(transport mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2208,7 +2197,7 @@ def test_client_with_default_client_info(): transports.LookupServiceTransport, "_prep_wrapped_messages" ) as prep: client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2218,7 +2207,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = LookupServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2227,7 +2216,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2242,7 +2231,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2272,7 +2261,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -2300,7 +2289,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2328,7 +2317,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -2354,7 +2343,7 @@ def test_list_locations_rest(request_type): def test_list_locations(transport: str = "grpc"): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2379,7 +2368,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2405,7 +2394,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2434,7 +2423,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2463,7 +2452,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -2481,7 +2470,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -2499,7 +2488,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2524,7 +2513,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2549,7 +2538,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): - client = LookupServiceClient(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = LookupServiceClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -2576,9 +2565,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): - client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + client = LookupServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -2606,7 +2593,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -2624,7 +2611,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -2648,7 +2635,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2665,7 +2652,7 @@ def test_client_ctx(): ] for transport in transports: client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_registration_service.py b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_registration_service.py index f2b033d1eb34..87d87acace49 100644 --- a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_registration_service.py +++ b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_registration_service.py @@ -89,18 +89,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -350,7 +338,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -377,42 +365,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -425,7 +420,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_registration_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -479,7 +474,7 @@ def test_registration_service_client_service_account_always_use_jwt( def test_registration_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -550,9 +545,7 @@ def test_registration_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(RegistrationServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -971,20 +964,20 @@ def test_registration_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -996,13 +989,11 @@ def test_registration_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1018,8 +1009,7 @@ def test_registration_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1185,8 +1175,8 @@ def test_registration_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1215,7 +1205,7 @@ def test_registration_service_client_create_channel_credentials_file( ) def test_create_namespace(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1247,7 +1237,7 @@ def test_create_namespace_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1265,7 +1255,7 @@ async def test_create_namespace_async( request_type=registration_service.CreateNamespaceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1302,7 +1292,7 @@ async def test_create_namespace_async_from_dict(): def test_create_namespace_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1332,7 +1322,7 @@ def test_create_namespace_field_headers(): @pytest.mark.asyncio async def test_create_namespace_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1363,7 +1353,7 @@ async def test_create_namespace_field_headers_async(): def test_create_namespace_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1395,7 +1385,7 @@ def test_create_namespace_flattened(): def test_create_namespace_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1412,7 +1402,7 @@ def test_create_namespace_flattened_error(): @pytest.mark.asyncio async def test_create_namespace_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1449,7 +1439,7 @@ async def test_create_namespace_flattened_async(): @pytest.mark.asyncio async def test_create_namespace_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1472,7 +1462,7 @@ async def test_create_namespace_flattened_error_async(): ) def test_list_namespaces(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1502,7 +1492,7 @@ def test_list_namespaces_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1520,7 +1510,7 @@ async def test_list_namespaces_async( request_type=registration_service.ListNamespacesRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1555,7 +1545,7 @@ async def test_list_namespaces_async_from_dict(): def test_list_namespaces_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1585,7 +1575,7 @@ def test_list_namespaces_field_headers(): @pytest.mark.asyncio async def test_list_namespaces_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1616,7 +1606,7 @@ async def test_list_namespaces_field_headers_async(): def test_list_namespaces_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1640,7 +1630,7 @@ def test_list_namespaces_flattened(): def test_list_namespaces_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1655,7 +1645,7 @@ def test_list_namespaces_flattened_error(): @pytest.mark.asyncio async def test_list_namespaces_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1684,7 +1674,7 @@ async def test_list_namespaces_flattened_async(): @pytest.mark.asyncio async def test_list_namespaces_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1698,7 +1688,7 @@ async def test_list_namespaces_flattened_error_async(): def test_list_namespaces_pager(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1748,7 +1738,7 @@ def test_list_namespaces_pager(transport_name: str = "grpc"): def test_list_namespaces_pages(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1790,7 +1780,7 @@ def test_list_namespaces_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_namespaces_async_pager(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1840,7 +1830,7 @@ async def test_list_namespaces_async_pager(): @pytest.mark.asyncio async def test_list_namespaces_async_pages(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1895,7 +1885,7 @@ async def test_list_namespaces_async_pages(): ) def test_get_namespace(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1927,7 +1917,7 @@ def test_get_namespace_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1945,7 +1935,7 @@ async def test_get_namespace_async( request_type=registration_service.GetNamespaceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1982,7 +1972,7 @@ async def test_get_namespace_async_from_dict(): def test_get_namespace_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2012,7 +2002,7 @@ def test_get_namespace_field_headers(): @pytest.mark.asyncio async def test_get_namespace_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2041,7 +2031,7 @@ async def test_get_namespace_field_headers_async(): def test_get_namespace_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2065,7 +2055,7 @@ def test_get_namespace_flattened(): def test_get_namespace_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2080,7 +2070,7 @@ def test_get_namespace_flattened_error(): @pytest.mark.asyncio async def test_get_namespace_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2107,7 +2097,7 @@ async def test_get_namespace_flattened_async(): @pytest.mark.asyncio async def test_get_namespace_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2128,7 +2118,7 @@ async def test_get_namespace_flattened_error_async(): ) def test_update_namespace(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2160,7 +2150,7 @@ def test_update_namespace_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2178,7 +2168,7 @@ async def test_update_namespace_async( request_type=registration_service.UpdateNamespaceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2215,7 +2205,7 @@ async def test_update_namespace_async_from_dict(): def test_update_namespace_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2245,7 +2235,7 @@ def test_update_namespace_field_headers(): @pytest.mark.asyncio async def test_update_namespace_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2276,7 +2266,7 @@ async def test_update_namespace_field_headers_async(): def test_update_namespace_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2304,7 +2294,7 @@ def test_update_namespace_flattened(): def test_update_namespace_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2320,7 +2310,7 @@ def test_update_namespace_flattened_error(): @pytest.mark.asyncio async def test_update_namespace_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2353,7 +2343,7 @@ async def test_update_namespace_flattened_async(): @pytest.mark.asyncio async def test_update_namespace_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2375,7 +2365,7 @@ async def test_update_namespace_flattened_error_async(): ) def test_delete_namespace(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2402,7 +2392,7 @@ def test_delete_namespace_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2420,7 +2410,7 @@ async def test_delete_namespace_async( request_type=registration_service.DeleteNamespaceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2450,7 +2440,7 @@ async def test_delete_namespace_async_from_dict(): def test_delete_namespace_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2480,7 +2470,7 @@ def test_delete_namespace_field_headers(): @pytest.mark.asyncio async def test_delete_namespace_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2509,7 +2499,7 @@ async def test_delete_namespace_field_headers_async(): def test_delete_namespace_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2533,7 +2523,7 @@ def test_delete_namespace_flattened(): def test_delete_namespace_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2548,7 +2538,7 @@ def test_delete_namespace_flattened_error(): @pytest.mark.asyncio async def test_delete_namespace_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2575,7 +2565,7 @@ async def test_delete_namespace_flattened_async(): @pytest.mark.asyncio async def test_delete_namespace_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2596,7 +2586,7 @@ async def test_delete_namespace_flattened_error_async(): ) def test_create_service(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2628,7 +2618,7 @@ def test_create_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2646,7 +2636,7 @@ async def test_create_service_async( request_type=registration_service.CreateServiceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2683,7 +2673,7 @@ async def test_create_service_async_from_dict(): def test_create_service_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2713,7 +2703,7 @@ def test_create_service_field_headers(): @pytest.mark.asyncio async def test_create_service_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2742,7 +2732,7 @@ async def test_create_service_field_headers_async(): def test_create_service_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2774,7 +2764,7 @@ def test_create_service_flattened(): def test_create_service_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2791,7 +2781,7 @@ def test_create_service_flattened_error(): @pytest.mark.asyncio async def test_create_service_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2826,7 +2816,7 @@ async def test_create_service_flattened_async(): @pytest.mark.asyncio async def test_create_service_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2849,7 +2839,7 @@ async def test_create_service_flattened_error_async(): ) def test_list_services(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2879,7 +2869,7 @@ def test_list_services_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2897,7 +2887,7 @@ async def test_list_services_async( request_type=registration_service.ListServicesRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2932,7 +2922,7 @@ async def test_list_services_async_from_dict(): def test_list_services_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2962,7 +2952,7 @@ def test_list_services_field_headers(): @pytest.mark.asyncio async def test_list_services_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2993,7 +2983,7 @@ async def test_list_services_field_headers_async(): def test_list_services_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3017,7 +3007,7 @@ def test_list_services_flattened(): def test_list_services_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3032,7 +3022,7 @@ def test_list_services_flattened_error(): @pytest.mark.asyncio async def test_list_services_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3061,7 +3051,7 @@ async def test_list_services_flattened_async(): @pytest.mark.asyncio async def test_list_services_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3075,7 +3065,7 @@ async def test_list_services_flattened_error_async(): def test_list_services_pager(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3125,7 +3115,7 @@ def test_list_services_pager(transport_name: str = "grpc"): def test_list_services_pages(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3167,7 +3157,7 @@ def test_list_services_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_services_async_pager(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3217,7 +3207,7 @@ async def test_list_services_async_pager(): @pytest.mark.asyncio async def test_list_services_async_pages(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3272,7 +3262,7 @@ async def test_list_services_async_pages(): ) def test_get_service(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3304,7 +3294,7 @@ def test_get_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3321,7 +3311,7 @@ async def test_get_service_async( transport: str = "grpc_asyncio", request_type=registration_service.GetServiceRequest ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3358,7 +3348,7 @@ async def test_get_service_async_from_dict(): def test_get_service_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3388,7 +3378,7 @@ def test_get_service_field_headers(): @pytest.mark.asyncio async def test_get_service_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3417,7 +3407,7 @@ async def test_get_service_field_headers_async(): def test_get_service_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3441,7 +3431,7 @@ def test_get_service_flattened(): def test_get_service_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3456,7 +3446,7 @@ def test_get_service_flattened_error(): @pytest.mark.asyncio async def test_get_service_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3483,7 +3473,7 @@ async def test_get_service_flattened_async(): @pytest.mark.asyncio async def test_get_service_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3504,7 +3494,7 @@ async def test_get_service_flattened_error_async(): ) def test_update_service(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3536,7 +3526,7 @@ def test_update_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3554,7 +3544,7 @@ async def test_update_service_async( request_type=registration_service.UpdateServiceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3591,7 +3581,7 @@ async def test_update_service_async_from_dict(): def test_update_service_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3621,7 +3611,7 @@ def test_update_service_field_headers(): @pytest.mark.asyncio async def test_update_service_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3650,7 +3640,7 @@ async def test_update_service_field_headers_async(): def test_update_service_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3678,7 +3668,7 @@ def test_update_service_flattened(): def test_update_service_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3694,7 +3684,7 @@ def test_update_service_flattened_error(): @pytest.mark.asyncio async def test_update_service_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3725,7 +3715,7 @@ async def test_update_service_flattened_async(): @pytest.mark.asyncio async def test_update_service_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3747,7 +3737,7 @@ async def test_update_service_flattened_error_async(): ) def test_delete_service(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3774,7 +3764,7 @@ def test_delete_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3792,7 +3782,7 @@ async def test_delete_service_async( request_type=registration_service.DeleteServiceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3822,7 +3812,7 @@ async def test_delete_service_async_from_dict(): def test_delete_service_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3852,7 +3842,7 @@ def test_delete_service_field_headers(): @pytest.mark.asyncio async def test_delete_service_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3881,7 +3871,7 @@ async def test_delete_service_field_headers_async(): def test_delete_service_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3905,7 +3895,7 @@ def test_delete_service_flattened(): def test_delete_service_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3920,7 +3910,7 @@ def test_delete_service_flattened_error(): @pytest.mark.asyncio async def test_delete_service_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3947,7 +3937,7 @@ async def test_delete_service_flattened_async(): @pytest.mark.asyncio async def test_delete_service_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3968,7 +3958,7 @@ async def test_delete_service_flattened_error_async(): ) def test_create_endpoint(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4006,7 +3996,7 @@ def test_create_endpoint_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4024,7 +4014,7 @@ async def test_create_endpoint_async( request_type=registration_service.CreateEndpointRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4067,7 +4057,7 @@ async def test_create_endpoint_async_from_dict(): def test_create_endpoint_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4097,7 +4087,7 @@ def test_create_endpoint_field_headers(): @pytest.mark.asyncio async def test_create_endpoint_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4128,7 +4118,7 @@ async def test_create_endpoint_field_headers_async(): def test_create_endpoint_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4160,7 +4150,7 @@ def test_create_endpoint_flattened(): def test_create_endpoint_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4177,7 +4167,7 @@ def test_create_endpoint_flattened_error(): @pytest.mark.asyncio async def test_create_endpoint_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4214,7 +4204,7 @@ async def test_create_endpoint_flattened_async(): @pytest.mark.asyncio async def test_create_endpoint_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4237,7 +4227,7 @@ async def test_create_endpoint_flattened_error_async(): ) def test_list_endpoints(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4267,7 +4257,7 @@ def test_list_endpoints_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4285,7 +4275,7 @@ async def test_list_endpoints_async( request_type=registration_service.ListEndpointsRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4320,7 +4310,7 @@ async def test_list_endpoints_async_from_dict(): def test_list_endpoints_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4350,7 +4340,7 @@ def test_list_endpoints_field_headers(): @pytest.mark.asyncio async def test_list_endpoints_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4381,7 +4371,7 @@ async def test_list_endpoints_field_headers_async(): def test_list_endpoints_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4405,7 +4395,7 @@ def test_list_endpoints_flattened(): def test_list_endpoints_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4420,7 +4410,7 @@ def test_list_endpoints_flattened_error(): @pytest.mark.asyncio async def test_list_endpoints_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4449,7 +4439,7 @@ async def test_list_endpoints_flattened_async(): @pytest.mark.asyncio async def test_list_endpoints_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4463,7 +4453,7 @@ async def test_list_endpoints_flattened_error_async(): def test_list_endpoints_pager(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4513,7 +4503,7 @@ def test_list_endpoints_pager(transport_name: str = "grpc"): def test_list_endpoints_pages(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4555,7 +4545,7 @@ def test_list_endpoints_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_endpoints_async_pager(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4605,7 +4595,7 @@ async def test_list_endpoints_async_pager(): @pytest.mark.asyncio async def test_list_endpoints_async_pages(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4660,7 +4650,7 @@ async def test_list_endpoints_async_pages(): ) def test_get_endpoint(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4698,7 +4688,7 @@ def test_get_endpoint_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4716,7 +4706,7 @@ async def test_get_endpoint_async( request_type=registration_service.GetEndpointRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4759,7 +4749,7 @@ async def test_get_endpoint_async_from_dict(): def test_get_endpoint_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4789,7 +4779,7 @@ def test_get_endpoint_field_headers(): @pytest.mark.asyncio async def test_get_endpoint_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4818,7 +4808,7 @@ async def test_get_endpoint_field_headers_async(): def test_get_endpoint_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4842,7 +4832,7 @@ def test_get_endpoint_flattened(): def test_get_endpoint_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4857,7 +4847,7 @@ def test_get_endpoint_flattened_error(): @pytest.mark.asyncio async def test_get_endpoint_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4884,7 +4874,7 @@ async def test_get_endpoint_flattened_async(): @pytest.mark.asyncio async def test_get_endpoint_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4905,7 +4895,7 @@ async def test_get_endpoint_flattened_error_async(): ) def test_update_endpoint(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4943,7 +4933,7 @@ def test_update_endpoint_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4961,7 +4951,7 @@ async def test_update_endpoint_async( request_type=registration_service.UpdateEndpointRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5004,7 +4994,7 @@ async def test_update_endpoint_async_from_dict(): def test_update_endpoint_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5034,7 +5024,7 @@ def test_update_endpoint_field_headers(): @pytest.mark.asyncio async def test_update_endpoint_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5065,7 +5055,7 @@ async def test_update_endpoint_field_headers_async(): def test_update_endpoint_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5093,7 +5083,7 @@ def test_update_endpoint_flattened(): def test_update_endpoint_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5109,7 +5099,7 @@ def test_update_endpoint_flattened_error(): @pytest.mark.asyncio async def test_update_endpoint_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5142,7 +5132,7 @@ async def test_update_endpoint_flattened_async(): @pytest.mark.asyncio async def test_update_endpoint_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5164,7 +5154,7 @@ async def test_update_endpoint_flattened_error_async(): ) def test_delete_endpoint(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5191,7 +5181,7 @@ def test_delete_endpoint_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5209,7 +5199,7 @@ async def test_delete_endpoint_async( request_type=registration_service.DeleteEndpointRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5239,7 +5229,7 @@ async def test_delete_endpoint_async_from_dict(): def test_delete_endpoint_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5269,7 +5259,7 @@ def test_delete_endpoint_field_headers(): @pytest.mark.asyncio async def test_delete_endpoint_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5298,7 +5288,7 @@ async def test_delete_endpoint_field_headers_async(): def test_delete_endpoint_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5322,7 +5312,7 @@ def test_delete_endpoint_flattened(): def test_delete_endpoint_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5337,7 +5327,7 @@ def test_delete_endpoint_flattened_error(): @pytest.mark.asyncio async def test_delete_endpoint_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5364,7 +5354,7 @@ async def test_delete_endpoint_flattened_async(): @pytest.mark.asyncio async def test_delete_endpoint_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5385,7 +5375,7 @@ async def test_delete_endpoint_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5417,7 +5407,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5434,7 +5424,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5471,7 +5461,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5501,7 +5491,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5530,7 +5520,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -5554,7 +5544,7 @@ def test_get_iam_policy_from_dict_foreign(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5586,7 +5576,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5603,7 +5593,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5640,7 +5630,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5670,7 +5660,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5699,7 +5689,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -5724,7 +5714,7 @@ def test_set_iam_policy_from_dict_foreign(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5756,7 +5746,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5776,7 +5766,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5813,7 +5803,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5845,7 +5835,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5878,7 +5868,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5904,7 +5894,7 @@ def test_test_iam_permissions_from_dict_foreign(): ) def test_create_namespace_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6027,7 +6017,7 @@ def test_create_namespace_rest_required_fields( assert "namespaceId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6039,7 +6029,7 @@ def test_create_namespace_rest_required_fields( jsonified_request["namespaceId"] = "namespace_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_namespace._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("namespace_id",)) @@ -6052,7 +6042,7 @@ def test_create_namespace_rest_required_fields( assert jsonified_request["namespaceId"] == "namespace_id_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6101,7 +6091,7 @@ def test_create_namespace_rest_required_fields( def test_create_namespace_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_namespace._get_unset_required_fields({}) @@ -6120,7 +6110,7 @@ def test_create_namespace_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_namespace_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -6178,7 +6168,7 @@ def test_create_namespace_rest_bad_request( transport: str = "rest", request_type=registration_service.CreateNamespaceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6200,7 +6190,7 @@ def test_create_namespace_rest_bad_request( def test_create_namespace_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6243,7 +6233,7 @@ def test_create_namespace_rest_flattened(): def test_create_namespace_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6260,7 +6250,7 @@ def test_create_namespace_rest_flattened_error(transport: str = "rest"): def test_create_namespace_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6273,7 +6263,7 @@ def test_create_namespace_rest_error(): ) def test_list_namespaces_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6324,7 +6314,7 @@ def test_list_namespaces_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_namespaces._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6333,7 +6323,7 @@ def test_list_namespaces_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_namespaces._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -6351,7 +6341,7 @@ def test_list_namespaces_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6393,7 +6383,7 @@ def test_list_namespaces_rest_required_fields( def test_list_namespaces_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_namespaces._get_unset_required_fields({}) @@ -6413,7 +6403,7 @@ def test_list_namespaces_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_namespaces_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -6471,7 +6461,7 @@ def test_list_namespaces_rest_bad_request( transport: str = "rest", request_type=registration_service.ListNamespacesRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6493,7 +6483,7 @@ def test_list_namespaces_rest_bad_request( def test_list_namespaces_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6534,7 +6524,7 @@ def test_list_namespaces_rest_flattened(): def test_list_namespaces_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6549,7 +6539,7 @@ def test_list_namespaces_rest_flattened_error(transport: str = "rest"): def test_list_namespaces_rest_pager(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6619,7 +6609,7 @@ def test_list_namespaces_rest_pager(transport: str = "rest"): ) def test_get_namespace_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6672,7 +6662,7 @@ def test_get_namespace_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6681,7 +6671,7 @@ def test_get_namespace_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6690,7 +6680,7 @@ def test_get_namespace_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6732,7 +6722,7 @@ def test_get_namespace_rest_required_fields( def test_get_namespace_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_namespace._get_unset_required_fields({}) @@ -6742,7 +6732,7 @@ def test_get_namespace_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_namespace_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -6798,7 +6788,7 @@ def test_get_namespace_rest_bad_request( transport: str = "rest", request_type=registration_service.GetNamespaceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6820,7 +6810,7 @@ def test_get_namespace_rest_bad_request( def test_get_namespace_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6863,7 +6853,7 @@ def test_get_namespace_rest_flattened(): def test_get_namespace_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6878,7 +6868,7 @@ def test_get_namespace_rest_flattened_error(transport: str = "rest"): def test_get_namespace_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6891,7 +6881,7 @@ def test_get_namespace_rest_error(): ) def test_update_namespace_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7017,14 +7007,14 @@ def test_update_namespace_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_namespace._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -7033,7 +7023,7 @@ def test_update_namespace_rest_required_fields( # verify required fields with non-default values are left alone client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7076,7 +7066,7 @@ def test_update_namespace_rest_required_fields( def test_update_namespace_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_namespace._get_unset_required_fields({}) @@ -7094,7 +7084,7 @@ def test_update_namespace_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_namespace_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -7152,7 +7142,7 @@ def test_update_namespace_rest_bad_request( transport: str = "rest", request_type=registration_service.UpdateNamespaceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7176,7 +7166,7 @@ def test_update_namespace_rest_bad_request( def test_update_namespace_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7223,7 +7213,7 @@ def test_update_namespace_rest_flattened(): def test_update_namespace_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7239,7 +7229,7 @@ def test_update_namespace_rest_flattened_error(transport: str = "rest"): def test_update_namespace_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7252,7 +7242,7 @@ def test_update_namespace_rest_error(): ) def test_delete_namespace_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7298,7 +7288,7 @@ def test_delete_namespace_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7307,7 +7297,7 @@ def test_delete_namespace_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7316,7 +7306,7 @@ def test_delete_namespace_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7355,7 +7345,7 @@ def test_delete_namespace_rest_required_fields( def test_delete_namespace_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_namespace._get_unset_required_fields({}) @@ -7365,7 +7355,7 @@ def test_delete_namespace_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_namespace_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -7415,7 +7405,7 @@ def test_delete_namespace_rest_bad_request( transport: str = "rest", request_type=registration_service.DeleteNamespaceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7437,7 +7427,7 @@ def test_delete_namespace_rest_bad_request( def test_delete_namespace_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7478,7 +7468,7 @@ def test_delete_namespace_rest_flattened(): def test_delete_namespace_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7493,7 +7483,7 @@ def test_delete_namespace_rest_flattened_error(transport: str = "rest"): def test_delete_namespace_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7506,7 +7496,7 @@ def test_delete_namespace_rest_error(): ) def test_create_service_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7643,7 +7633,7 @@ def test_create_service_rest_required_fields( assert "serviceId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7655,7 +7645,7 @@ def test_create_service_rest_required_fields( jsonified_request["serviceId"] = "service_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("service_id",)) @@ -7668,7 +7658,7 @@ def test_create_service_rest_required_fields( assert jsonified_request["serviceId"] == "service_id_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7717,7 +7707,7 @@ def test_create_service_rest_required_fields( def test_create_service_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_service._get_unset_required_fields({}) @@ -7736,7 +7726,7 @@ def test_create_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_service_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -7792,7 +7782,7 @@ def test_create_service_rest_bad_request( transport: str = "rest", request_type=registration_service.CreateServiceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7814,7 +7804,7 @@ def test_create_service_rest_bad_request( def test_create_service_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7860,7 +7850,7 @@ def test_create_service_rest_flattened(): def test_create_service_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7877,7 +7867,7 @@ def test_create_service_rest_flattened_error(transport: str = "rest"): def test_create_service_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7890,7 +7880,7 @@ def test_create_service_rest_error(): ) def test_list_services_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7941,7 +7931,7 @@ def test_list_services_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_services._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7950,7 +7940,7 @@ def test_list_services_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_services._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -7968,7 +7958,7 @@ def test_list_services_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8010,7 +8000,7 @@ def test_list_services_rest_required_fields( def test_list_services_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_services._get_unset_required_fields({}) @@ -8030,7 +8020,7 @@ def test_list_services_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_services_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -8088,7 +8078,7 @@ def test_list_services_rest_bad_request( transport: str = "rest", request_type=registration_service.ListServicesRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8110,7 +8100,7 @@ def test_list_services_rest_bad_request( def test_list_services_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8154,7 +8144,7 @@ def test_list_services_rest_flattened(): def test_list_services_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8169,7 +8159,7 @@ def test_list_services_rest_flattened_error(transport: str = "rest"): def test_list_services_rest_pager(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8241,7 +8231,7 @@ def test_list_services_rest_pager(transport: str = "rest"): ) def test_get_service_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8296,7 +8286,7 @@ def test_get_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8305,7 +8295,7 @@ def test_get_service_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8314,7 +8304,7 @@ def test_get_service_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8356,7 +8346,7 @@ def test_get_service_rest_required_fields( def test_get_service_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_service._get_unset_required_fields({}) @@ -8366,7 +8356,7 @@ def test_get_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_service_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -8422,7 +8412,7 @@ def test_get_service_rest_bad_request( transport: str = "rest", request_type=registration_service.GetServiceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8446,7 +8436,7 @@ def test_get_service_rest_bad_request( def test_get_service_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8490,7 +8480,7 @@ def test_get_service_rest_flattened(): def test_get_service_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8505,7 +8495,7 @@ def test_get_service_rest_flattened_error(transport: str = "rest"): def test_get_service_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8518,7 +8508,7 @@ def test_get_service_rest_error(): ) def test_update_service_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8656,14 +8646,14 @@ def test_update_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_service._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -8672,7 +8662,7 @@ def test_update_service_rest_required_fields( # verify required fields with non-default values are left alone client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8715,7 +8705,7 @@ def test_update_service_rest_required_fields( def test_update_service_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_service._get_unset_required_fields({}) @@ -8733,7 +8723,7 @@ def test_update_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_service_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -8789,7 +8779,7 @@ def test_update_service_rest_bad_request( transport: str = "rest", request_type=registration_service.UpdateServiceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8815,7 +8805,7 @@ def test_update_service_rest_bad_request( def test_update_service_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8862,7 +8852,7 @@ def test_update_service_rest_flattened(): def test_update_service_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8878,7 +8868,7 @@ def test_update_service_rest_flattened_error(transport: str = "rest"): def test_update_service_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8891,7 +8881,7 @@ def test_update_service_rest_error(): ) def test_delete_service_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8939,7 +8929,7 @@ def test_delete_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8948,7 +8938,7 @@ def test_delete_service_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8957,7 +8947,7 @@ def test_delete_service_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8996,7 +8986,7 @@ def test_delete_service_rest_required_fields( def test_delete_service_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_service._get_unset_required_fields({}) @@ -9006,7 +8996,7 @@ def test_delete_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_service_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -9056,7 +9046,7 @@ def test_delete_service_rest_bad_request( transport: str = "rest", request_type=registration_service.DeleteServiceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9080,7 +9070,7 @@ def test_delete_service_rest_bad_request( def test_delete_service_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9122,7 +9112,7 @@ def test_delete_service_rest_flattened(): def test_delete_service_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9137,7 +9127,7 @@ def test_delete_service_rest_flattened_error(transport: str = "rest"): def test_delete_service_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9150,7 +9140,7 @@ def test_delete_service_rest_error(): ) def test_create_endpoint_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9288,7 +9278,7 @@ def test_create_endpoint_rest_required_fields( assert "endpointId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9300,7 +9290,7 @@ def test_create_endpoint_rest_required_fields( jsonified_request["endpointId"] = "endpoint_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_endpoint._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("endpoint_id",)) @@ -9313,7 +9303,7 @@ def test_create_endpoint_rest_required_fields( assert jsonified_request["endpointId"] == "endpoint_id_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9362,7 +9352,7 @@ def test_create_endpoint_rest_required_fields( def test_create_endpoint_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_endpoint._get_unset_required_fields({}) @@ -9381,7 +9371,7 @@ def test_create_endpoint_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_endpoint_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -9439,7 +9429,7 @@ def test_create_endpoint_rest_bad_request( transport: str = "rest", request_type=registration_service.CreateEndpointRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9463,7 +9453,7 @@ def test_create_endpoint_rest_bad_request( def test_create_endpoint_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9509,7 +9499,7 @@ def test_create_endpoint_rest_flattened(): def test_create_endpoint_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9526,7 +9516,7 @@ def test_create_endpoint_rest_flattened_error(transport: str = "rest"): def test_create_endpoint_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9539,7 +9529,7 @@ def test_create_endpoint_rest_error(): ) def test_list_endpoints_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9592,7 +9582,7 @@ def test_list_endpoints_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_endpoints._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9601,7 +9591,7 @@ def test_list_endpoints_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_endpoints._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -9619,7 +9609,7 @@ def test_list_endpoints_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9661,7 +9651,7 @@ def test_list_endpoints_rest_required_fields( def test_list_endpoints_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_endpoints._get_unset_required_fields({}) @@ -9681,7 +9671,7 @@ def test_list_endpoints_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_endpoints_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -9739,7 +9729,7 @@ def test_list_endpoints_rest_bad_request( transport: str = "rest", request_type=registration_service.ListEndpointsRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9763,7 +9753,7 @@ def test_list_endpoints_rest_bad_request( def test_list_endpoints_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9807,7 +9797,7 @@ def test_list_endpoints_rest_flattened(): def test_list_endpoints_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9822,7 +9812,7 @@ def test_list_endpoints_rest_flattened_error(transport: str = "rest"): def test_list_endpoints_rest_pager(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9894,7 +9884,7 @@ def test_list_endpoints_rest_pager(transport: str = "rest"): ) def test_get_endpoint_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9955,7 +9945,7 @@ def test_get_endpoint_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9964,7 +9954,7 @@ def test_get_endpoint_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9973,7 +9963,7 @@ def test_get_endpoint_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10015,7 +10005,7 @@ def test_get_endpoint_rest_required_fields( def test_get_endpoint_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_endpoint._get_unset_required_fields({}) @@ -10025,7 +10015,7 @@ def test_get_endpoint_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_endpoint_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -10081,7 +10071,7 @@ def test_get_endpoint_rest_bad_request( transport: str = "rest", request_type=registration_service.GetEndpointRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10105,7 +10095,7 @@ def test_get_endpoint_rest_bad_request( def test_get_endpoint_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10149,7 +10139,7 @@ def test_get_endpoint_rest_flattened(): def test_get_endpoint_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10164,7 +10154,7 @@ def test_get_endpoint_rest_flattened_error(transport: str = "rest"): def test_get_endpoint_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10177,7 +10167,7 @@ def test_get_endpoint_rest_error(): ) def test_update_endpoint_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10314,14 +10304,14 @@ def test_update_endpoint_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_endpoint._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -10330,7 +10320,7 @@ def test_update_endpoint_rest_required_fields( # verify required fields with non-default values are left alone client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10373,7 +10363,7 @@ def test_update_endpoint_rest_required_fields( def test_update_endpoint_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_endpoint._get_unset_required_fields({}) @@ -10391,7 +10381,7 @@ def test_update_endpoint_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_endpoint_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -10449,7 +10439,7 @@ def test_update_endpoint_rest_bad_request( transport: str = "rest", request_type=registration_service.UpdateEndpointRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10475,7 +10465,7 @@ def test_update_endpoint_rest_bad_request( def test_update_endpoint_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10522,7 +10512,7 @@ def test_update_endpoint_rest_flattened(): def test_update_endpoint_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10538,7 +10528,7 @@ def test_update_endpoint_rest_flattened_error(transport: str = "rest"): def test_update_endpoint_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10551,7 +10541,7 @@ def test_update_endpoint_rest_error(): ) def test_delete_endpoint_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10599,7 +10589,7 @@ def test_delete_endpoint_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10608,7 +10598,7 @@ def test_delete_endpoint_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10617,7 +10607,7 @@ def test_delete_endpoint_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10656,7 +10646,7 @@ def test_delete_endpoint_rest_required_fields( def test_delete_endpoint_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_endpoint._get_unset_required_fields({}) @@ -10666,7 +10656,7 @@ def test_delete_endpoint_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_endpoint_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -10716,7 +10706,7 @@ def test_delete_endpoint_rest_bad_request( transport: str = "rest", request_type=registration_service.DeleteEndpointRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10740,7 +10730,7 @@ def test_delete_endpoint_rest_bad_request( def test_delete_endpoint_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10782,7 +10772,7 @@ def test_delete_endpoint_rest_flattened(): def test_delete_endpoint_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10797,7 +10787,7 @@ def test_delete_endpoint_rest_flattened_error(transport: str = "rest"): def test_delete_endpoint_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10810,7 +10800,7 @@ def test_delete_endpoint_rest_error(): ) def test_get_iam_policy_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10861,7 +10851,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10870,7 +10860,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10879,7 +10869,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10920,7 +10910,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -10930,7 +10920,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -10984,7 +10974,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11006,7 +10996,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -11019,7 +11009,7 @@ def test_get_iam_policy_rest_error(): ) def test_set_iam_policy_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11070,7 +11060,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11079,7 +11069,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11088,7 +11078,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11129,7 +11119,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -11147,7 +11137,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -11201,7 +11191,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11223,7 +11213,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -11236,7 +11226,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11286,7 +11276,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11296,7 +11286,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11307,7 +11297,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11348,7 +11338,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -11366,7 +11356,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -11422,7 +11412,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11444,24 +11434,24 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = RegistrationServiceClient( @@ -11471,7 +11461,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -11486,13 +11476,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegistrationServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = RegistrationServiceClient( @@ -11504,7 +11493,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = RegistrationServiceClient(transport=transport) assert client.transport is transport @@ -11513,13 +11502,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.RegistrationServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -11536,7 +11525,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -11550,7 +11539,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = RegistrationServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -11558,7 +11547,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -11570,7 +11559,7 @@ def test_registration_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.RegistrationServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -11582,7 +11571,7 @@ def test_registration_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.RegistrationServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -11633,7 +11622,7 @@ def test_registration_service_base_transport_with_credentials_file(): "google.cloud.servicedirectory_v1.services.registration_service.transports.RegistrationServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegistrationServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -11652,7 +11641,7 @@ def test_registration_service_base_transport_with_adc(): "google.cloud.servicedirectory_v1.services.registration_service.transports.RegistrationServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegistrationServiceTransport() adc.assert_called_once() @@ -11660,7 +11649,7 @@ def test_registration_service_base_transport_with_adc(): def test_registration_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) RegistrationServiceClient() adc.assert_called_once_with( scopes=None, @@ -11680,7 +11669,7 @@ def test_registration_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -11727,7 +11716,7 @@ def test_registration_service_transport_create_channel(transport_class, grpc_hel ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -11757,7 +11746,7 @@ def test_registration_service_transport_create_channel(transport_class, grpc_hel def test_registration_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -11795,7 +11784,7 @@ def test_registration_service_grpc_transport_client_cert_source_for_mtls( def test_registration_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -11815,7 +11804,7 @@ def test_registration_service_http_transport_client_cert_source_for_mtls(): ) def test_registration_service_host_no_port(transport_name): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicedirectory.googleapis.com" ), @@ -11838,7 +11827,7 @@ def test_registration_service_host_no_port(transport_name): ) def test_registration_service_host_with_port(transport_name): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicedirectory.googleapis.com:8000" ), @@ -11858,8 +11847,8 @@ def test_registration_service_host_with_port(transport_name): ], ) def test_registration_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = RegistrationServiceClient( credentials=creds1, transport=transport_name, @@ -11974,7 +11963,7 @@ def test_registration_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -12274,7 +12263,7 @@ def test_client_with_default_client_info(): transports.RegistrationServiceTransport, "_prep_wrapped_messages" ) as prep: client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -12284,7 +12273,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegistrationServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -12293,7 +12282,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -12308,7 +12297,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12338,7 +12327,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -12366,7 +12355,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12394,7 +12383,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -12420,7 +12409,7 @@ def test_list_locations_rest(request_type): def test_list_locations(transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12445,7 +12434,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12471,7 +12460,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12500,7 +12489,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12529,7 +12518,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -12547,7 +12536,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -12565,7 +12554,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12590,7 +12579,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12616,7 +12605,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12645,7 +12634,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12674,7 +12663,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -12692,7 +12681,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -12716,7 +12705,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -12733,7 +12722,7 @@ def test_client_ctx(): ] for transport in transports: client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_lookup_service.py b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_lookup_service.py index 146186935907..630e4b27c906 100644 --- a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_lookup_service.py +++ b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_lookup_service.py @@ -77,18 +77,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -311,7 +299,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -338,42 +326,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -384,7 +379,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_lookup_service_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -436,7 +431,7 @@ def test_lookup_service_client_service_account_always_use_jwt( ], ) def test_lookup_service_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -499,9 +494,7 @@ def test_lookup_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(LookupServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -900,20 +893,20 @@ def test_lookup_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -925,13 +918,11 @@ def test_lookup_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -947,8 +938,7 @@ def test_lookup_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1101,8 +1091,8 @@ def test_lookup_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1131,7 +1121,7 @@ def test_lookup_service_client_create_channel_credentials_file( ) def test_resolve_service(request_type, transport: str = "grpc"): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1158,7 +1148,7 @@ def test_resolve_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1175,7 +1165,7 @@ async def test_resolve_service_async( transport: str = "grpc_asyncio", request_type=lookup_service.ResolveServiceRequest ): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1207,7 +1197,7 @@ async def test_resolve_service_async_from_dict(): def test_resolve_service_field_headers(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1237,7 +1227,7 @@ def test_resolve_service_field_headers(): @pytest.mark.asyncio async def test_resolve_service_field_headers_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1275,7 +1265,7 @@ async def test_resolve_service_field_headers_async(): ) def test_resolve_service_rest(request_type): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1325,7 +1315,7 @@ def test_resolve_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resolve_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1334,7 +1324,7 @@ def test_resolve_service_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resolve_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -1343,7 +1333,7 @@ def test_resolve_service_rest_required_fields( assert jsonified_request["name"] == "name_value" client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1386,7 +1376,7 @@ def test_resolve_service_rest_required_fields( def test_resolve_service_rest_unset_required_fields(): transport = transports.LookupServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.resolve_service._get_unset_required_fields({}) @@ -1396,7 +1386,7 @@ def test_resolve_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_resolve_service_rest_interceptors(null_interceptor): transport = transports.LookupServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.LookupServiceRestInterceptor(), @@ -1454,7 +1444,7 @@ def test_resolve_service_rest_bad_request( transport: str = "rest", request_type=lookup_service.ResolveServiceRequest ): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1478,24 +1468,24 @@ def test_resolve_service_rest_bad_request( def test_resolve_service_rest_error(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = LookupServiceClient( @@ -1505,7 +1495,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -1520,13 +1510,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = LookupServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = LookupServiceClient( @@ -1538,7 +1527,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = LookupServiceClient(transport=transport) assert client.transport is transport @@ -1547,13 +1536,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.LookupServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.LookupServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -1570,7 +1559,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -1584,7 +1573,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = LookupServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -1592,7 +1581,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -1604,7 +1593,7 @@ def test_lookup_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.LookupServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -1616,7 +1605,7 @@ def test_lookup_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.LookupServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -1650,7 +1639,7 @@ def test_lookup_service_base_transport_with_credentials_file(): "google.cloud.servicedirectory_v1beta1.services.lookup_service.transports.LookupServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.LookupServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -1669,7 +1658,7 @@ def test_lookup_service_base_transport_with_adc(): "google.cloud.servicedirectory_v1beta1.services.lookup_service.transports.LookupServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.LookupServiceTransport() adc.assert_called_once() @@ -1677,7 +1666,7 @@ def test_lookup_service_base_transport_with_adc(): def test_lookup_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) LookupServiceClient() adc.assert_called_once_with( scopes=None, @@ -1697,7 +1686,7 @@ def test_lookup_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -1744,7 +1733,7 @@ def test_lookup_service_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -1772,7 +1761,7 @@ def test_lookup_service_transport_create_channel(transport_class, grpc_helpers): ], ) def test_lookup_service_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -1810,7 +1799,7 @@ def test_lookup_service_grpc_transport_client_cert_source_for_mtls(transport_cla def test_lookup_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -1830,7 +1819,7 @@ def test_lookup_service_http_transport_client_cert_source_for_mtls(): ) def test_lookup_service_host_no_port(transport_name): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicedirectory.googleapis.com" ), @@ -1853,7 +1842,7 @@ def test_lookup_service_host_no_port(transport_name): ) def test_lookup_service_host_with_port(transport_name): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicedirectory.googleapis.com:8000" ), @@ -1873,8 +1862,8 @@ def test_lookup_service_host_with_port(transport_name): ], ) def test_lookup_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = LookupServiceClient( credentials=creds1, transport=transport_name, @@ -1936,7 +1925,7 @@ def test_lookup_service_transport_channel_mtls_with_client_cert_source(transport mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2208,7 +2197,7 @@ def test_client_with_default_client_info(): transports.LookupServiceTransport, "_prep_wrapped_messages" ) as prep: client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2218,7 +2207,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = LookupServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2227,7 +2216,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2242,7 +2231,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2272,7 +2261,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -2300,7 +2289,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2328,7 +2317,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -2354,7 +2343,7 @@ def test_list_locations_rest(request_type): def test_list_locations(transport: str = "grpc"): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2379,7 +2368,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2405,7 +2394,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2434,7 +2423,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2463,7 +2452,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -2481,7 +2470,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -2499,7 +2488,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2524,7 +2513,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2549,7 +2538,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): - client = LookupServiceClient(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = LookupServiceClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -2576,9 +2565,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): - client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + client = LookupServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -2606,7 +2593,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -2624,7 +2611,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = LookupServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -2648,7 +2635,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -2665,7 +2652,7 @@ def test_client_ctx(): ] for transport in transports: client = LookupServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_registration_service.py b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_registration_service.py index 4e335a0f2a55..a04294d41b84 100644 --- a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_registration_service.py +++ b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_registration_service.py @@ -90,18 +90,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -351,7 +339,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -378,42 +366,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -426,7 +421,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_registration_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -480,7 +475,7 @@ def test_registration_service_client_service_account_always_use_jwt( def test_registration_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -551,9 +546,7 @@ def test_registration_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(RegistrationServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -972,20 +965,20 @@ def test_registration_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -997,13 +990,11 @@ def test_registration_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1019,8 +1010,7 @@ def test_registration_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1186,8 +1176,8 @@ def test_registration_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1216,7 +1206,7 @@ def test_registration_service_client_create_channel_credentials_file( ) def test_create_namespace(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1248,7 +1238,7 @@ def test_create_namespace_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1266,7 +1256,7 @@ async def test_create_namespace_async( request_type=registration_service.CreateNamespaceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1303,7 +1293,7 @@ async def test_create_namespace_async_from_dict(): def test_create_namespace_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1333,7 +1323,7 @@ def test_create_namespace_field_headers(): @pytest.mark.asyncio async def test_create_namespace_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1364,7 +1354,7 @@ async def test_create_namespace_field_headers_async(): def test_create_namespace_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1396,7 +1386,7 @@ def test_create_namespace_flattened(): def test_create_namespace_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1413,7 +1403,7 @@ def test_create_namespace_flattened_error(): @pytest.mark.asyncio async def test_create_namespace_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1450,7 +1440,7 @@ async def test_create_namespace_flattened_async(): @pytest.mark.asyncio async def test_create_namespace_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1473,7 +1463,7 @@ async def test_create_namespace_flattened_error_async(): ) def test_list_namespaces(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1503,7 +1493,7 @@ def test_list_namespaces_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1521,7 +1511,7 @@ async def test_list_namespaces_async( request_type=registration_service.ListNamespacesRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1556,7 +1546,7 @@ async def test_list_namespaces_async_from_dict(): def test_list_namespaces_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1586,7 +1576,7 @@ def test_list_namespaces_field_headers(): @pytest.mark.asyncio async def test_list_namespaces_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1617,7 +1607,7 @@ async def test_list_namespaces_field_headers_async(): def test_list_namespaces_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1641,7 +1631,7 @@ def test_list_namespaces_flattened(): def test_list_namespaces_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1656,7 +1646,7 @@ def test_list_namespaces_flattened_error(): @pytest.mark.asyncio async def test_list_namespaces_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1685,7 +1675,7 @@ async def test_list_namespaces_flattened_async(): @pytest.mark.asyncio async def test_list_namespaces_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1699,7 +1689,7 @@ async def test_list_namespaces_flattened_error_async(): def test_list_namespaces_pager(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1749,7 +1739,7 @@ def test_list_namespaces_pager(transport_name: str = "grpc"): def test_list_namespaces_pages(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1791,7 +1781,7 @@ def test_list_namespaces_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_namespaces_async_pager(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1841,7 +1831,7 @@ async def test_list_namespaces_async_pager(): @pytest.mark.asyncio async def test_list_namespaces_async_pages(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1896,7 +1886,7 @@ async def test_list_namespaces_async_pages(): ) def test_get_namespace(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1928,7 +1918,7 @@ def test_get_namespace_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1946,7 +1936,7 @@ async def test_get_namespace_async( request_type=registration_service.GetNamespaceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1983,7 +1973,7 @@ async def test_get_namespace_async_from_dict(): def test_get_namespace_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2013,7 +2003,7 @@ def test_get_namespace_field_headers(): @pytest.mark.asyncio async def test_get_namespace_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2042,7 +2032,7 @@ async def test_get_namespace_field_headers_async(): def test_get_namespace_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2066,7 +2056,7 @@ def test_get_namespace_flattened(): def test_get_namespace_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2081,7 +2071,7 @@ def test_get_namespace_flattened_error(): @pytest.mark.asyncio async def test_get_namespace_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2108,7 +2098,7 @@ async def test_get_namespace_flattened_async(): @pytest.mark.asyncio async def test_get_namespace_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2129,7 +2119,7 @@ async def test_get_namespace_flattened_error_async(): ) def test_update_namespace(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2161,7 +2151,7 @@ def test_update_namespace_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2179,7 +2169,7 @@ async def test_update_namespace_async( request_type=registration_service.UpdateNamespaceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2216,7 +2206,7 @@ async def test_update_namespace_async_from_dict(): def test_update_namespace_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2246,7 +2236,7 @@ def test_update_namespace_field_headers(): @pytest.mark.asyncio async def test_update_namespace_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2277,7 +2267,7 @@ async def test_update_namespace_field_headers_async(): def test_update_namespace_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2305,7 +2295,7 @@ def test_update_namespace_flattened(): def test_update_namespace_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2321,7 +2311,7 @@ def test_update_namespace_flattened_error(): @pytest.mark.asyncio async def test_update_namespace_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2354,7 +2344,7 @@ async def test_update_namespace_flattened_async(): @pytest.mark.asyncio async def test_update_namespace_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2376,7 +2366,7 @@ async def test_update_namespace_flattened_error_async(): ) def test_delete_namespace(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2403,7 +2393,7 @@ def test_delete_namespace_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2421,7 +2411,7 @@ async def test_delete_namespace_async( request_type=registration_service.DeleteNamespaceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2451,7 +2441,7 @@ async def test_delete_namespace_async_from_dict(): def test_delete_namespace_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2481,7 +2471,7 @@ def test_delete_namespace_field_headers(): @pytest.mark.asyncio async def test_delete_namespace_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2510,7 +2500,7 @@ async def test_delete_namespace_field_headers_async(): def test_delete_namespace_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2534,7 +2524,7 @@ def test_delete_namespace_flattened(): def test_delete_namespace_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2549,7 +2539,7 @@ def test_delete_namespace_flattened_error(): @pytest.mark.asyncio async def test_delete_namespace_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2576,7 +2566,7 @@ async def test_delete_namespace_flattened_async(): @pytest.mark.asyncio async def test_delete_namespace_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2597,7 +2587,7 @@ async def test_delete_namespace_flattened_error_async(): ) def test_create_service(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2629,7 +2619,7 @@ def test_create_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2647,7 +2637,7 @@ async def test_create_service_async( request_type=registration_service.CreateServiceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2684,7 +2674,7 @@ async def test_create_service_async_from_dict(): def test_create_service_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2714,7 +2704,7 @@ def test_create_service_field_headers(): @pytest.mark.asyncio async def test_create_service_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2743,7 +2733,7 @@ async def test_create_service_field_headers_async(): def test_create_service_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2775,7 +2765,7 @@ def test_create_service_flattened(): def test_create_service_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2792,7 +2782,7 @@ def test_create_service_flattened_error(): @pytest.mark.asyncio async def test_create_service_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2827,7 +2817,7 @@ async def test_create_service_flattened_async(): @pytest.mark.asyncio async def test_create_service_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2850,7 +2840,7 @@ async def test_create_service_flattened_error_async(): ) def test_list_services(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2880,7 +2870,7 @@ def test_list_services_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2898,7 +2888,7 @@ async def test_list_services_async( request_type=registration_service.ListServicesRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2933,7 +2923,7 @@ async def test_list_services_async_from_dict(): def test_list_services_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2963,7 +2953,7 @@ def test_list_services_field_headers(): @pytest.mark.asyncio async def test_list_services_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2994,7 +2984,7 @@ async def test_list_services_field_headers_async(): def test_list_services_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3018,7 +3008,7 @@ def test_list_services_flattened(): def test_list_services_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3033,7 +3023,7 @@ def test_list_services_flattened_error(): @pytest.mark.asyncio async def test_list_services_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3062,7 +3052,7 @@ async def test_list_services_flattened_async(): @pytest.mark.asyncio async def test_list_services_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3076,7 +3066,7 @@ async def test_list_services_flattened_error_async(): def test_list_services_pager(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3126,7 +3116,7 @@ def test_list_services_pager(transport_name: str = "grpc"): def test_list_services_pages(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3168,7 +3158,7 @@ def test_list_services_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_services_async_pager(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3218,7 +3208,7 @@ async def test_list_services_async_pager(): @pytest.mark.asyncio async def test_list_services_async_pages(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3273,7 +3263,7 @@ async def test_list_services_async_pages(): ) def test_get_service(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3305,7 +3295,7 @@ def test_get_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3322,7 +3312,7 @@ async def test_get_service_async( transport: str = "grpc_asyncio", request_type=registration_service.GetServiceRequest ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3359,7 +3349,7 @@ async def test_get_service_async_from_dict(): def test_get_service_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3389,7 +3379,7 @@ def test_get_service_field_headers(): @pytest.mark.asyncio async def test_get_service_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3418,7 +3408,7 @@ async def test_get_service_field_headers_async(): def test_get_service_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3442,7 +3432,7 @@ def test_get_service_flattened(): def test_get_service_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3457,7 +3447,7 @@ def test_get_service_flattened_error(): @pytest.mark.asyncio async def test_get_service_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3484,7 +3474,7 @@ async def test_get_service_flattened_async(): @pytest.mark.asyncio async def test_get_service_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3505,7 +3495,7 @@ async def test_get_service_flattened_error_async(): ) def test_update_service(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3537,7 +3527,7 @@ def test_update_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3555,7 +3545,7 @@ async def test_update_service_async( request_type=registration_service.UpdateServiceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3592,7 +3582,7 @@ async def test_update_service_async_from_dict(): def test_update_service_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3622,7 +3612,7 @@ def test_update_service_field_headers(): @pytest.mark.asyncio async def test_update_service_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3651,7 +3641,7 @@ async def test_update_service_field_headers_async(): def test_update_service_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3679,7 +3669,7 @@ def test_update_service_flattened(): def test_update_service_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3695,7 +3685,7 @@ def test_update_service_flattened_error(): @pytest.mark.asyncio async def test_update_service_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3726,7 +3716,7 @@ async def test_update_service_flattened_async(): @pytest.mark.asyncio async def test_update_service_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3748,7 +3738,7 @@ async def test_update_service_flattened_error_async(): ) def test_delete_service(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3775,7 +3765,7 @@ def test_delete_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3793,7 +3783,7 @@ async def test_delete_service_async( request_type=registration_service.DeleteServiceRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3823,7 +3813,7 @@ async def test_delete_service_async_from_dict(): def test_delete_service_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3853,7 +3843,7 @@ def test_delete_service_field_headers(): @pytest.mark.asyncio async def test_delete_service_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3882,7 +3872,7 @@ async def test_delete_service_field_headers_async(): def test_delete_service_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3906,7 +3896,7 @@ def test_delete_service_flattened(): def test_delete_service_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3921,7 +3911,7 @@ def test_delete_service_flattened_error(): @pytest.mark.asyncio async def test_delete_service_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3948,7 +3938,7 @@ async def test_delete_service_flattened_async(): @pytest.mark.asyncio async def test_delete_service_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3969,7 +3959,7 @@ async def test_delete_service_flattened_error_async(): ) def test_create_endpoint(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4007,7 +3997,7 @@ def test_create_endpoint_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4025,7 +4015,7 @@ async def test_create_endpoint_async( request_type=registration_service.CreateEndpointRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4068,7 +4058,7 @@ async def test_create_endpoint_async_from_dict(): def test_create_endpoint_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4098,7 +4088,7 @@ def test_create_endpoint_field_headers(): @pytest.mark.asyncio async def test_create_endpoint_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4129,7 +4119,7 @@ async def test_create_endpoint_field_headers_async(): def test_create_endpoint_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4161,7 +4151,7 @@ def test_create_endpoint_flattened(): def test_create_endpoint_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4178,7 +4168,7 @@ def test_create_endpoint_flattened_error(): @pytest.mark.asyncio async def test_create_endpoint_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4215,7 +4205,7 @@ async def test_create_endpoint_flattened_async(): @pytest.mark.asyncio async def test_create_endpoint_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4238,7 +4228,7 @@ async def test_create_endpoint_flattened_error_async(): ) def test_list_endpoints(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4268,7 +4258,7 @@ def test_list_endpoints_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4286,7 +4276,7 @@ async def test_list_endpoints_async( request_type=registration_service.ListEndpointsRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4321,7 +4311,7 @@ async def test_list_endpoints_async_from_dict(): def test_list_endpoints_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4351,7 +4341,7 @@ def test_list_endpoints_field_headers(): @pytest.mark.asyncio async def test_list_endpoints_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4382,7 +4372,7 @@ async def test_list_endpoints_field_headers_async(): def test_list_endpoints_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4406,7 +4396,7 @@ def test_list_endpoints_flattened(): def test_list_endpoints_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4421,7 +4411,7 @@ def test_list_endpoints_flattened_error(): @pytest.mark.asyncio async def test_list_endpoints_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4450,7 +4440,7 @@ async def test_list_endpoints_flattened_async(): @pytest.mark.asyncio async def test_list_endpoints_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4464,7 +4454,7 @@ async def test_list_endpoints_flattened_error_async(): def test_list_endpoints_pager(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4514,7 +4504,7 @@ def test_list_endpoints_pager(transport_name: str = "grpc"): def test_list_endpoints_pages(transport_name: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4556,7 +4546,7 @@ def test_list_endpoints_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_endpoints_async_pager(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4606,7 +4596,7 @@ async def test_list_endpoints_async_pager(): @pytest.mark.asyncio async def test_list_endpoints_async_pages(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4661,7 +4651,7 @@ async def test_list_endpoints_async_pages(): ) def test_get_endpoint(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4699,7 +4689,7 @@ def test_get_endpoint_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4717,7 +4707,7 @@ async def test_get_endpoint_async( request_type=registration_service.GetEndpointRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4760,7 +4750,7 @@ async def test_get_endpoint_async_from_dict(): def test_get_endpoint_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4790,7 +4780,7 @@ def test_get_endpoint_field_headers(): @pytest.mark.asyncio async def test_get_endpoint_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4819,7 +4809,7 @@ async def test_get_endpoint_field_headers_async(): def test_get_endpoint_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4843,7 +4833,7 @@ def test_get_endpoint_flattened(): def test_get_endpoint_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4858,7 +4848,7 @@ def test_get_endpoint_flattened_error(): @pytest.mark.asyncio async def test_get_endpoint_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4885,7 +4875,7 @@ async def test_get_endpoint_flattened_async(): @pytest.mark.asyncio async def test_get_endpoint_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4906,7 +4896,7 @@ async def test_get_endpoint_flattened_error_async(): ) def test_update_endpoint(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4944,7 +4934,7 @@ def test_update_endpoint_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4962,7 +4952,7 @@ async def test_update_endpoint_async( request_type=registration_service.UpdateEndpointRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5005,7 +4995,7 @@ async def test_update_endpoint_async_from_dict(): def test_update_endpoint_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5035,7 +5025,7 @@ def test_update_endpoint_field_headers(): @pytest.mark.asyncio async def test_update_endpoint_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5066,7 +5056,7 @@ async def test_update_endpoint_field_headers_async(): def test_update_endpoint_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5094,7 +5084,7 @@ def test_update_endpoint_flattened(): def test_update_endpoint_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5110,7 +5100,7 @@ def test_update_endpoint_flattened_error(): @pytest.mark.asyncio async def test_update_endpoint_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5143,7 +5133,7 @@ async def test_update_endpoint_flattened_async(): @pytest.mark.asyncio async def test_update_endpoint_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5165,7 +5155,7 @@ async def test_update_endpoint_flattened_error_async(): ) def test_delete_endpoint(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5192,7 +5182,7 @@ def test_delete_endpoint_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5210,7 +5200,7 @@ async def test_delete_endpoint_async( request_type=registration_service.DeleteEndpointRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5240,7 +5230,7 @@ async def test_delete_endpoint_async_from_dict(): def test_delete_endpoint_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5270,7 +5260,7 @@ def test_delete_endpoint_field_headers(): @pytest.mark.asyncio async def test_delete_endpoint_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5299,7 +5289,7 @@ async def test_delete_endpoint_field_headers_async(): def test_delete_endpoint_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5323,7 +5313,7 @@ def test_delete_endpoint_flattened(): def test_delete_endpoint_flattened_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5338,7 +5328,7 @@ def test_delete_endpoint_flattened_error(): @pytest.mark.asyncio async def test_delete_endpoint_flattened_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5365,7 +5355,7 @@ async def test_delete_endpoint_flattened_async(): @pytest.mark.asyncio async def test_delete_endpoint_flattened_error_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5386,7 +5376,7 @@ async def test_delete_endpoint_flattened_error_async(): ) def test_get_iam_policy(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5418,7 +5408,7 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5435,7 +5425,7 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5472,7 +5462,7 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5502,7 +5492,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5531,7 +5521,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict_foreign(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -5555,7 +5545,7 @@ def test_get_iam_policy_from_dict_foreign(): ) def test_set_iam_policy(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5587,7 +5577,7 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5604,7 +5594,7 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5641,7 +5631,7 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5671,7 +5661,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5700,7 +5690,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict_foreign(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -5725,7 +5715,7 @@ def test_set_iam_policy_from_dict_foreign(): ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5757,7 +5747,7 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5777,7 +5767,7 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5814,7 +5804,7 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5846,7 +5836,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5879,7 +5869,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict_foreign(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5905,7 +5895,7 @@ def test_test_iam_permissions_from_dict_foreign(): ) def test_create_namespace_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6034,7 +6024,7 @@ def test_create_namespace_rest_required_fields( assert "namespaceId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6046,7 +6036,7 @@ def test_create_namespace_rest_required_fields( jsonified_request["namespaceId"] = "namespace_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_namespace._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("namespace_id",)) @@ -6059,7 +6049,7 @@ def test_create_namespace_rest_required_fields( assert jsonified_request["namespaceId"] == "namespace_id_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6108,7 +6098,7 @@ def test_create_namespace_rest_required_fields( def test_create_namespace_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_namespace._get_unset_required_fields({}) @@ -6127,7 +6117,7 @@ def test_create_namespace_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_namespace_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -6185,7 +6175,7 @@ def test_create_namespace_rest_bad_request( transport: str = "rest", request_type=registration_service.CreateNamespaceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6207,7 +6197,7 @@ def test_create_namespace_rest_bad_request( def test_create_namespace_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6251,7 +6241,7 @@ def test_create_namespace_rest_flattened(): def test_create_namespace_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6268,7 +6258,7 @@ def test_create_namespace_rest_flattened_error(transport: str = "rest"): def test_create_namespace_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6281,7 +6271,7 @@ def test_create_namespace_rest_error(): ) def test_list_namespaces_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6332,7 +6322,7 @@ def test_list_namespaces_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_namespaces._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6341,7 +6331,7 @@ def test_list_namespaces_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_namespaces._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -6359,7 +6349,7 @@ def test_list_namespaces_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6401,7 +6391,7 @@ def test_list_namespaces_rest_required_fields( def test_list_namespaces_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_namespaces._get_unset_required_fields({}) @@ -6421,7 +6411,7 @@ def test_list_namespaces_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_namespaces_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -6479,7 +6469,7 @@ def test_list_namespaces_rest_bad_request( transport: str = "rest", request_type=registration_service.ListNamespacesRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6501,7 +6491,7 @@ def test_list_namespaces_rest_bad_request( def test_list_namespaces_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6543,7 +6533,7 @@ def test_list_namespaces_rest_flattened(): def test_list_namespaces_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6558,7 +6548,7 @@ def test_list_namespaces_rest_flattened_error(transport: str = "rest"): def test_list_namespaces_rest_pager(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6628,7 +6618,7 @@ def test_list_namespaces_rest_pager(transport: str = "rest"): ) def test_get_namespace_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6681,7 +6671,7 @@ def test_get_namespace_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6690,7 +6680,7 @@ def test_get_namespace_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6699,7 +6689,7 @@ def test_get_namespace_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6741,7 +6731,7 @@ def test_get_namespace_rest_required_fields( def test_get_namespace_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_namespace._get_unset_required_fields({}) @@ -6751,7 +6741,7 @@ def test_get_namespace_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_namespace_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -6807,7 +6797,7 @@ def test_get_namespace_rest_bad_request( transport: str = "rest", request_type=registration_service.GetNamespaceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6829,7 +6819,7 @@ def test_get_namespace_rest_bad_request( def test_get_namespace_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6873,7 +6863,7 @@ def test_get_namespace_rest_flattened(): def test_get_namespace_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6888,7 +6878,7 @@ def test_get_namespace_rest_flattened_error(transport: str = "rest"): def test_get_namespace_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6901,7 +6891,7 @@ def test_get_namespace_rest_error(): ) def test_update_namespace_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7029,14 +7019,14 @@ def test_update_namespace_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_namespace._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -7045,7 +7035,7 @@ def test_update_namespace_rest_required_fields( # verify required fields with non-default values are left alone client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7088,7 +7078,7 @@ def test_update_namespace_rest_required_fields( def test_update_namespace_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_namespace._get_unset_required_fields({}) @@ -7106,7 +7096,7 @@ def test_update_namespace_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_namespace_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -7164,7 +7154,7 @@ def test_update_namespace_rest_bad_request( transport: str = "rest", request_type=registration_service.UpdateNamespaceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7188,7 +7178,7 @@ def test_update_namespace_rest_bad_request( def test_update_namespace_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7235,7 +7225,7 @@ def test_update_namespace_rest_flattened(): def test_update_namespace_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7251,7 +7241,7 @@ def test_update_namespace_rest_flattened_error(transport: str = "rest"): def test_update_namespace_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7264,7 +7254,7 @@ def test_update_namespace_rest_error(): ) def test_delete_namespace_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7310,7 +7300,7 @@ def test_delete_namespace_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7319,7 +7309,7 @@ def test_delete_namespace_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_namespace._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7328,7 +7318,7 @@ def test_delete_namespace_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7367,7 +7357,7 @@ def test_delete_namespace_rest_required_fields( def test_delete_namespace_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_namespace._get_unset_required_fields({}) @@ -7377,7 +7367,7 @@ def test_delete_namespace_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_namespace_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -7427,7 +7417,7 @@ def test_delete_namespace_rest_bad_request( transport: str = "rest", request_type=registration_service.DeleteNamespaceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7449,7 +7439,7 @@ def test_delete_namespace_rest_bad_request( def test_delete_namespace_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7491,7 +7481,7 @@ def test_delete_namespace_rest_flattened(): def test_delete_namespace_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7506,7 +7496,7 @@ def test_delete_namespace_rest_flattened_error(transport: str = "rest"): def test_delete_namespace_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7519,7 +7509,7 @@ def test_delete_namespace_rest_error(): ) def test_create_service_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7660,7 +7650,7 @@ def test_create_service_rest_required_fields( assert "serviceId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7672,7 +7662,7 @@ def test_create_service_rest_required_fields( jsonified_request["serviceId"] = "service_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("service_id",)) @@ -7685,7 +7675,7 @@ def test_create_service_rest_required_fields( assert jsonified_request["serviceId"] == "service_id_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7734,7 +7724,7 @@ def test_create_service_rest_required_fields( def test_create_service_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_service._get_unset_required_fields({}) @@ -7753,7 +7743,7 @@ def test_create_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_service_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -7809,7 +7799,7 @@ def test_create_service_rest_bad_request( transport: str = "rest", request_type=registration_service.CreateServiceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7831,7 +7821,7 @@ def test_create_service_rest_bad_request( def test_create_service_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7877,7 +7867,7 @@ def test_create_service_rest_flattened(): def test_create_service_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7894,7 +7884,7 @@ def test_create_service_rest_flattened_error(transport: str = "rest"): def test_create_service_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7907,7 +7897,7 @@ def test_create_service_rest_error(): ) def test_list_services_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7958,7 +7948,7 @@ def test_list_services_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_services._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7967,7 +7957,7 @@ def test_list_services_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_services._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -7985,7 +7975,7 @@ def test_list_services_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8027,7 +8017,7 @@ def test_list_services_rest_required_fields( def test_list_services_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_services._get_unset_required_fields({}) @@ -8047,7 +8037,7 @@ def test_list_services_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_services_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -8105,7 +8095,7 @@ def test_list_services_rest_bad_request( transport: str = "rest", request_type=registration_service.ListServicesRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8127,7 +8117,7 @@ def test_list_services_rest_bad_request( def test_list_services_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8171,7 +8161,7 @@ def test_list_services_rest_flattened(): def test_list_services_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8186,7 +8176,7 @@ def test_list_services_rest_flattened_error(transport: str = "rest"): def test_list_services_rest_pager(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8258,7 +8248,7 @@ def test_list_services_rest_pager(transport: str = "rest"): ) def test_get_service_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8313,7 +8303,7 @@ def test_get_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8322,7 +8312,7 @@ def test_get_service_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8331,7 +8321,7 @@ def test_get_service_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8373,7 +8363,7 @@ def test_get_service_rest_required_fields( def test_get_service_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_service._get_unset_required_fields({}) @@ -8383,7 +8373,7 @@ def test_get_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_service_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -8439,7 +8429,7 @@ def test_get_service_rest_bad_request( transport: str = "rest", request_type=registration_service.GetServiceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8463,7 +8453,7 @@ def test_get_service_rest_bad_request( def test_get_service_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8507,7 +8497,7 @@ def test_get_service_rest_flattened(): def test_get_service_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8522,7 +8512,7 @@ def test_get_service_rest_flattened_error(transport: str = "rest"): def test_get_service_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8535,7 +8525,7 @@ def test_get_service_rest_error(): ) def test_update_service_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8677,14 +8667,14 @@ def test_update_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_service._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -8693,7 +8683,7 @@ def test_update_service_rest_required_fields( # verify required fields with non-default values are left alone client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8736,7 +8726,7 @@ def test_update_service_rest_required_fields( def test_update_service_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_service._get_unset_required_fields({}) @@ -8754,7 +8744,7 @@ def test_update_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_service_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -8810,7 +8800,7 @@ def test_update_service_rest_bad_request( transport: str = "rest", request_type=registration_service.UpdateServiceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8836,7 +8826,7 @@ def test_update_service_rest_bad_request( def test_update_service_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8883,7 +8873,7 @@ def test_update_service_rest_flattened(): def test_update_service_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8899,7 +8889,7 @@ def test_update_service_rest_flattened_error(transport: str = "rest"): def test_update_service_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8912,7 +8902,7 @@ def test_update_service_rest_error(): ) def test_delete_service_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8960,7 +8950,7 @@ def test_delete_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8969,7 +8959,7 @@ def test_delete_service_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8978,7 +8968,7 @@ def test_delete_service_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9017,7 +9007,7 @@ def test_delete_service_rest_required_fields( def test_delete_service_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_service._get_unset_required_fields({}) @@ -9027,7 +9017,7 @@ def test_delete_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_service_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -9077,7 +9067,7 @@ def test_delete_service_rest_bad_request( transport: str = "rest", request_type=registration_service.DeleteServiceRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9101,7 +9091,7 @@ def test_delete_service_rest_bad_request( def test_delete_service_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9143,7 +9133,7 @@ def test_delete_service_rest_flattened(): def test_delete_service_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9158,7 +9148,7 @@ def test_delete_service_rest_flattened_error(transport: str = "rest"): def test_delete_service_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9171,7 +9161,7 @@ def test_delete_service_rest_error(): ) def test_create_endpoint_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9311,7 +9301,7 @@ def test_create_endpoint_rest_required_fields( assert "endpointId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9323,7 +9313,7 @@ def test_create_endpoint_rest_required_fields( jsonified_request["endpointId"] = "endpoint_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_endpoint._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("endpoint_id",)) @@ -9336,7 +9326,7 @@ def test_create_endpoint_rest_required_fields( assert jsonified_request["endpointId"] == "endpoint_id_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9385,7 +9375,7 @@ def test_create_endpoint_rest_required_fields( def test_create_endpoint_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_endpoint._get_unset_required_fields({}) @@ -9404,7 +9394,7 @@ def test_create_endpoint_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_endpoint_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -9462,7 +9452,7 @@ def test_create_endpoint_rest_bad_request( transport: str = "rest", request_type=registration_service.CreateEndpointRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9486,7 +9476,7 @@ def test_create_endpoint_rest_bad_request( def test_create_endpoint_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9532,7 +9522,7 @@ def test_create_endpoint_rest_flattened(): def test_create_endpoint_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9549,7 +9539,7 @@ def test_create_endpoint_rest_flattened_error(transport: str = "rest"): def test_create_endpoint_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9562,7 +9552,7 @@ def test_create_endpoint_rest_error(): ) def test_list_endpoints_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9615,7 +9605,7 @@ def test_list_endpoints_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_endpoints._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9624,7 +9614,7 @@ def test_list_endpoints_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_endpoints._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -9642,7 +9632,7 @@ def test_list_endpoints_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9684,7 +9674,7 @@ def test_list_endpoints_rest_required_fields( def test_list_endpoints_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_endpoints._get_unset_required_fields({}) @@ -9704,7 +9694,7 @@ def test_list_endpoints_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_endpoints_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -9762,7 +9752,7 @@ def test_list_endpoints_rest_bad_request( transport: str = "rest", request_type=registration_service.ListEndpointsRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9786,7 +9776,7 @@ def test_list_endpoints_rest_bad_request( def test_list_endpoints_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9830,7 +9820,7 @@ def test_list_endpoints_rest_flattened(): def test_list_endpoints_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9845,7 +9835,7 @@ def test_list_endpoints_rest_flattened_error(transport: str = "rest"): def test_list_endpoints_rest_pager(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9917,7 +9907,7 @@ def test_list_endpoints_rest_pager(transport: str = "rest"): ) def test_get_endpoint_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9978,7 +9968,7 @@ def test_get_endpoint_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9987,7 +9977,7 @@ def test_get_endpoint_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9996,7 +9986,7 @@ def test_get_endpoint_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10038,7 +10028,7 @@ def test_get_endpoint_rest_required_fields( def test_get_endpoint_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_endpoint._get_unset_required_fields({}) @@ -10048,7 +10038,7 @@ def test_get_endpoint_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_endpoint_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -10104,7 +10094,7 @@ def test_get_endpoint_rest_bad_request( transport: str = "rest", request_type=registration_service.GetEndpointRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10128,7 +10118,7 @@ def test_get_endpoint_rest_bad_request( def test_get_endpoint_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10172,7 +10162,7 @@ def test_get_endpoint_rest_flattened(): def test_get_endpoint_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10187,7 +10177,7 @@ def test_get_endpoint_rest_flattened_error(transport: str = "rest"): def test_get_endpoint_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10200,7 +10190,7 @@ def test_get_endpoint_rest_error(): ) def test_update_endpoint_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10339,14 +10329,14 @@ def test_update_endpoint_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_endpoint._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -10355,7 +10345,7 @@ def test_update_endpoint_rest_required_fields( # verify required fields with non-default values are left alone client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10398,7 +10388,7 @@ def test_update_endpoint_rest_required_fields( def test_update_endpoint_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_endpoint._get_unset_required_fields({}) @@ -10416,7 +10406,7 @@ def test_update_endpoint_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_endpoint_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -10474,7 +10464,7 @@ def test_update_endpoint_rest_bad_request( transport: str = "rest", request_type=registration_service.UpdateEndpointRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10500,7 +10490,7 @@ def test_update_endpoint_rest_bad_request( def test_update_endpoint_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10547,7 +10537,7 @@ def test_update_endpoint_rest_flattened(): def test_update_endpoint_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10563,7 +10553,7 @@ def test_update_endpoint_rest_flattened_error(transport: str = "rest"): def test_update_endpoint_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10576,7 +10566,7 @@ def test_update_endpoint_rest_error(): ) def test_delete_endpoint_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10624,7 +10614,7 @@ def test_delete_endpoint_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10633,7 +10623,7 @@ def test_delete_endpoint_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_endpoint._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10642,7 +10632,7 @@ def test_delete_endpoint_rest_required_fields( assert jsonified_request["name"] == "name_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10681,7 +10671,7 @@ def test_delete_endpoint_rest_required_fields( def test_delete_endpoint_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_endpoint._get_unset_required_fields({}) @@ -10691,7 +10681,7 @@ def test_delete_endpoint_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_endpoint_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -10741,7 +10731,7 @@ def test_delete_endpoint_rest_bad_request( transport: str = "rest", request_type=registration_service.DeleteEndpointRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10765,7 +10755,7 @@ def test_delete_endpoint_rest_bad_request( def test_delete_endpoint_rest_flattened(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10807,7 +10797,7 @@ def test_delete_endpoint_rest_flattened(): def test_delete_endpoint_rest_flattened_error(transport: str = "rest"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10822,7 +10812,7 @@ def test_delete_endpoint_rest_flattened_error(transport: str = "rest"): def test_delete_endpoint_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10835,7 +10825,7 @@ def test_delete_endpoint_rest_error(): ) def test_get_iam_policy_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10886,7 +10876,7 @@ def test_get_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10895,7 +10885,7 @@ def test_get_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10904,7 +10894,7 @@ def test_get_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10945,7 +10935,7 @@ def test_get_iam_policy_rest_required_fields( def test_get_iam_policy_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_iam_policy._get_unset_required_fields({}) @@ -10955,7 +10945,7 @@ def test_get_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_iam_policy_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -11009,7 +10999,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11031,7 +11021,7 @@ def test_get_iam_policy_rest_bad_request( def test_get_iam_policy_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -11044,7 +11034,7 @@ def test_get_iam_policy_rest_error(): ) def test_set_iam_policy_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11095,7 +11085,7 @@ def test_set_iam_policy_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11104,7 +11094,7 @@ def test_set_iam_policy_rest_required_fields( jsonified_request["resource"] = "resource_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).set_iam_policy._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11113,7 +11103,7 @@ def test_set_iam_policy_rest_required_fields( assert jsonified_request["resource"] == "resource_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11154,7 +11144,7 @@ def test_set_iam_policy_rest_required_fields( def test_set_iam_policy_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.set_iam_policy._get_unset_required_fields({}) @@ -11172,7 +11162,7 @@ def test_set_iam_policy_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_set_iam_policy_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -11226,7 +11216,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11248,7 +11238,7 @@ def test_set_iam_policy_rest_bad_request( def test_set_iam_policy_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -11261,7 +11251,7 @@ def test_set_iam_policy_rest_error(): ) def test_test_iam_permissions_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11311,7 +11301,7 @@ def test_test_iam_permissions_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11321,7 +11311,7 @@ def test_test_iam_permissions_rest_required_fields( jsonified_request["permissions"] = "permissions_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).test_iam_permissions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11332,7 +11322,7 @@ def test_test_iam_permissions_rest_required_fields( assert jsonified_request["permissions"] == "permissions_value" client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11373,7 +11363,7 @@ def test_test_iam_permissions_rest_required_fields( def test_test_iam_permissions_rest_unset_required_fields(): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.test_iam_permissions._get_unset_required_fields({}) @@ -11391,7 +11381,7 @@ def test_test_iam_permissions_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_test_iam_permissions_rest_interceptors(null_interceptor): transport = transports.RegistrationServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.RegistrationServiceRestInterceptor(), @@ -11447,7 +11437,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11469,24 +11459,24 @@ def test_test_iam_permissions_rest_bad_request( def test_test_iam_permissions_rest_error(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = RegistrationServiceClient( @@ -11496,7 +11486,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -11511,13 +11501,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = RegistrationServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = RegistrationServiceClient( @@ -11529,7 +11518,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = RegistrationServiceClient(transport=transport) assert client.transport is transport @@ -11538,13 +11527,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.RegistrationServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.RegistrationServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -11561,7 +11550,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -11575,7 +11564,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = RegistrationServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -11583,7 +11572,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -11595,7 +11584,7 @@ def test_registration_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.RegistrationServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -11607,7 +11596,7 @@ def test_registration_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.RegistrationServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -11658,7 +11647,7 @@ def test_registration_service_base_transport_with_credentials_file(): "google.cloud.servicedirectory_v1beta1.services.registration_service.transports.RegistrationServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegistrationServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -11677,7 +11666,7 @@ def test_registration_service_base_transport_with_adc(): "google.cloud.servicedirectory_v1beta1.services.registration_service.transports.RegistrationServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.RegistrationServiceTransport() adc.assert_called_once() @@ -11685,7 +11674,7 @@ def test_registration_service_base_transport_with_adc(): def test_registration_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) RegistrationServiceClient() adc.assert_called_once_with( scopes=None, @@ -11705,7 +11694,7 @@ def test_registration_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -11752,7 +11741,7 @@ def test_registration_service_transport_create_channel(transport_class, grpc_hel ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -11782,7 +11771,7 @@ def test_registration_service_transport_create_channel(transport_class, grpc_hel def test_registration_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -11820,7 +11809,7 @@ def test_registration_service_grpc_transport_client_cert_source_for_mtls( def test_registration_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -11840,7 +11829,7 @@ def test_registration_service_http_transport_client_cert_source_for_mtls(): ) def test_registration_service_host_no_port(transport_name): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicedirectory.googleapis.com" ), @@ -11863,7 +11852,7 @@ def test_registration_service_host_no_port(transport_name): ) def test_registration_service_host_with_port(transport_name): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicedirectory.googleapis.com:8000" ), @@ -11883,8 +11872,8 @@ def test_registration_service_host_with_port(transport_name): ], ) def test_registration_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = RegistrationServiceClient( credentials=creds1, transport=transport_name, @@ -11999,7 +11988,7 @@ def test_registration_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -12299,7 +12288,7 @@ def test_client_with_default_client_info(): transports.RegistrationServiceTransport, "_prep_wrapped_messages" ) as prep: client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -12309,7 +12298,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = RegistrationServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -12318,7 +12307,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -12333,7 +12322,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12363,7 +12352,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -12391,7 +12380,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12419,7 +12408,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -12445,7 +12434,7 @@ def test_list_locations_rest(request_type): def test_list_locations(transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12470,7 +12459,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12496,7 +12485,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12525,7 +12514,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12554,7 +12543,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -12572,7 +12561,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -12590,7 +12579,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12615,7 +12604,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12641,7 +12630,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12670,7 +12659,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -12699,7 +12688,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -12717,7 +12706,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = RegistrationServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -12741,7 +12730,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -12758,7 +12747,7 @@ def test_client_ctx(): ] for transport in transports: client = RegistrationServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement/gapic_version.py b/packages/google-cloud-service-management/google/cloud/servicemanagement/gapic_version.py index 97c03305daf2..360a0d13ebdd 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement/gapic_version.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.8.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/gapic_version.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/gapic_version.py index 97c03305daf2..360a0d13ebdd 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/gapic_version.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.8.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/client.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/client.py index 4fca543dbcbf..ff9c99b746d3 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/client.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/client.py @@ -393,6 +393,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -411,6 +412,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -485,17 +487,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ServiceManagerClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ServiceManagerClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_google.api.servicemanagement.v1.json b/packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_google.api.servicemanagement.v1.json index 61de21f38a25..8b514f320127 100644 --- a/packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_google.api.servicemanagement.v1.json +++ b/packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_google.api.servicemanagement.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-service-management", - "version": "1.8.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-service-management/setup.py b/packages/google-cloud-service-management/setup.py index 110ea527cae4..acec5ede0b00 100644 --- a/packages/google-cloud-service-management/setup.py +++ b/packages/google-cloud-service-management/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", diff --git a/packages/google-cloud-service-management/testing/constraints-3.7.txt b/packages/google-cloud-service-management/testing/constraints-3.7.txt index 44ffd04543a8..712d45b4c5ea 100644 --- a/packages/google-cloud-service-management/testing/constraints-3.7.txt +++ b/packages/google-cloud-service-management/testing/constraints-3.7.txt @@ -5,6 +5,7 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 grpc-google-iam-v1==0.12.4 diff --git a/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py b/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py index fd98df6c9392..cff28007b321 100644 --- a/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py +++ b/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py @@ -120,18 +120,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -358,7 +346,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -385,42 +373,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -431,7 +426,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_service_manager_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -483,7 +478,7 @@ def test_service_manager_client_service_account_always_use_jwt( ], ) def test_service_manager_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -546,9 +541,7 @@ def test_service_manager_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ServiceManagerClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -947,20 +940,20 @@ def test_service_manager_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -972,13 +965,11 @@ def test_service_manager_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -994,8 +985,7 @@ def test_service_manager_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1148,8 +1138,8 @@ def test_service_manager_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1183,7 +1173,7 @@ def test_service_manager_client_create_channel_credentials_file( ) def test_list_services(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1213,7 +1203,7 @@ def test_list_services_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1230,7 +1220,7 @@ async def test_list_services_async( transport: str = "grpc_asyncio", request_type=servicemanager.ListServicesRequest ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1265,7 +1255,7 @@ async def test_list_services_async_from_dict(): def test_list_services_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1293,7 +1283,7 @@ def test_list_services_flattened(): def test_list_services_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1309,7 +1299,7 @@ def test_list_services_flattened_error(): @pytest.mark.asyncio async def test_list_services_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1342,7 +1332,7 @@ async def test_list_services_flattened_async(): @pytest.mark.asyncio async def test_list_services_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1357,7 +1347,7 @@ async def test_list_services_flattened_error_async(): def test_list_services_pager(transport_name: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1404,7 +1394,7 @@ def test_list_services_pager(transport_name: str = "grpc"): def test_list_services_pages(transport_name: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1446,7 +1436,7 @@ def test_list_services_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_services_async_pager(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1496,7 +1486,7 @@ async def test_list_services_async_pager(): @pytest.mark.asyncio async def test_list_services_async_pages(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1551,7 +1541,7 @@ async def test_list_services_async_pages(): ) def test_get_service(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1583,7 +1573,7 @@ def test_get_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1600,7 +1590,7 @@ async def test_get_service_async( transport: str = "grpc_asyncio", request_type=servicemanager.GetServiceRequest ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1637,7 +1627,7 @@ async def test_get_service_async_from_dict(): def test_get_service_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1667,7 +1657,7 @@ def test_get_service_field_headers(): @pytest.mark.asyncio async def test_get_service_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1698,7 +1688,7 @@ async def test_get_service_field_headers_async(): def test_get_service_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1722,7 +1712,7 @@ def test_get_service_flattened(): def test_get_service_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1737,7 +1727,7 @@ def test_get_service_flattened_error(): @pytest.mark.asyncio async def test_get_service_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1766,7 +1756,7 @@ async def test_get_service_flattened_async(): @pytest.mark.asyncio async def test_get_service_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1787,7 +1777,7 @@ async def test_get_service_flattened_error_async(): ) def test_create_service(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1814,7 +1804,7 @@ def test_create_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1831,7 +1821,7 @@ async def test_create_service_async( transport: str = "grpc_asyncio", request_type=servicemanager.CreateServiceRequest ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1863,7 +1853,7 @@ async def test_create_service_async_from_dict(): def test_create_service_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1887,7 +1877,7 @@ def test_create_service_flattened(): def test_create_service_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1902,7 +1892,7 @@ def test_create_service_flattened_error(): @pytest.mark.asyncio async def test_create_service_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1931,7 +1921,7 @@ async def test_create_service_flattened_async(): @pytest.mark.asyncio async def test_create_service_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1952,7 +1942,7 @@ async def test_create_service_flattened_error_async(): ) def test_delete_service(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1979,7 +1969,7 @@ def test_delete_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1996,7 +1986,7 @@ async def test_delete_service_async( transport: str = "grpc_asyncio", request_type=servicemanager.DeleteServiceRequest ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2028,7 +2018,7 @@ async def test_delete_service_async_from_dict(): def test_delete_service_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2058,7 +2048,7 @@ def test_delete_service_field_headers(): @pytest.mark.asyncio async def test_delete_service_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2089,7 +2079,7 @@ async def test_delete_service_field_headers_async(): def test_delete_service_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2113,7 +2103,7 @@ def test_delete_service_flattened(): def test_delete_service_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2128,7 +2118,7 @@ def test_delete_service_flattened_error(): @pytest.mark.asyncio async def test_delete_service_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2157,7 +2147,7 @@ async def test_delete_service_flattened_async(): @pytest.mark.asyncio async def test_delete_service_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2178,7 +2168,7 @@ async def test_delete_service_flattened_error_async(): ) def test_undelete_service(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2205,7 +2195,7 @@ def test_undelete_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2222,7 +2212,7 @@ async def test_undelete_service_async( transport: str = "grpc_asyncio", request_type=servicemanager.UndeleteServiceRequest ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2254,7 +2244,7 @@ async def test_undelete_service_async_from_dict(): def test_undelete_service_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2284,7 +2274,7 @@ def test_undelete_service_field_headers(): @pytest.mark.asyncio async def test_undelete_service_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2315,7 +2305,7 @@ async def test_undelete_service_field_headers_async(): def test_undelete_service_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2339,7 +2329,7 @@ def test_undelete_service_flattened(): def test_undelete_service_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2354,7 +2344,7 @@ def test_undelete_service_flattened_error(): @pytest.mark.asyncio async def test_undelete_service_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2383,7 +2373,7 @@ async def test_undelete_service_flattened_async(): @pytest.mark.asyncio async def test_undelete_service_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2404,7 +2394,7 @@ async def test_undelete_service_flattened_error_async(): ) def test_list_service_configs(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2436,7 +2426,7 @@ def test_list_service_configs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2456,7 +2446,7 @@ async def test_list_service_configs_async( request_type=servicemanager.ListServiceConfigsRequest, ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2493,7 +2483,7 @@ async def test_list_service_configs_async_from_dict(): def test_list_service_configs_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2525,7 +2515,7 @@ def test_list_service_configs_field_headers(): @pytest.mark.asyncio async def test_list_service_configs_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2558,7 +2548,7 @@ async def test_list_service_configs_field_headers_async(): def test_list_service_configs_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2584,7 +2574,7 @@ def test_list_service_configs_flattened(): def test_list_service_configs_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2599,7 +2589,7 @@ def test_list_service_configs_flattened_error(): @pytest.mark.asyncio async def test_list_service_configs_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2630,7 +2620,7 @@ async def test_list_service_configs_flattened_async(): @pytest.mark.asyncio async def test_list_service_configs_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2644,7 +2634,7 @@ async def test_list_service_configs_flattened_error_async(): def test_list_service_configs_pager(transport_name: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2696,7 +2686,7 @@ def test_list_service_configs_pager(transport_name: str = "grpc"): def test_list_service_configs_pages(transport_name: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2740,7 +2730,7 @@ def test_list_service_configs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_service_configs_async_pager(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2792,7 +2782,7 @@ async def test_list_service_configs_async_pager(): @pytest.mark.asyncio async def test_list_service_configs_async_pages(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2849,7 +2839,7 @@ async def test_list_service_configs_async_pages(): ) def test_get_service_config(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2887,7 +2877,7 @@ def test_get_service_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2906,7 +2896,7 @@ async def test_get_service_config_async( transport: str = "grpc_asyncio", request_type=servicemanager.GetServiceConfigRequest ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2949,7 +2939,7 @@ async def test_get_service_config_async_from_dict(): def test_get_service_config_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2982,7 +2972,7 @@ def test_get_service_config_field_headers(): @pytest.mark.asyncio async def test_get_service_config_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3014,7 +3004,7 @@ async def test_get_service_config_field_headers_async(): def test_get_service_config_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3048,7 +3038,7 @@ def test_get_service_config_flattened(): def test_get_service_config_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3065,7 +3055,7 @@ def test_get_service_config_flattened_error(): @pytest.mark.asyncio async def test_get_service_config_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3102,7 +3092,7 @@ async def test_get_service_config_flattened_async(): @pytest.mark.asyncio async def test_get_service_config_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3125,7 +3115,7 @@ async def test_get_service_config_flattened_error_async(): ) def test_create_service_config(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3163,7 +3153,7 @@ def test_create_service_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3183,7 +3173,7 @@ async def test_create_service_config_async( request_type=servicemanager.CreateServiceConfigRequest, ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3226,7 +3216,7 @@ async def test_create_service_config_async_from_dict(): def test_create_service_config_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3258,7 +3248,7 @@ def test_create_service_config_field_headers(): @pytest.mark.asyncio async def test_create_service_config_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3289,7 +3279,7 @@ async def test_create_service_config_field_headers_async(): def test_create_service_config_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3319,7 +3309,7 @@ def test_create_service_config_flattened(): def test_create_service_config_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3335,7 +3325,7 @@ def test_create_service_config_flattened_error(): @pytest.mark.asyncio async def test_create_service_config_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3368,7 +3358,7 @@ async def test_create_service_config_flattened_async(): @pytest.mark.asyncio async def test_create_service_config_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3390,7 +3380,7 @@ async def test_create_service_config_flattened_error_async(): ) def test_submit_config_source(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3419,7 +3409,7 @@ def test_submit_config_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3439,7 +3429,7 @@ async def test_submit_config_source_async( request_type=servicemanager.SubmitConfigSourceRequest, ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3473,7 +3463,7 @@ async def test_submit_config_source_async_from_dict(): def test_submit_config_source_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3505,7 +3495,7 @@ def test_submit_config_source_field_headers(): @pytest.mark.asyncio async def test_submit_config_source_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3538,7 +3528,7 @@ async def test_submit_config_source_field_headers_async(): def test_submit_config_source_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3572,7 +3562,7 @@ def test_submit_config_source_flattened(): def test_submit_config_source_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3589,7 +3579,7 @@ def test_submit_config_source_flattened_error(): @pytest.mark.asyncio async def test_submit_config_source_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3628,7 +3618,7 @@ async def test_submit_config_source_flattened_async(): @pytest.mark.asyncio async def test_submit_config_source_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3651,7 +3641,7 @@ async def test_submit_config_source_flattened_error_async(): ) def test_list_service_rollouts(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3683,7 +3673,7 @@ def test_list_service_rollouts_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3703,7 +3693,7 @@ async def test_list_service_rollouts_async( request_type=servicemanager.ListServiceRolloutsRequest, ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3740,7 +3730,7 @@ async def test_list_service_rollouts_async_from_dict(): def test_list_service_rollouts_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3772,7 +3762,7 @@ def test_list_service_rollouts_field_headers(): @pytest.mark.asyncio async def test_list_service_rollouts_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3805,7 +3795,7 @@ async def test_list_service_rollouts_field_headers_async(): def test_list_service_rollouts_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3835,7 +3825,7 @@ def test_list_service_rollouts_flattened(): def test_list_service_rollouts_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3851,7 +3841,7 @@ def test_list_service_rollouts_flattened_error(): @pytest.mark.asyncio async def test_list_service_rollouts_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3886,7 +3876,7 @@ async def test_list_service_rollouts_flattened_async(): @pytest.mark.asyncio async def test_list_service_rollouts_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3901,7 +3891,7 @@ async def test_list_service_rollouts_flattened_error_async(): def test_list_service_rollouts_pager(transport_name: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3953,7 +3943,7 @@ def test_list_service_rollouts_pager(transport_name: str = "grpc"): def test_list_service_rollouts_pages(transport_name: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3997,7 +3987,7 @@ def test_list_service_rollouts_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_service_rollouts_async_pager(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4049,7 +4039,7 @@ async def test_list_service_rollouts_async_pager(): @pytest.mark.asyncio async def test_list_service_rollouts_async_pages(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4106,7 +4096,7 @@ async def test_list_service_rollouts_async_pages(): ) def test_get_service_rollout(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4144,7 +4134,7 @@ def test_get_service_rollout_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4164,7 +4154,7 @@ async def test_get_service_rollout_async( request_type=servicemanager.GetServiceRolloutRequest, ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4207,7 +4197,7 @@ async def test_get_service_rollout_async_from_dict(): def test_get_service_rollout_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4240,7 +4230,7 @@ def test_get_service_rollout_field_headers(): @pytest.mark.asyncio async def test_get_service_rollout_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4272,7 +4262,7 @@ async def test_get_service_rollout_field_headers_async(): def test_get_service_rollout_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4302,7 +4292,7 @@ def test_get_service_rollout_flattened(): def test_get_service_rollout_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4318,7 +4308,7 @@ def test_get_service_rollout_flattened_error(): @pytest.mark.asyncio async def test_get_service_rollout_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4351,7 +4341,7 @@ async def test_get_service_rollout_flattened_async(): @pytest.mark.asyncio async def test_get_service_rollout_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4373,7 +4363,7 @@ async def test_get_service_rollout_flattened_error_async(): ) def test_create_service_rollout(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4402,7 +4392,7 @@ def test_create_service_rollout_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4422,7 +4412,7 @@ async def test_create_service_rollout_async( request_type=servicemanager.CreateServiceRolloutRequest, ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4456,7 +4446,7 @@ async def test_create_service_rollout_async_from_dict(): def test_create_service_rollout_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4488,7 +4478,7 @@ def test_create_service_rollout_field_headers(): @pytest.mark.asyncio async def test_create_service_rollout_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4521,7 +4511,7 @@ async def test_create_service_rollout_field_headers_async(): def test_create_service_rollout_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4551,7 +4541,7 @@ def test_create_service_rollout_flattened(): def test_create_service_rollout_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4567,7 +4557,7 @@ def test_create_service_rollout_flattened_error(): @pytest.mark.asyncio async def test_create_service_rollout_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4602,7 +4592,7 @@ async def test_create_service_rollout_flattened_async(): @pytest.mark.asyncio async def test_create_service_rollout_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4624,7 +4614,7 @@ async def test_create_service_rollout_flattened_error_async(): ) def test_generate_config_report(request_type, transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4658,7 +4648,7 @@ def test_generate_config_report_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4678,7 +4668,7 @@ async def test_generate_config_report_async( request_type=servicemanager.GenerateConfigReportRequest, ): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4717,7 +4707,7 @@ async def test_generate_config_report_async_from_dict(): def test_generate_config_report_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4751,7 +4741,7 @@ def test_generate_config_report_flattened(): def test_generate_config_report_flattened_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4771,7 +4761,7 @@ def test_generate_config_report_flattened_error(): @pytest.mark.asyncio async def test_generate_config_report_flattened_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4810,7 +4800,7 @@ async def test_generate_config_report_flattened_async(): @pytest.mark.asyncio async def test_generate_config_report_flattened_error_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4836,7 +4826,7 @@ async def test_generate_config_report_flattened_error_async(): ) def test_list_services_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4870,7 +4860,7 @@ def test_list_services_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_services_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -4928,7 +4918,7 @@ def test_list_services_rest_bad_request( transport: str = "rest", request_type=servicemanager.ListServicesRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4950,7 +4940,7 @@ def test_list_services_rest_bad_request( def test_list_services_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4991,7 +4981,7 @@ def test_list_services_rest_flattened(): def test_list_services_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5007,7 +4997,7 @@ def test_list_services_rest_flattened_error(transport: str = "rest"): def test_list_services_rest_pager(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5077,7 +5067,7 @@ def test_list_services_rest_pager(transport: str = "rest"): ) def test_get_service_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5130,7 +5120,7 @@ def test_get_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5139,7 +5129,7 @@ def test_get_service_rest_required_fields( jsonified_request["serviceName"] = "service_name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5148,7 +5138,7 @@ def test_get_service_rest_required_fields( assert jsonified_request["serviceName"] == "service_name_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5190,7 +5180,7 @@ def test_get_service_rest_required_fields( def test_get_service_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_service._get_unset_required_fields({}) @@ -5200,7 +5190,7 @@ def test_get_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_service_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -5258,7 +5248,7 @@ def test_get_service_rest_bad_request( transport: str = "rest", request_type=servicemanager.GetServiceRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5280,7 +5270,7 @@ def test_get_service_rest_bad_request( def test_get_service_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5320,7 +5310,7 @@ def test_get_service_rest_flattened(): def test_get_service_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5335,7 +5325,7 @@ def test_get_service_rest_flattened_error(transport: str = "rest"): def test_get_service_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5348,7 +5338,7 @@ def test_get_service_rest_error(): ) def test_create_service_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5464,21 +5454,21 @@ def test_create_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5518,7 +5508,7 @@ def test_create_service_rest_required_fields( def test_create_service_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_service._get_unset_required_fields({}) @@ -5528,7 +5518,7 @@ def test_create_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_service_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -5588,7 +5578,7 @@ def test_create_service_rest_bad_request( transport: str = "rest", request_type=servicemanager.CreateServiceRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5610,7 +5600,7 @@ def test_create_service_rest_bad_request( def test_create_service_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5648,7 +5638,7 @@ def test_create_service_rest_flattened(): def test_create_service_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5663,7 +5653,7 @@ def test_create_service_rest_flattened_error(transport: str = "rest"): def test_create_service_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5676,7 +5666,7 @@ def test_create_service_rest_error(): ) def test_delete_service_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5722,7 +5712,7 @@ def test_delete_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5731,7 +5721,7 @@ def test_delete_service_rest_required_fields( jsonified_request["serviceName"] = "service_name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5740,7 +5730,7 @@ def test_delete_service_rest_required_fields( assert jsonified_request["serviceName"] == "service_name_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5779,7 +5769,7 @@ def test_delete_service_rest_required_fields( def test_delete_service_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_service._get_unset_required_fields({}) @@ -5789,7 +5779,7 @@ def test_delete_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_service_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -5849,7 +5839,7 @@ def test_delete_service_rest_bad_request( transport: str = "rest", request_type=servicemanager.DeleteServiceRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5871,7 +5861,7 @@ def test_delete_service_rest_bad_request( def test_delete_service_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5909,7 +5899,7 @@ def test_delete_service_rest_flattened(): def test_delete_service_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5924,7 +5914,7 @@ def test_delete_service_rest_flattened_error(transport: str = "rest"): def test_delete_service_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5937,7 +5927,7 @@ def test_delete_service_rest_error(): ) def test_undelete_service_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5983,7 +5973,7 @@ def test_undelete_service_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5992,7 +5982,7 @@ def test_undelete_service_rest_required_fields( jsonified_request["serviceName"] = "service_name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_service._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6001,7 +5991,7 @@ def test_undelete_service_rest_required_fields( assert jsonified_request["serviceName"] == "service_name_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6040,7 +6030,7 @@ def test_undelete_service_rest_required_fields( def test_undelete_service_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.undelete_service._get_unset_required_fields({}) @@ -6050,7 +6040,7 @@ def test_undelete_service_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_undelete_service_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -6110,7 +6100,7 @@ def test_undelete_service_rest_bad_request( transport: str = "rest", request_type=servicemanager.UndeleteServiceRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6132,7 +6122,7 @@ def test_undelete_service_rest_bad_request( def test_undelete_service_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6170,7 +6160,7 @@ def test_undelete_service_rest_flattened(): def test_undelete_service_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6185,7 +6175,7 @@ def test_undelete_service_rest_flattened_error(transport: str = "rest"): def test_undelete_service_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6198,7 +6188,7 @@ def test_undelete_service_rest_error(): ) def test_list_service_configs_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6249,7 +6239,7 @@ def test_list_service_configs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_service_configs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6258,7 +6248,7 @@ def test_list_service_configs_rest_required_fields( jsonified_request["serviceName"] = "service_name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_service_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -6274,7 +6264,7 @@ def test_list_service_configs_rest_required_fields( assert jsonified_request["serviceName"] == "service_name_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6316,7 +6306,7 @@ def test_list_service_configs_rest_required_fields( def test_list_service_configs_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_service_configs._get_unset_required_fields({}) @@ -6334,7 +6324,7 @@ def test_list_service_configs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_service_configs_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -6392,7 +6382,7 @@ def test_list_service_configs_rest_bad_request( transport: str = "rest", request_type=servicemanager.ListServiceConfigsRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6414,7 +6404,7 @@ def test_list_service_configs_rest_bad_request( def test_list_service_configs_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6454,7 +6444,7 @@ def test_list_service_configs_rest_flattened(): def test_list_service_configs_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6469,7 +6459,7 @@ def test_list_service_configs_rest_flattened_error(transport: str = "rest"): def test_list_service_configs_rest_pager(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6539,7 +6529,7 @@ def test_list_service_configs_rest_pager(transport: str = "rest"): ) def test_get_service_config_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6595,7 +6585,7 @@ def test_get_service_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6605,7 +6595,7 @@ def test_get_service_config_rest_required_fields( jsonified_request["configId"] = "config_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("view",)) @@ -6618,7 +6608,7 @@ def test_get_service_config_rest_required_fields( assert jsonified_request["configId"] == "config_id_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6658,7 +6648,7 @@ def test_get_service_config_rest_required_fields( def test_get_service_config_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_service_config._get_unset_required_fields({}) @@ -6676,7 +6666,7 @@ def test_get_service_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_service_config_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -6732,7 +6722,7 @@ def test_get_service_config_rest_bad_request( transport: str = "rest", request_type=servicemanager.GetServiceConfigRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6754,7 +6744,7 @@ def test_get_service_config_rest_bad_request( def test_get_service_config_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6796,7 +6786,7 @@ def test_get_service_config_rest_flattened(): def test_get_service_config_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6813,7 +6803,7 @@ def test_get_service_config_rest_flattened_error(transport: str = "rest"): def test_get_service_config_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6826,7 +6816,7 @@ def test_get_service_config_rest_error(): ) def test_create_service_config_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7320,7 +7310,7 @@ def test_create_service_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7329,7 +7319,7 @@ def test_create_service_config_rest_required_fields( jsonified_request["serviceName"] = "service_name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7338,7 +7328,7 @@ def test_create_service_config_rest_required_fields( assert jsonified_request["serviceName"] == "service_name_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7379,7 +7369,7 @@ def test_create_service_config_rest_required_fields( def test_create_service_config_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_service_config._get_unset_required_fields({}) @@ -7397,7 +7387,7 @@ def test_create_service_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_service_config_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -7453,7 +7443,7 @@ def test_create_service_config_rest_bad_request( transport: str = "rest", request_type=servicemanager.CreateServiceConfigRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7475,7 +7465,7 @@ def test_create_service_config_rest_bad_request( def test_create_service_config_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7514,7 +7504,7 @@ def test_create_service_config_rest_flattened(): def test_create_service_config_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7530,7 +7520,7 @@ def test_create_service_config_rest_flattened_error(transport: str = "rest"): def test_create_service_config_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7543,7 +7533,7 @@ def test_create_service_config_rest_error(): ) def test_submit_config_source_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7589,7 +7579,7 @@ def test_submit_config_source_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).submit_config_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7598,7 +7588,7 @@ def test_submit_config_source_rest_required_fields( jsonified_request["serviceName"] = "service_name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).submit_config_source._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7607,7 +7597,7 @@ def test_submit_config_source_rest_required_fields( assert jsonified_request["serviceName"] == "service_name_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7647,7 +7637,7 @@ def test_submit_config_source_rest_required_fields( def test_submit_config_source_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.submit_config_source._get_unset_required_fields({}) @@ -7665,7 +7655,7 @@ def test_submit_config_source_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_submit_config_source_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -7725,7 +7715,7 @@ def test_submit_config_source_rest_bad_request( transport: str = "rest", request_type=servicemanager.SubmitConfigSourceRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7747,7 +7737,7 @@ def test_submit_config_source_rest_bad_request( def test_submit_config_source_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7788,7 +7778,7 @@ def test_submit_config_source_rest_flattened(): def test_submit_config_source_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7805,7 +7795,7 @@ def test_submit_config_source_rest_flattened_error(transport: str = "rest"): def test_submit_config_source_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7818,7 +7808,7 @@ def test_submit_config_source_rest_error(): ) def test_list_service_rollouts_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7871,7 +7861,7 @@ def test_list_service_rollouts_rest_required_fields( assert "filter" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_service_rollouts._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7883,7 +7873,7 @@ def test_list_service_rollouts_rest_required_fields( jsonified_request["filter"] = "filter_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_service_rollouts._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -7902,7 +7892,7 @@ def test_list_service_rollouts_rest_required_fields( assert jsonified_request["filter"] == "filter_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7950,7 +7940,7 @@ def test_list_service_rollouts_rest_required_fields( def test_list_service_rollouts_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_service_rollouts._get_unset_required_fields({}) @@ -7974,7 +7964,7 @@ def test_list_service_rollouts_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_service_rollouts_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -8032,7 +8022,7 @@ def test_list_service_rollouts_rest_bad_request( transport: str = "rest", request_type=servicemanager.ListServiceRolloutsRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8054,7 +8044,7 @@ def test_list_service_rollouts_rest_bad_request( def test_list_service_rollouts_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8095,7 +8085,7 @@ def test_list_service_rollouts_rest_flattened(): def test_list_service_rollouts_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8111,7 +8101,7 @@ def test_list_service_rollouts_rest_flattened_error(transport: str = "rest"): def test_list_service_rollouts_rest_pager(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8181,7 +8171,7 @@ def test_list_service_rollouts_rest_pager(transport: str = "rest"): ) def test_get_service_rollout_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8239,7 +8229,7 @@ def test_get_service_rollout_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service_rollout._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8249,7 +8239,7 @@ def test_get_service_rollout_rest_required_fields( jsonified_request["rolloutId"] = "rollout_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_service_rollout._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8260,7 +8250,7 @@ def test_get_service_rollout_rest_required_fields( assert jsonified_request["rolloutId"] == "rollout_id_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8302,7 +8292,7 @@ def test_get_service_rollout_rest_required_fields( def test_get_service_rollout_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_service_rollout._get_unset_required_fields({}) @@ -8320,7 +8310,7 @@ def test_get_service_rollout_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_service_rollout_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -8376,7 +8366,7 @@ def test_get_service_rollout_rest_bad_request( transport: str = "rest", request_type=servicemanager.GetServiceRolloutRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8398,7 +8388,7 @@ def test_get_service_rollout_rest_bad_request( def test_get_service_rollout_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8441,7 +8431,7 @@ def test_get_service_rollout_rest_flattened(): def test_get_service_rollout_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8457,7 +8447,7 @@ def test_get_service_rollout_rest_flattened_error(transport: str = "rest"): def test_get_service_rollout_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8470,7 +8460,7 @@ def test_get_service_rollout_rest_error(): ) def test_create_service_rollout_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8592,7 +8582,7 @@ def test_create_service_rollout_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service_rollout._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8601,7 +8591,7 @@ def test_create_service_rollout_rest_required_fields( jsonified_request["serviceName"] = "service_name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_service_rollout._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8610,7 +8600,7 @@ def test_create_service_rollout_rest_required_fields( assert jsonified_request["serviceName"] == "service_name_value" client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8650,7 +8640,7 @@ def test_create_service_rollout_rest_required_fields( def test_create_service_rollout_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_service_rollout._get_unset_required_fields({}) @@ -8668,7 +8658,7 @@ def test_create_service_rollout_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_service_rollout_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -8728,7 +8718,7 @@ def test_create_service_rollout_rest_bad_request( transport: str = "rest", request_type=servicemanager.CreateServiceRolloutRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8750,7 +8740,7 @@ def test_create_service_rollout_rest_bad_request( def test_create_service_rollout_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8789,7 +8779,7 @@ def test_create_service_rollout_rest_flattened(): def test_create_service_rollout_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8805,7 +8795,7 @@ def test_create_service_rollout_rest_flattened_error(transport: str = "rest"): def test_create_service_rollout_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8818,7 +8808,7 @@ def test_create_service_rollout_rest_error(): ) def test_generate_config_report_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8870,21 +8860,21 @@ def test_generate_config_report_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).generate_config_report._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).generate_config_report._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8927,7 +8917,7 @@ def test_generate_config_report_rest_required_fields( def test_generate_config_report_rest_unset_required_fields(): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.generate_config_report._get_unset_required_fields({}) @@ -8937,7 +8927,7 @@ def test_generate_config_report_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_generate_config_report_rest_interceptors(null_interceptor): transport = transports.ServiceManagerRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceManagerRestInterceptor(), @@ -8995,7 +8985,7 @@ def test_generate_config_report_rest_bad_request( transport: str = "rest", request_type=servicemanager.GenerateConfigReportRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9017,7 +9007,7 @@ def test_generate_config_report_rest_bad_request( def test_generate_config_report_rest_flattened(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9062,7 +9052,7 @@ def test_generate_config_report_rest_flattened(): def test_generate_config_report_rest_flattened_error(transport: str = "rest"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9082,24 +9072,24 @@ def test_generate_config_report_rest_flattened_error(transport: str = "rest"): def test_generate_config_report_rest_error(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServiceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServiceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceManagerClient( @@ -9109,7 +9099,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ServiceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -9124,13 +9114,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ServiceManagerClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ServiceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceManagerClient( @@ -9142,7 +9131,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServiceManagerClient(transport=transport) assert client.transport is transport @@ -9151,13 +9140,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceManagerGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServiceManagerGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -9174,7 +9163,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -9188,7 +9177,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ServiceManagerClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -9196,7 +9185,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -9208,7 +9197,7 @@ def test_service_manager_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServiceManagerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -9220,7 +9209,7 @@ def test_service_manager_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServiceManagerTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -9273,7 +9262,7 @@ def test_service_manager_base_transport_with_credentials_file(): "google.cloud.servicemanagement_v1.services.service_manager.transports.ServiceManagerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceManagerTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -9297,7 +9286,7 @@ def test_service_manager_base_transport_with_adc(): "google.cloud.servicemanagement_v1.services.service_manager.transports.ServiceManagerTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceManagerTransport() adc.assert_called_once() @@ -9305,7 +9294,7 @@ def test_service_manager_base_transport_with_adc(): def test_service_manager_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ServiceManagerClient() adc.assert_called_once_with( scopes=None, @@ -9330,7 +9319,7 @@ def test_service_manager_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -9382,7 +9371,7 @@ def test_service_manager_transport_create_channel(transport_class, grpc_helpers) ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -9415,7 +9404,7 @@ def test_service_manager_transport_create_channel(transport_class, grpc_helpers) ], ) def test_service_manager_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -9453,7 +9442,7 @@ def test_service_manager_grpc_transport_client_cert_source_for_mtls(transport_cl def test_service_manager_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -9465,7 +9454,7 @@ def test_service_manager_http_transport_client_cert_source_for_mtls(): def test_service_manager_rest_lro_client(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -9490,7 +9479,7 @@ def test_service_manager_rest_lro_client(): ) def test_service_manager_host_no_port(transport_name): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicemanagement.googleapis.com" ), @@ -9513,7 +9502,7 @@ def test_service_manager_host_no_port(transport_name): ) def test_service_manager_host_with_port(transport_name): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicemanagement.googleapis.com:8000" ), @@ -9533,8 +9522,8 @@ def test_service_manager_host_with_port(transport_name): ], ) def test_service_manager_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ServiceManagerClient( credentials=creds1, transport=transport_name, @@ -9634,7 +9623,7 @@ def test_service_manager_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -9712,7 +9701,7 @@ def test_service_manager_transport_channel_mtls_with_adc(transport_class): def test_service_manager_grpc_lro_client(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -9729,7 +9718,7 @@ def test_service_manager_grpc_lro_client(): def test_service_manager_grpc_lro_async_client(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -9854,7 +9843,7 @@ def test_client_with_default_client_info(): transports.ServiceManagerTransport, "_prep_wrapped_messages" ) as prep: client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -9864,7 +9853,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServiceManagerClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -9873,7 +9862,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -9888,7 +9877,7 @@ def test_get_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9916,7 +9905,7 @@ def test_get_iam_policy_rest_bad_request( ) def test_get_iam_policy_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"resource": "services/sample1"} @@ -9944,7 +9933,7 @@ def test_set_iam_policy_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9972,7 +9961,7 @@ def test_set_iam_policy_rest_bad_request( ) def test_set_iam_policy_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"resource": "services/sample1"} @@ -10000,7 +9989,7 @@ def test_test_iam_permissions_rest_bad_request( transport: str = "rest", request_type=iam_policy_pb2.TestIamPermissionsRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10028,7 +10017,7 @@ def test_test_iam_permissions_rest_bad_request( ) def test_test_iam_permissions_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"resource": "services/sample1"} @@ -10056,7 +10045,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10084,7 +10073,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {} @@ -10110,7 +10099,7 @@ def test_list_operations_rest(request_type): def test_list_operations(transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10135,7 +10124,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10161,7 +10150,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10190,7 +10179,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10219,7 +10208,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -10237,7 +10226,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -10255,7 +10244,7 @@ async def test_list_operations_from_dict_async(): def test_set_iam_policy(transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10288,7 +10277,7 @@ def test_set_iam_policy(transport: str = "grpc"): @pytest.mark.asyncio async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10323,7 +10312,7 @@ async def test_set_iam_policy_async(transport: str = "grpc_asyncio"): def test_set_iam_policy_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10353,7 +10342,7 @@ def test_set_iam_policy_field_headers(): @pytest.mark.asyncio async def test_set_iam_policy_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10382,7 +10371,7 @@ async def test_set_iam_policy_field_headers_async(): def test_set_iam_policy_from_dict(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -10401,7 +10390,7 @@ def test_set_iam_policy_from_dict(): @pytest.mark.asyncio async def test_set_iam_policy_from_dict_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -10419,7 +10408,7 @@ async def test_set_iam_policy_from_dict_async(): def test_get_iam_policy(transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10454,7 +10443,7 @@ def test_get_iam_policy(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10490,7 +10479,7 @@ async def test_get_iam_policy_async(transport: str = "grpc_asyncio"): def test_get_iam_policy_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10520,7 +10509,7 @@ def test_get_iam_policy_field_headers(): @pytest.mark.asyncio async def test_get_iam_policy_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10549,7 +10538,7 @@ async def test_get_iam_policy_field_headers_async(): def test_get_iam_policy_from_dict(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -10568,7 +10557,7 @@ def test_get_iam_policy_from_dict(): @pytest.mark.asyncio async def test_get_iam_policy_from_dict_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -10586,7 +10575,7 @@ async def test_get_iam_policy_from_dict_async(): def test_test_iam_permissions(transport: str = "grpc"): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10620,7 +10609,7 @@ def test_test_iam_permissions(transport: str = "grpc"): @pytest.mark.asyncio async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10655,7 +10644,7 @@ async def test_test_iam_permissions_async(transport: str = "grpc_asyncio"): def test_test_iam_permissions_field_headers(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10687,7 +10676,7 @@ def test_test_iam_permissions_field_headers(): @pytest.mark.asyncio async def test_test_iam_permissions_field_headers_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -10720,7 +10709,7 @@ async def test_test_iam_permissions_field_headers_async(): def test_test_iam_permissions_from_dict(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10741,7 +10730,7 @@ def test_test_iam_permissions_from_dict(): @pytest.mark.asyncio async def test_test_iam_permissions_from_dict_async(): client = ServiceManagerAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10769,7 +10758,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -10786,7 +10775,7 @@ def test_client_ctx(): ] for transport in transports: client = ServiceManagerClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-service-usage/google/cloud/service_usage/gapic_version.py b/packages/google-cloud-service-usage/google/cloud/service_usage/gapic_version.py index 0611530e449b..360a0d13ebdd 100644 --- a/packages/google-cloud-service-usage/google/cloud/service_usage/gapic_version.py +++ b/packages/google-cloud-service-usage/google/cloud/service_usage/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.10.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-usage/google/cloud/service_usage_v1/gapic_version.py b/packages/google-cloud-service-usage/google/cloud/service_usage_v1/gapic_version.py index 0611530e449b..360a0d13ebdd 100644 --- a/packages/google-cloud-service-usage/google/cloud/service_usage_v1/gapic_version.py +++ b/packages/google-cloud-service-usage/google/cloud/service_usage_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.10.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-service-usage/google/cloud/service_usage_v1/services/service_usage/client.py b/packages/google-cloud-service-usage/google/cloud/service_usage_v1/services/service_usage/client.py index feff7b7cc0fa..ccd809fe5d49 100644 --- a/packages/google-cloud-service-usage/google/cloud/service_usage_v1/services/service_usage/client.py +++ b/packages/google-cloud-service-usage/google/cloud/service_usage_v1/services/service_usage/client.py @@ -385,6 +385,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -403,6 +404,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -477,17 +479,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ServiceUsageClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ServiceUsageClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-service-usage/samples/generated_samples/snippet_metadata_google.api.serviceusage.v1.json b/packages/google-cloud-service-usage/samples/generated_samples/snippet_metadata_google.api.serviceusage.v1.json index 89bc2453575a..4ff459eb433d 100644 --- a/packages/google-cloud-service-usage/samples/generated_samples/snippet_metadata_google.api.serviceusage.v1.json +++ b/packages/google-cloud-service-usage/samples/generated_samples/snippet_metadata_google.api.serviceusage.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-service-usage", - "version": "1.10.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-service-usage/setup.py b/packages/google-cloud-service-usage/setup.py index f20630d352cf..fc90fb009ede 100644 --- a/packages/google-cloud-service-usage/setup.py +++ b/packages/google-cloud-service-usage/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-service-usage/testing/constraints-3.7.txt b/packages/google-cloud-service-usage/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-service-usage/testing/constraints-3.7.txt +++ b/packages/google-cloud-service-usage/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-service-usage/tests/unit/gapic/service_usage_v1/test_service_usage.py b/packages/google-cloud-service-usage/tests/unit/gapic/service_usage_v1/test_service_usage.py index 89242d9b8e54..358207115042 100644 --- a/packages/google-cloud-service-usage/tests/unit/gapic/service_usage_v1/test_service_usage.py +++ b/packages/google-cloud-service-usage/tests/unit/gapic/service_usage_v1/test_service_usage.py @@ -87,18 +87,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -310,7 +298,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -337,42 +325,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -383,7 +378,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_service_usage_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -435,7 +430,7 @@ def test_service_usage_client_service_account_always_use_jwt( ], ) def test_service_usage_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -498,9 +493,7 @@ def test_service_usage_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ServiceUsageClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -893,20 +886,20 @@ def test_service_usage_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -918,13 +911,11 @@ def test_service_usage_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -940,8 +931,7 @@ def test_service_usage_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1092,8 +1082,8 @@ def test_service_usage_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1126,7 +1116,7 @@ def test_service_usage_client_create_channel_credentials_file( ) def test_enable_service(request_type, transport: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1153,7 +1143,7 @@ def test_enable_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1170,7 +1160,7 @@ async def test_enable_service_async( transport: str = "grpc_asyncio", request_type=serviceusage.EnableServiceRequest ): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1202,7 +1192,7 @@ async def test_enable_service_async_from_dict(): def test_enable_service_field_headers(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1232,7 +1222,7 @@ def test_enable_service_field_headers(): @pytest.mark.asyncio async def test_enable_service_field_headers_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1270,7 +1260,7 @@ async def test_enable_service_field_headers_async(): ) def test_disable_service(request_type, transport: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1297,7 +1287,7 @@ def test_disable_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1314,7 +1304,7 @@ async def test_disable_service_async( transport: str = "grpc_asyncio", request_type=serviceusage.DisableServiceRequest ): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1346,7 +1336,7 @@ async def test_disable_service_async_from_dict(): def test_disable_service_field_headers(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1376,7 +1366,7 @@ def test_disable_service_field_headers(): @pytest.mark.asyncio async def test_disable_service_field_headers_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1414,7 +1404,7 @@ async def test_disable_service_field_headers_async(): ) def test_get_service(request_type, transport: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1448,7 +1438,7 @@ def test_get_service_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1465,7 +1455,7 @@ async def test_get_service_async( transport: str = "grpc_asyncio", request_type=serviceusage.GetServiceRequest ): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1504,7 +1494,7 @@ async def test_get_service_async_from_dict(): def test_get_service_field_headers(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1534,7 +1524,7 @@ def test_get_service_field_headers(): @pytest.mark.asyncio async def test_get_service_field_headers_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1570,7 +1560,7 @@ async def test_get_service_field_headers_async(): ) def test_list_services(request_type, transport: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1600,7 +1590,7 @@ def test_list_services_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1617,7 +1607,7 @@ async def test_list_services_async( transport: str = "grpc_asyncio", request_type=serviceusage.ListServicesRequest ): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1652,7 +1642,7 @@ async def test_list_services_async_from_dict(): def test_list_services_field_headers(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1682,7 +1672,7 @@ def test_list_services_field_headers(): @pytest.mark.asyncio async def test_list_services_field_headers_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1713,7 +1703,7 @@ async def test_list_services_field_headers_async(): def test_list_services_pager(transport_name: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1763,7 +1753,7 @@ def test_list_services_pager(transport_name: str = "grpc"): def test_list_services_pages(transport_name: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1805,7 +1795,7 @@ def test_list_services_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_services_async_pager(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1855,7 +1845,7 @@ async def test_list_services_async_pager(): @pytest.mark.asyncio async def test_list_services_async_pages(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1910,7 +1900,7 @@ async def test_list_services_async_pages(): ) def test_batch_enable_services(request_type, transport: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1939,7 +1929,7 @@ def test_batch_enable_services_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1959,7 +1949,7 @@ async def test_batch_enable_services_async( request_type=serviceusage.BatchEnableServicesRequest, ): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1993,7 +1983,7 @@ async def test_batch_enable_services_async_from_dict(): def test_batch_enable_services_field_headers(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2025,7 +2015,7 @@ def test_batch_enable_services_field_headers(): @pytest.mark.asyncio async def test_batch_enable_services_field_headers_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2065,7 +2055,7 @@ async def test_batch_enable_services_field_headers_async(): ) def test_batch_get_services(request_type, transport: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2094,7 +2084,7 @@ def test_batch_get_services_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2113,7 +2103,7 @@ async def test_batch_get_services_async( transport: str = "grpc_asyncio", request_type=serviceusage.BatchGetServicesRequest ): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2147,7 +2137,7 @@ async def test_batch_get_services_async_from_dict(): def test_batch_get_services_field_headers(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2179,7 +2169,7 @@ def test_batch_get_services_field_headers(): @pytest.mark.asyncio async def test_batch_get_services_field_headers_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2219,7 +2209,7 @@ async def test_batch_get_services_field_headers_async(): ) def test_enable_service_rest(request_type): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2248,7 +2238,7 @@ def test_enable_service_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_enable_service_rest_interceptors(null_interceptor): transport = transports.ServiceUsageRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceUsageRestInterceptor(), @@ -2308,7 +2298,7 @@ def test_enable_service_rest_bad_request( transport: str = "rest", request_type=serviceusage.EnableServiceRequest ): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2330,7 +2320,7 @@ def test_enable_service_rest_bad_request( def test_enable_service_rest_error(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2343,7 +2333,7 @@ def test_enable_service_rest_error(): ) def test_disable_service_rest(request_type): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2372,7 +2362,7 @@ def test_disable_service_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_disable_service_rest_interceptors(null_interceptor): transport = transports.ServiceUsageRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceUsageRestInterceptor(), @@ -2432,7 +2422,7 @@ def test_disable_service_rest_bad_request( transport: str = "rest", request_type=serviceusage.DisableServiceRequest ): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2454,7 +2444,7 @@ def test_disable_service_rest_bad_request( def test_disable_service_rest_error(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2467,7 +2457,7 @@ def test_disable_service_rest_error(): ) def test_get_service_rest(request_type): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2505,7 +2495,7 @@ def test_get_service_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_service_rest_interceptors(null_interceptor): transport = transports.ServiceUsageRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceUsageRestInterceptor(), @@ -2559,7 +2549,7 @@ def test_get_service_rest_bad_request( transport: str = "rest", request_type=serviceusage.GetServiceRequest ): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2581,7 +2571,7 @@ def test_get_service_rest_bad_request( def test_get_service_rest_error(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2594,7 +2584,7 @@ def test_get_service_rest_error(): ) def test_list_services_rest(request_type): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2628,7 +2618,7 @@ def test_list_services_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_services_rest_interceptors(null_interceptor): transport = transports.ServiceUsageRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceUsageRestInterceptor(), @@ -2686,7 +2676,7 @@ def test_list_services_rest_bad_request( transport: str = "rest", request_type=serviceusage.ListServicesRequest ): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2708,7 +2698,7 @@ def test_list_services_rest_bad_request( def test_list_services_rest_pager(transport: str = "rest"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2776,7 +2766,7 @@ def test_list_services_rest_pager(transport: str = "rest"): ) def test_batch_enable_services_rest(request_type): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2805,7 +2795,7 @@ def test_batch_enable_services_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_batch_enable_services_rest_interceptors(null_interceptor): transport = transports.ServiceUsageRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceUsageRestInterceptor(), @@ -2865,7 +2855,7 @@ def test_batch_enable_services_rest_bad_request( transport: str = "rest", request_type=serviceusage.BatchEnableServicesRequest ): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2887,7 +2877,7 @@ def test_batch_enable_services_rest_bad_request( def test_batch_enable_services_rest_error(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2900,7 +2890,7 @@ def test_batch_enable_services_rest_error(): ) def test_batch_get_services_rest(request_type): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2931,7 +2921,7 @@ def test_batch_get_services_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_batch_get_services_rest_interceptors(null_interceptor): transport = transports.ServiceUsageRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceUsageRestInterceptor(), @@ -2989,7 +2979,7 @@ def test_batch_get_services_rest_bad_request( transport: str = "rest", request_type=serviceusage.BatchGetServicesRequest ): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3011,24 +3001,24 @@ def test_batch_get_services_rest_bad_request( def test_batch_get_services_rest_error(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServiceUsageGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServiceUsageGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceUsageClient( @@ -3038,7 +3028,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ServiceUsageGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -3053,13 +3043,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ServiceUsageClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ServiceUsageGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceUsageClient( @@ -3071,7 +3060,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceUsageGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServiceUsageClient(transport=transport) assert client.transport is transport @@ -3080,13 +3069,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceUsageGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServiceUsageGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -3103,7 +3092,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -3117,7 +3106,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ServiceUsageClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -3125,7 +3114,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -3137,7 +3126,7 @@ def test_service_usage_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServiceUsageTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -3149,7 +3138,7 @@ def test_service_usage_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServiceUsageTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -3193,7 +3182,7 @@ def test_service_usage_base_transport_with_credentials_file(): "google.cloud.service_usage_v1.services.service_usage.transports.ServiceUsageTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceUsageTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3216,7 +3205,7 @@ def test_service_usage_base_transport_with_adc(): "google.cloud.service_usage_v1.services.service_usage.transports.ServiceUsageTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceUsageTransport() adc.assert_called_once() @@ -3224,7 +3213,7 @@ def test_service_usage_base_transport_with_adc(): def test_service_usage_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ServiceUsageClient() adc.assert_called_once_with( scopes=None, @@ -3248,7 +3237,7 @@ def test_service_usage_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3299,7 +3288,7 @@ def test_service_usage_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3328,7 +3317,7 @@ def test_service_usage_transport_create_channel(transport_class, grpc_helpers): [transports.ServiceUsageGrpcTransport, transports.ServiceUsageGrpcAsyncIOTransport], ) def test_service_usage_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3366,7 +3355,7 @@ def test_service_usage_grpc_transport_client_cert_source_for_mtls(transport_clas def test_service_usage_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3378,7 +3367,7 @@ def test_service_usage_http_transport_client_cert_source_for_mtls(): def test_service_usage_rest_lro_client(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3403,7 +3392,7 @@ def test_service_usage_rest_lro_client(): ) def test_service_usage_host_no_port(transport_name): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="serviceusage.googleapis.com" ), @@ -3426,7 +3415,7 @@ def test_service_usage_host_no_port(transport_name): ) def test_service_usage_host_with_port(transport_name): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="serviceusage.googleapis.com:8000" ), @@ -3446,8 +3435,8 @@ def test_service_usage_host_with_port(transport_name): ], ) def test_service_usage_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ServiceUsageClient( credentials=creds1, transport=transport_name, @@ -3521,7 +3510,7 @@ def test_service_usage_transport_channel_mtls_with_client_cert_source(transport_ mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3596,7 +3585,7 @@ def test_service_usage_transport_channel_mtls_with_adc(transport_class): def test_service_usage_grpc_lro_client(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -3613,7 +3602,7 @@ def test_service_usage_grpc_lro_client(): def test_service_usage_grpc_lro_async_client(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -3761,7 +3750,7 @@ def test_client_with_default_client_info(): transports.ServiceUsageTransport, "_prep_wrapped_messages" ) as prep: client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3771,7 +3760,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServiceUsageClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3780,7 +3769,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -3795,7 +3784,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3823,7 +3812,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "operations/sample1"} @@ -3851,7 +3840,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3879,7 +3868,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {} @@ -3905,7 +3894,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3930,7 +3919,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3956,7 +3945,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3985,7 +3974,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4014,7 +4003,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4032,7 +4021,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -4050,7 +4039,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4075,7 +4064,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4101,7 +4090,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4130,7 +4119,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4159,7 +4148,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4177,7 +4166,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = ServiceUsageAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -4201,7 +4190,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -4218,7 +4207,7 @@ def test_client_ctx(): ] for transport in transports: client = ServiceUsageClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-servicehealth/google/cloud/servicehealth/gapic_version.py b/packages/google-cloud-servicehealth/google/cloud/servicehealth/gapic_version.py index 123d60293175..360a0d13ebdd 100644 --- a/packages/google-cloud-servicehealth/google/cloud/servicehealth/gapic_version.py +++ b/packages/google-cloud-servicehealth/google/cloud/servicehealth/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.1" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-servicehealth/google/cloud/servicehealth_v1/gapic_version.py b/packages/google-cloud-servicehealth/google/cloud/servicehealth_v1/gapic_version.py index 123d60293175..360a0d13ebdd 100644 --- a/packages/google-cloud-servicehealth/google/cloud/servicehealth_v1/gapic_version.py +++ b/packages/google-cloud-servicehealth/google/cloud/servicehealth_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.1" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-servicehealth/google/cloud/servicehealth_v1/services/service_health/client.py b/packages/google-cloud-servicehealth/google/cloud/servicehealth_v1/services/service_health/client.py index ec27b8912e81..c33a1f67ef44 100644 --- a/packages/google-cloud-servicehealth/google/cloud/servicehealth_v1/services/service_health/client.py +++ b/packages/google-cloud-servicehealth/google/cloud/servicehealth_v1/services/service_health/client.py @@ -429,6 +429,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -447,6 +448,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -521,17 +523,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = ServiceHealthClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = ServiceHealthClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-servicehealth/samples/generated_samples/snippet_metadata_google.cloud.servicehealth.v1.json b/packages/google-cloud-servicehealth/samples/generated_samples/snippet_metadata_google.cloud.servicehealth.v1.json index 53eb1684669a..22600c1e9d56 100644 --- a/packages/google-cloud-servicehealth/samples/generated_samples/snippet_metadata_google.cloud.servicehealth.v1.json +++ b/packages/google-cloud-servicehealth/samples/generated_samples/snippet_metadata_google.cloud.servicehealth.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-servicehealth", - "version": "0.1.1" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-servicehealth/setup.py b/packages/google-cloud-servicehealth/setup.py index e094adf6c4ed..556efd55ea7e 100644 --- a/packages/google-cloud-servicehealth/setup.py +++ b/packages/google-cloud-servicehealth/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-servicehealth/testing/constraints-3.7.txt b/packages/google-cloud-servicehealth/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-servicehealth/testing/constraints-3.7.txt +++ b/packages/google-cloud-servicehealth/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-servicehealth/tests/unit/gapic/servicehealth_v1/test_service_health.py b/packages/google-cloud-servicehealth/tests/unit/gapic/servicehealth_v1/test_service_health.py index e5e75976b835..049a5516e902 100644 --- a/packages/google-cloud-servicehealth/tests/unit/gapic/servicehealth_v1/test_service_health.py +++ b/packages/google-cloud-servicehealth/tests/unit/gapic/servicehealth_v1/test_service_health.py @@ -79,18 +79,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -313,7 +301,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -340,42 +328,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -386,7 +381,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_service_health_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -438,7 +433,7 @@ def test_service_health_client_service_account_always_use_jwt( ], ) def test_service_health_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -501,9 +496,7 @@ def test_service_health_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(ServiceHealthClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -902,20 +895,20 @@ def test_service_health_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -927,13 +920,11 @@ def test_service_health_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -949,8 +940,7 @@ def test_service_health_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1103,8 +1093,8 @@ def test_service_health_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1133,7 +1123,7 @@ def test_service_health_client_create_channel_credentials_file( ) def test_list_events(request_type, transport: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1165,7 +1155,7 @@ def test_list_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1182,7 +1172,7 @@ async def test_list_events_async( transport: str = "grpc_asyncio", request_type=event_resources.ListEventsRequest ): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1219,7 +1209,7 @@ async def test_list_events_async_from_dict(): def test_list_events_field_headers(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1249,7 +1239,7 @@ def test_list_events_field_headers(): @pytest.mark.asyncio async def test_list_events_field_headers_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1280,7 +1270,7 @@ async def test_list_events_field_headers_async(): def test_list_events_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1304,7 +1294,7 @@ def test_list_events_flattened(): def test_list_events_flattened_error(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1319,7 +1309,7 @@ def test_list_events_flattened_error(): @pytest.mark.asyncio async def test_list_events_flattened_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1348,7 +1338,7 @@ async def test_list_events_flattened_async(): @pytest.mark.asyncio async def test_list_events_flattened_error_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1362,7 +1352,7 @@ async def test_list_events_flattened_error_async(): def test_list_events_pager(transport_name: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1412,7 +1402,7 @@ def test_list_events_pager(transport_name: str = "grpc"): def test_list_events_pages(transport_name: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1454,7 +1444,7 @@ def test_list_events_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_events_async_pager(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1504,7 +1494,7 @@ async def test_list_events_async_pager(): @pytest.mark.asyncio async def test_list_events_async_pages(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1559,7 +1549,7 @@ async def test_list_events_async_pages(): ) def test_get_event(request_type, transport: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1608,7 +1598,7 @@ def test_get_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1625,7 +1615,7 @@ async def test_get_event_async( transport: str = "grpc_asyncio", request_type=event_resources.GetEventRequest ): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1679,7 +1669,7 @@ async def test_get_event_async_from_dict(): def test_get_event_field_headers(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1709,7 +1699,7 @@ def test_get_event_field_headers(): @pytest.mark.asyncio async def test_get_event_field_headers_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1740,7 +1730,7 @@ async def test_get_event_field_headers_async(): def test_get_event_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1764,7 +1754,7 @@ def test_get_event_flattened(): def test_get_event_flattened_error(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1779,7 +1769,7 @@ def test_get_event_flattened_error(): @pytest.mark.asyncio async def test_get_event_flattened_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1808,7 +1798,7 @@ async def test_get_event_flattened_async(): @pytest.mark.asyncio async def test_get_event_flattened_error_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1829,7 +1819,7 @@ async def test_get_event_flattened_error_async(): ) def test_list_organization_events(request_type, transport: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1863,7 +1853,7 @@ def test_list_organization_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1883,7 +1873,7 @@ async def test_list_organization_events_async( request_type=event_resources.ListOrganizationEventsRequest, ): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1922,7 +1912,7 @@ async def test_list_organization_events_async_from_dict(): def test_list_organization_events_field_headers(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1954,7 +1944,7 @@ def test_list_organization_events_field_headers(): @pytest.mark.asyncio async def test_list_organization_events_field_headers_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1987,7 +1977,7 @@ async def test_list_organization_events_field_headers_async(): def test_list_organization_events_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2013,7 +2003,7 @@ def test_list_organization_events_flattened(): def test_list_organization_events_flattened_error(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2028,7 +2018,7 @@ def test_list_organization_events_flattened_error(): @pytest.mark.asyncio async def test_list_organization_events_flattened_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2059,7 +2049,7 @@ async def test_list_organization_events_flattened_async(): @pytest.mark.asyncio async def test_list_organization_events_flattened_error_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2073,7 +2063,7 @@ async def test_list_organization_events_flattened_error_async(): def test_list_organization_events_pager(transport_name: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2125,7 +2115,7 @@ def test_list_organization_events_pager(transport_name: str = "grpc"): def test_list_organization_events_pages(transport_name: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2169,7 +2159,7 @@ def test_list_organization_events_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_organization_events_async_pager(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2221,7 +2211,7 @@ async def test_list_organization_events_async_pager(): @pytest.mark.asyncio async def test_list_organization_events_async_pages(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2278,7 +2268,7 @@ async def test_list_organization_events_async_pages(): ) def test_get_organization_event(request_type, transport: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2330,7 +2320,7 @@ def test_get_organization_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2350,7 +2340,7 @@ async def test_get_organization_event_async( request_type=event_resources.GetOrganizationEventRequest, ): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2407,7 +2397,7 @@ async def test_get_organization_event_async_from_dict(): def test_get_organization_event_field_headers(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2439,7 +2429,7 @@ def test_get_organization_event_field_headers(): @pytest.mark.asyncio async def test_get_organization_event_field_headers_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2472,7 +2462,7 @@ async def test_get_organization_event_field_headers_async(): def test_get_organization_event_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2498,7 +2488,7 @@ def test_get_organization_event_flattened(): def test_get_organization_event_flattened_error(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2513,7 +2503,7 @@ def test_get_organization_event_flattened_error(): @pytest.mark.asyncio async def test_get_organization_event_flattened_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2544,7 +2534,7 @@ async def test_get_organization_event_flattened_async(): @pytest.mark.asyncio async def test_get_organization_event_flattened_error_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2565,7 +2555,7 @@ async def test_get_organization_event_flattened_error_async(): ) def test_list_organization_impacts(request_type, transport: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2599,7 +2589,7 @@ def test_list_organization_impacts_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2619,7 +2609,7 @@ async def test_list_organization_impacts_async( request_type=event_resources.ListOrganizationImpactsRequest, ): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2658,7 +2648,7 @@ async def test_list_organization_impacts_async_from_dict(): def test_list_organization_impacts_field_headers(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2690,7 +2680,7 @@ def test_list_organization_impacts_field_headers(): @pytest.mark.asyncio async def test_list_organization_impacts_field_headers_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2723,7 +2713,7 @@ async def test_list_organization_impacts_field_headers_async(): def test_list_organization_impacts_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2749,7 +2739,7 @@ def test_list_organization_impacts_flattened(): def test_list_organization_impacts_flattened_error(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2764,7 +2754,7 @@ def test_list_organization_impacts_flattened_error(): @pytest.mark.asyncio async def test_list_organization_impacts_flattened_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2795,7 +2785,7 @@ async def test_list_organization_impacts_flattened_async(): @pytest.mark.asyncio async def test_list_organization_impacts_flattened_error_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2809,7 +2799,7 @@ async def test_list_organization_impacts_flattened_error_async(): def test_list_organization_impacts_pager(transport_name: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2861,7 +2851,7 @@ def test_list_organization_impacts_pager(transport_name: str = "grpc"): def test_list_organization_impacts_pages(transport_name: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2905,7 +2895,7 @@ def test_list_organization_impacts_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_organization_impacts_async_pager(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2957,7 +2947,7 @@ async def test_list_organization_impacts_async_pager(): @pytest.mark.asyncio async def test_list_organization_impacts_async_pages(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3014,7 +3004,7 @@ async def test_list_organization_impacts_async_pages(): ) def test_get_organization_impact(request_type, transport: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3048,7 +3038,7 @@ def test_get_organization_impact_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3068,7 +3058,7 @@ async def test_get_organization_impact_async( request_type=event_resources.GetOrganizationImpactRequest, ): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3107,7 +3097,7 @@ async def test_get_organization_impact_async_from_dict(): def test_get_organization_impact_field_headers(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3139,7 +3129,7 @@ def test_get_organization_impact_field_headers(): @pytest.mark.asyncio async def test_get_organization_impact_field_headers_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3172,7 +3162,7 @@ async def test_get_organization_impact_field_headers_async(): def test_get_organization_impact_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3198,7 +3188,7 @@ def test_get_organization_impact_flattened(): def test_get_organization_impact_flattened_error(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3213,7 +3203,7 @@ def test_get_organization_impact_flattened_error(): @pytest.mark.asyncio async def test_get_organization_impact_flattened_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3244,7 +3234,7 @@ async def test_get_organization_impact_flattened_async(): @pytest.mark.asyncio async def test_get_organization_impact_flattened_error_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3265,7 +3255,7 @@ async def test_get_organization_impact_flattened_error_async(): ) def test_list_events_rest(request_type): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3318,7 +3308,7 @@ def test_list_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3327,7 +3317,7 @@ def test_list_events_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_events._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3345,7 +3335,7 @@ def test_list_events_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3387,7 +3377,7 @@ def test_list_events_rest_required_fields( def test_list_events_rest_unset_required_fields(): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_events._get_unset_required_fields({}) @@ -3407,7 +3397,7 @@ def test_list_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_events_rest_interceptors(null_interceptor): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceHealthRestInterceptor(), @@ -3465,7 +3455,7 @@ def test_list_events_rest_bad_request( transport: str = "rest", request_type=event_resources.ListEventsRequest ): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3487,7 +3477,7 @@ def test_list_events_rest_bad_request( def test_list_events_rest_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3528,7 +3518,7 @@ def test_list_events_rest_flattened(): def test_list_events_rest_flattened_error(transport: str = "rest"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3543,7 +3533,7 @@ def test_list_events_rest_flattened_error(transport: str = "rest"): def test_list_events_rest_pager(transport: str = "rest"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3613,7 +3603,7 @@ def test_list_events_rest_pager(transport: str = "rest"): ) def test_get_event_rest(request_type): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3681,7 +3671,7 @@ def test_get_event_rest_required_fields(request_type=event_resources.GetEventReq # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3690,7 +3680,7 @@ def test_get_event_rest_required_fields(request_type=event_resources.GetEventReq jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3699,7 +3689,7 @@ def test_get_event_rest_required_fields(request_type=event_resources.GetEventReq assert jsonified_request["name"] == "name_value" client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3741,7 +3731,7 @@ def test_get_event_rest_required_fields(request_type=event_resources.GetEventReq def test_get_event_rest_unset_required_fields(): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_event._get_unset_required_fields({}) @@ -3751,7 +3741,7 @@ def test_get_event_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_event_rest_interceptors(null_interceptor): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceHealthRestInterceptor(), @@ -3809,7 +3799,7 @@ def test_get_event_rest_bad_request( transport: str = "rest", request_type=event_resources.GetEventRequest ): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3831,7 +3821,7 @@ def test_get_event_rest_bad_request( def test_get_event_rest_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3872,7 +3862,7 @@ def test_get_event_rest_flattened(): def test_get_event_rest_flattened_error(transport: str = "rest"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3887,7 +3877,7 @@ def test_get_event_rest_flattened_error(transport: str = "rest"): def test_get_event_rest_error(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3900,7 +3890,7 @@ def test_get_event_rest_error(): ) def test_list_organization_events_rest(request_type): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3953,7 +3943,7 @@ def test_list_organization_events_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_organization_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3962,7 +3952,7 @@ def test_list_organization_events_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_organization_events._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3980,7 +3970,7 @@ def test_list_organization_events_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4024,7 +4014,7 @@ def test_list_organization_events_rest_required_fields( def test_list_organization_events_rest_unset_required_fields(): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_organization_events._get_unset_required_fields({}) @@ -4044,7 +4034,7 @@ def test_list_organization_events_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_organization_events_rest_interceptors(null_interceptor): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceHealthRestInterceptor(), @@ -4104,7 +4094,7 @@ def test_list_organization_events_rest_bad_request( transport: str = "rest", request_type=event_resources.ListOrganizationEventsRequest ): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4126,7 +4116,7 @@ def test_list_organization_events_rest_bad_request( def test_list_organization_events_rest_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4168,7 +4158,7 @@ def test_list_organization_events_rest_flattened(): def test_list_organization_events_rest_flattened_error(transport: str = "rest"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4183,7 +4173,7 @@ def test_list_organization_events_rest_flattened_error(transport: str = "rest"): def test_list_organization_events_rest_pager(transport: str = "rest"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4253,7 +4243,7 @@ def test_list_organization_events_rest_pager(transport: str = "rest"): ) def test_get_organization_event_rest(request_type): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4326,7 +4316,7 @@ def test_get_organization_event_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4335,7 +4325,7 @@ def test_get_organization_event_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4344,7 +4334,7 @@ def test_get_organization_event_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4386,7 +4376,7 @@ def test_get_organization_event_rest_required_fields( def test_get_organization_event_rest_unset_required_fields(): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_organization_event._get_unset_required_fields({}) @@ -4396,7 +4386,7 @@ def test_get_organization_event_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_organization_event_rest_interceptors(null_interceptor): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceHealthRestInterceptor(), @@ -4454,7 +4444,7 @@ def test_get_organization_event_rest_bad_request( transport: str = "rest", request_type=event_resources.GetOrganizationEventRequest ): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4478,7 +4468,7 @@ def test_get_organization_event_rest_bad_request( def test_get_organization_event_rest_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4522,7 +4512,7 @@ def test_get_organization_event_rest_flattened(): def test_get_organization_event_rest_flattened_error(transport: str = "rest"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4537,7 +4527,7 @@ def test_get_organization_event_rest_flattened_error(transport: str = "rest"): def test_get_organization_event_rest_error(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4550,7 +4540,7 @@ def test_get_organization_event_rest_error(): ) def test_list_organization_impacts_rest(request_type): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4603,7 +4593,7 @@ def test_list_organization_impacts_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_organization_impacts._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4612,7 +4602,7 @@ def test_list_organization_impacts_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_organization_impacts._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4629,7 +4619,7 @@ def test_list_organization_impacts_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4673,7 +4663,7 @@ def test_list_organization_impacts_rest_required_fields( def test_list_organization_impacts_rest_unset_required_fields(): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_organization_impacts._get_unset_required_fields({}) @@ -4692,7 +4682,7 @@ def test_list_organization_impacts_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_organization_impacts_rest_interceptors(null_interceptor): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceHealthRestInterceptor(), @@ -4752,7 +4742,7 @@ def test_list_organization_impacts_rest_bad_request( transport: str = "rest", request_type=event_resources.ListOrganizationImpactsRequest ): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4774,7 +4764,7 @@ def test_list_organization_impacts_rest_bad_request( def test_list_organization_impacts_rest_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4816,7 +4806,7 @@ def test_list_organization_impacts_rest_flattened(): def test_list_organization_impacts_rest_flattened_error(transport: str = "rest"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4831,7 +4821,7 @@ def test_list_organization_impacts_rest_flattened_error(transport: str = "rest") def test_list_organization_impacts_rest_pager(transport: str = "rest"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4901,7 +4891,7 @@ def test_list_organization_impacts_rest_pager(transport: str = "rest"): ) def test_get_organization_impact_rest(request_type): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4956,7 +4946,7 @@ def test_get_organization_impact_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_impact._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4965,7 +4955,7 @@ def test_get_organization_impact_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_organization_impact._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4974,7 +4964,7 @@ def test_get_organization_impact_rest_required_fields( assert jsonified_request["name"] == "name_value" client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5016,7 +5006,7 @@ def test_get_organization_impact_rest_required_fields( def test_get_organization_impact_rest_unset_required_fields(): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_organization_impact._get_unset_required_fields({}) @@ -5026,7 +5016,7 @@ def test_get_organization_impact_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_organization_impact_rest_interceptors(null_interceptor): transport = transports.ServiceHealthRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.ServiceHealthRestInterceptor(), @@ -5084,7 +5074,7 @@ def test_get_organization_impact_rest_bad_request( transport: str = "rest", request_type=event_resources.GetOrganizationImpactRequest ): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5108,7 +5098,7 @@ def test_get_organization_impact_rest_bad_request( def test_get_organization_impact_rest_flattened(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5152,7 +5142,7 @@ def test_get_organization_impact_rest_flattened(): def test_get_organization_impact_rest_flattened_error(transport: str = "rest"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5167,24 +5157,24 @@ def test_get_organization_impact_rest_flattened_error(transport: str = "rest"): def test_get_organization_impact_rest_error(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ServiceHealthGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.ServiceHealthGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceHealthClient( @@ -5194,7 +5184,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.ServiceHealthGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5209,13 +5199,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = ServiceHealthClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.ServiceHealthGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = ServiceHealthClient( @@ -5227,7 +5216,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceHealthGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = ServiceHealthClient(transport=transport) assert client.transport is transport @@ -5236,13 +5225,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.ServiceHealthGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.ServiceHealthGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -5259,7 +5248,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -5273,7 +5262,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = ServiceHealthClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -5281,7 +5270,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -5293,7 +5282,7 @@ def test_service_health_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.ServiceHealthTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -5305,7 +5294,7 @@ def test_service_health_base_transport(): ) as Transport: Transport.return_value = None transport = transports.ServiceHealthTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -5344,7 +5333,7 @@ def test_service_health_base_transport_with_credentials_file(): "google.cloud.servicehealth_v1.services.service_health.transports.ServiceHealthTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceHealthTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -5363,7 +5352,7 @@ def test_service_health_base_transport_with_adc(): "google.cloud.servicehealth_v1.services.service_health.transports.ServiceHealthTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ServiceHealthTransport() adc.assert_called_once() @@ -5371,7 +5360,7 @@ def test_service_health_base_transport_with_adc(): def test_service_health_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) ServiceHealthClient() adc.assert_called_once_with( scopes=None, @@ -5391,7 +5380,7 @@ def test_service_health_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -5438,7 +5427,7 @@ def test_service_health_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -5466,7 +5455,7 @@ def test_service_health_transport_create_channel(transport_class, grpc_helpers): ], ) def test_service_health_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -5504,7 +5493,7 @@ def test_service_health_grpc_transport_client_cert_source_for_mtls(transport_cla def test_service_health_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -5524,7 +5513,7 @@ def test_service_health_http_transport_client_cert_source_for_mtls(): ) def test_service_health_host_no_port(transport_name): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicehealth.googleapis.com" ), @@ -5547,7 +5536,7 @@ def test_service_health_host_no_port(transport_name): ) def test_service_health_host_with_port(transport_name): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="servicehealth.googleapis.com:8000" ), @@ -5567,8 +5556,8 @@ def test_service_health_host_with_port(transport_name): ], ) def test_service_health_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = ServiceHealthClient( credentials=creds1, transport=transport_name, @@ -5645,7 +5634,7 @@ def test_service_health_transport_channel_mtls_with_client_cert_source(transport mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -5911,7 +5900,7 @@ def test_client_with_default_client_info(): transports.ServiceHealthTransport, "_prep_wrapped_messages" ) as prep: client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5921,7 +5910,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ServiceHealthClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5930,7 +5919,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -5945,7 +5934,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5975,7 +5964,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -6003,7 +5992,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6031,7 +6020,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -6057,7 +6046,7 @@ def test_list_locations_rest(request_type): def test_list_locations(transport: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6082,7 +6071,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6108,7 +6097,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6137,7 +6126,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6166,7 +6155,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6184,7 +6173,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6202,7 +6191,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6227,7 +6216,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6252,7 +6241,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): - client = ServiceHealthClient(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = ServiceHealthClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -6279,9 +6268,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): - client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + client = ServiceHealthAsyncClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -6309,7 +6296,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6327,7 +6314,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = ServiceHealthAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -6351,7 +6338,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -6368,7 +6355,7 @@ def test_client_ctx(): ] for transport in transports: client = ServiceHealthClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-shell/google/cloud/shell/gapic_version.py b/packages/google-cloud-shell/google/cloud/shell/gapic_version.py index b7ebf472ead3..360a0d13ebdd 100644 --- a/packages/google-cloud-shell/google/cloud/shell/gapic_version.py +++ b/packages/google-cloud-shell/google/cloud/shell/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-shell/google/cloud/shell_v1/gapic_version.py b/packages/google-cloud-shell/google/cloud/shell_v1/gapic_version.py index b7ebf472ead3..360a0d13ebdd 100644 --- a/packages/google-cloud-shell/google/cloud/shell_v1/gapic_version.py +++ b/packages/google-cloud-shell/google/cloud/shell_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.9.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-shell/google/cloud/shell_v1/services/cloud_shell_service/client.py b/packages/google-cloud-shell/google/cloud/shell_v1/services/cloud_shell_service/client.py index 354a14006feb..f4aa4634d9a0 100644 --- a/packages/google-cloud-shell/google/cloud/shell_v1/services/cloud_shell_service/client.py +++ b/packages/google-cloud-shell/google/cloud/shell_v1/services/cloud_shell_service/client.py @@ -388,6 +388,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -406,6 +407,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -480,17 +482,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = CloudShellServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = CloudShellServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-shell/samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json b/packages/google-cloud-shell/samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json index 8c6e81ce9afa..3389a15fe5da 100644 --- a/packages/google-cloud-shell/samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json +++ b/packages/google-cloud-shell/samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-shell", - "version": "1.9.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-shell/setup.py b/packages/google-cloud-shell/setup.py index 5714ea23341c..8ecbd624cf13 100644 --- a/packages/google-cloud-shell/setup.py +++ b/packages/google-cloud-shell/setup.py @@ -40,6 +40,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-shell/testing/constraints-3.7.txt b/packages/google-cloud-shell/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-shell/testing/constraints-3.7.txt +++ b/packages/google-cloud-shell/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-shell/tests/unit/gapic/shell_v1/test_cloud_shell_service.py b/packages/google-cloud-shell/tests/unit/gapic/shell_v1/test_cloud_shell_service.py index 270ee058bd3d..5fc11690e611 100644 --- a/packages/google-cloud-shell/tests/unit/gapic/shell_v1/test_cloud_shell_service.py +++ b/packages/google-cloud-shell/tests/unit/gapic/shell_v1/test_cloud_shell_service.py @@ -87,18 +87,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -334,7 +322,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -361,42 +349,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -409,7 +404,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_cloud_shell_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -463,7 +458,7 @@ def test_cloud_shell_service_client_service_account_always_use_jwt( def test_cloud_shell_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -526,9 +521,7 @@ def test_cloud_shell_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(CloudShellServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -947,20 +940,20 @@ def test_cloud_shell_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -972,13 +965,11 @@ def test_cloud_shell_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -994,8 +985,7 @@ def test_cloud_shell_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1153,8 +1143,8 @@ def test_cloud_shell_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1183,7 +1173,7 @@ def test_cloud_shell_service_client_create_channel_credentials_file( ) def test_get_environment(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1229,7 +1219,7 @@ def test_get_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1246,7 +1236,7 @@ async def test_get_environment_async( transport: str = "grpc_asyncio", request_type=cloudshell.GetEnvironmentRequest ): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1297,7 +1287,7 @@ async def test_get_environment_async_from_dict(): def test_get_environment_field_headers(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1327,7 +1317,7 @@ def test_get_environment_field_headers(): @pytest.mark.asyncio async def test_get_environment_field_headers_async(): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1358,7 +1348,7 @@ async def test_get_environment_field_headers_async(): def test_get_environment_flattened(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1382,7 +1372,7 @@ def test_get_environment_flattened(): def test_get_environment_flattened_error(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1397,7 +1387,7 @@ def test_get_environment_flattened_error(): @pytest.mark.asyncio async def test_get_environment_flattened_async(): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1426,7 +1416,7 @@ async def test_get_environment_flattened_async(): @pytest.mark.asyncio async def test_get_environment_flattened_error_async(): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1447,7 +1437,7 @@ async def test_get_environment_flattened_error_async(): ) def test_start_environment(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1476,7 +1466,7 @@ def test_start_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1495,7 +1485,7 @@ async def test_start_environment_async( transport: str = "grpc_asyncio", request_type=cloudshell.StartEnvironmentRequest ): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1529,7 +1519,7 @@ async def test_start_environment_async_from_dict(): def test_start_environment_field_headers(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1561,7 +1551,7 @@ def test_start_environment_field_headers(): @pytest.mark.asyncio async def test_start_environment_field_headers_async(): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1601,7 +1591,7 @@ async def test_start_environment_field_headers_async(): ) def test_authorize_environment(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1630,7 +1620,7 @@ def test_authorize_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1649,7 +1639,7 @@ async def test_authorize_environment_async( transport: str = "grpc_asyncio", request_type=cloudshell.AuthorizeEnvironmentRequest ): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1683,7 +1673,7 @@ async def test_authorize_environment_async_from_dict(): def test_authorize_environment_field_headers(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1715,7 +1705,7 @@ def test_authorize_environment_field_headers(): @pytest.mark.asyncio async def test_authorize_environment_field_headers_async(): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1755,7 +1745,7 @@ async def test_authorize_environment_field_headers_async(): ) def test_add_public_key(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1782,7 +1772,7 @@ def test_add_public_key_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1799,7 +1789,7 @@ async def test_add_public_key_async( transport: str = "grpc_asyncio", request_type=cloudshell.AddPublicKeyRequest ): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1831,7 +1821,7 @@ async def test_add_public_key_async_from_dict(): def test_add_public_key_field_headers(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1861,7 +1851,7 @@ def test_add_public_key_field_headers(): @pytest.mark.asyncio async def test_add_public_key_field_headers_async(): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1899,7 +1889,7 @@ async def test_add_public_key_field_headers_async(): ) def test_remove_public_key(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1928,7 +1918,7 @@ def test_remove_public_key_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1947,7 +1937,7 @@ async def test_remove_public_key_async( transport: str = "grpc_asyncio", request_type=cloudshell.RemovePublicKeyRequest ): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1981,7 +1971,7 @@ async def test_remove_public_key_async_from_dict(): def test_remove_public_key_field_headers(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2013,7 +2003,7 @@ def test_remove_public_key_field_headers(): @pytest.mark.asyncio async def test_remove_public_key_field_headers_async(): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2053,7 +2043,7 @@ async def test_remove_public_key_field_headers_async(): ) def test_get_environment_rest(request_type): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2120,7 +2110,7 @@ def test_get_environment_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_environment._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2129,7 +2119,7 @@ def test_get_environment_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_environment._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -2138,7 +2128,7 @@ def test_get_environment_rest_required_fields( assert jsonified_request["name"] == "name_value" client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -2180,7 +2170,7 @@ def test_get_environment_rest_required_fields( def test_get_environment_rest_unset_required_fields(): transport = transports.CloudShellServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_environment._get_unset_required_fields({}) @@ -2190,7 +2180,7 @@ def test_get_environment_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_environment_rest_interceptors(null_interceptor): transport = transports.CloudShellServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudShellServiceRestInterceptor(), @@ -2248,7 +2238,7 @@ def test_get_environment_rest_bad_request( transport: str = "rest", request_type=cloudshell.GetEnvironmentRequest ): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2270,7 +2260,7 @@ def test_get_environment_rest_bad_request( def test_get_environment_rest_flattened(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2310,7 +2300,7 @@ def test_get_environment_rest_flattened(): def test_get_environment_rest_flattened_error(transport: str = "rest"): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2325,7 +2315,7 @@ def test_get_environment_rest_flattened_error(transport: str = "rest"): def test_get_environment_rest_error(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2338,7 +2328,7 @@ def test_get_environment_rest_error(): ) def test_start_environment_rest(request_type): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2367,7 +2357,7 @@ def test_start_environment_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_start_environment_rest_interceptors(null_interceptor): transport = transports.CloudShellServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudShellServiceRestInterceptor(), @@ -2427,7 +2417,7 @@ def test_start_environment_rest_bad_request( transport: str = "rest", request_type=cloudshell.StartEnvironmentRequest ): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2449,7 +2439,7 @@ def test_start_environment_rest_bad_request( def test_start_environment_rest_error(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2462,7 +2452,7 @@ def test_start_environment_rest_error(): ) def test_authorize_environment_rest(request_type): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2491,7 +2481,7 @@ def test_authorize_environment_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_authorize_environment_rest_interceptors(null_interceptor): transport = transports.CloudShellServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudShellServiceRestInterceptor(), @@ -2551,7 +2541,7 @@ def test_authorize_environment_rest_bad_request( transport: str = "rest", request_type=cloudshell.AuthorizeEnvironmentRequest ): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2573,7 +2563,7 @@ def test_authorize_environment_rest_bad_request( def test_authorize_environment_rest_error(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2586,7 +2576,7 @@ def test_authorize_environment_rest_error(): ) def test_add_public_key_rest(request_type): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2615,7 +2605,7 @@ def test_add_public_key_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_add_public_key_rest_interceptors(null_interceptor): transport = transports.CloudShellServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudShellServiceRestInterceptor(), @@ -2673,7 +2663,7 @@ def test_add_public_key_rest_bad_request( transport: str = "rest", request_type=cloudshell.AddPublicKeyRequest ): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2695,7 +2685,7 @@ def test_add_public_key_rest_bad_request( def test_add_public_key_rest_error(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -2708,7 +2698,7 @@ def test_add_public_key_rest_error(): ) def test_remove_public_key_rest(request_type): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2737,7 +2727,7 @@ def test_remove_public_key_rest(request_type): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_remove_public_key_rest_interceptors(null_interceptor): transport = transports.CloudShellServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.CloudShellServiceRestInterceptor(), @@ -2797,7 +2787,7 @@ def test_remove_public_key_rest_bad_request( transport: str = "rest", request_type=cloudshell.RemovePublicKeyRequest ): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2819,24 +2809,24 @@ def test_remove_public_key_rest_bad_request( def test_remove_public_key_rest_error(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.CloudShellServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.CloudShellServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudShellServiceClient( @@ -2846,7 +2836,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.CloudShellServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -2861,13 +2851,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CloudShellServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.CloudShellServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = CloudShellServiceClient( @@ -2879,7 +2868,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.CloudShellServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = CloudShellServiceClient(transport=transport) assert client.transport is transport @@ -2888,13 +2877,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CloudShellServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.CloudShellServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -2911,7 +2900,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -2925,7 +2914,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = CloudShellServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -2933,7 +2922,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -2945,7 +2934,7 @@ def test_cloud_shell_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CloudShellServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -2957,7 +2946,7 @@ def test_cloud_shell_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.CloudShellServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -2998,7 +2987,7 @@ def test_cloud_shell_service_base_transport_with_credentials_file(): "google.cloud.shell_v1.services.cloud_shell_service.transports.CloudShellServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudShellServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -3017,7 +3006,7 @@ def test_cloud_shell_service_base_transport_with_adc(): "google.cloud.shell_v1.services.cloud_shell_service.transports.CloudShellServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudShellServiceTransport() adc.assert_called_once() @@ -3025,7 +3014,7 @@ def test_cloud_shell_service_base_transport_with_adc(): def test_cloud_shell_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) CloudShellServiceClient() adc.assert_called_once_with( scopes=None, @@ -3045,7 +3034,7 @@ def test_cloud_shell_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -3092,7 +3081,7 @@ def test_cloud_shell_service_transport_create_channel(transport_class, grpc_help ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -3122,7 +3111,7 @@ def test_cloud_shell_service_transport_create_channel(transport_class, grpc_help def test_cloud_shell_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -3160,7 +3149,7 @@ def test_cloud_shell_service_grpc_transport_client_cert_source_for_mtls( def test_cloud_shell_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -3172,7 +3161,7 @@ def test_cloud_shell_service_http_transport_client_cert_source_for_mtls(): def test_cloud_shell_service_rest_lro_client(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -3197,7 +3186,7 @@ def test_cloud_shell_service_rest_lro_client(): ) def test_cloud_shell_service_host_no_port(transport_name): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudshell.googleapis.com" ), @@ -3220,7 +3209,7 @@ def test_cloud_shell_service_host_no_port(transport_name): ) def test_cloud_shell_service_host_with_port(transport_name): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudshell.googleapis.com:8000" ), @@ -3240,8 +3229,8 @@ def test_cloud_shell_service_host_with_port(transport_name): ], ) def test_cloud_shell_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = CloudShellServiceClient( credentials=creds1, transport=transport_name, @@ -3317,7 +3306,7 @@ def test_cloud_shell_service_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -3395,7 +3384,7 @@ def test_cloud_shell_service_transport_channel_mtls_with_adc(transport_class): def test_cloud_shell_service_grpc_lro_client(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -3412,7 +3401,7 @@ def test_cloud_shell_service_grpc_lro_client(): def test_cloud_shell_service_grpc_lro_async_client(): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -3560,7 +3549,7 @@ def test_client_with_default_client_info(): transports.CloudShellServiceTransport, "_prep_wrapped_messages" ) as prep: client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3570,7 +3559,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CloudShellServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3579,7 +3568,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CloudShellServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -3598,7 +3587,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3615,7 +3604,7 @@ def test_client_ctx(): ] for transport in transports: client = CloudShellServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-source-context/google/cloud/source_context/gapic_version.py b/packages/google-cloud-source-context/google/cloud/source_context/gapic_version.py index c024d69dafa9..360a0d13ebdd 100644 --- a/packages/google-cloud-source-context/google/cloud/source_context/gapic_version.py +++ b/packages/google-cloud-source-context/google/cloud/source_context/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.5.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-source-context/google/cloud/source_context_v1/gapic_version.py b/packages/google-cloud-source-context/google/cloud/source_context_v1/gapic_version.py index c024d69dafa9..360a0d13ebdd 100644 --- a/packages/google-cloud-source-context/google/cloud/source_context_v1/gapic_version.py +++ b/packages/google-cloud-source-context/google/cloud/source_context_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.5.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-source-context/noxfile.py b/packages/google-cloud-source-context/noxfile.py index 7d3551347c78..1e6cd48d0529 100644 --- a/packages/google-cloud-source-context/noxfile.py +++ b/packages/google-cloud-source-context/noxfile.py @@ -282,6 +282,15 @@ def docs(session): session.install("-e", ".") session.install( + # We need to pin to specific versions of the `sphinxcontrib-*` packages + # which still support sphinx 4.x. + # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344 + # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345. + "sphinxcontrib-applehelp==1.0.4", + "sphinxcontrib-devhelp==1.0.2", + "sphinxcontrib-htmlhelp==2.0.1", + "sphinxcontrib-qthelp==1.0.3", + "sphinxcontrib-serializinghtml==1.1.5", "sphinx==4.5.0", "alabaster", "recommonmark", @@ -308,6 +317,15 @@ def docfx(session): session.install("-e", ".") session.install( + # We need to pin to specific versions of the `sphinxcontrib-*` packages + # which still support sphinx 4.x. + # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344 + # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345. + "sphinxcontrib-applehelp==1.0.4", + "sphinxcontrib-devhelp==1.0.2", + "sphinxcontrib-htmlhelp==2.0.1", + "sphinxcontrib-qthelp==1.0.3", + "sphinxcontrib-serializinghtml==1.1.5", "gcp-sphinx-docfx-yaml", "alabaster", "recommonmark", diff --git a/packages/google-cloud-source-context/setup.py b/packages/google-cloud-source-context/setup.py index 64893f48d425..de9aaead0022 100644 --- a/packages/google-cloud-source-context/setup.py +++ b/packages/google-cloud-source-context/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-source-context/testing/constraints-3.7.txt b/packages/google-cloud-source-context/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-source-context/testing/constraints-3.7.txt +++ b/packages/google-cloud-source-context/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-speech/google/cloud/speech/gapic_version.py b/packages/google-cloud-speech/google/cloud/speech/gapic_version.py index ff6eaf3d5023..360a0d13ebdd 100644 --- a/packages/google-cloud-speech/google/cloud/speech/gapic_version.py +++ b/packages/google-cloud-speech/google/cloud/speech/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.24.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-speech/google/cloud/speech_v1/gapic_version.py b/packages/google-cloud-speech/google/cloud/speech_v1/gapic_version.py index ff6eaf3d5023..360a0d13ebdd 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v1/gapic_version.py +++ b/packages/google-cloud-speech/google/cloud/speech_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.24.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-speech/google/cloud/speech_v1/services/adaptation/client.py b/packages/google-cloud-speech/google/cloud/speech_v1/services/adaptation/client.py index b5b5891fb111..9fa20d38577c 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v1/services/adaptation/client.py +++ b/packages/google-cloud-speech/google/cloud/speech_v1/services/adaptation/client.py @@ -405,6 +405,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -423,6 +424,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -497,17 +499,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = AdaptationClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = AdaptationClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-speech/google/cloud/speech_v1/services/speech/client.py b/packages/google-cloud-speech/google/cloud/speech_v1/services/speech/client.py index c2fb95b8c479..d8ea23f68536 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v1/services/speech/client.py +++ b/packages/google-cloud-speech/google/cloud/speech_v1/services/speech/client.py @@ -409,6 +409,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -427,6 +428,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -501,17 +503,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SpeechClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SpeechClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/gapic_version.py b/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/gapic_version.py index ff6eaf3d5023..360a0d13ebdd 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/gapic_version.py +++ b/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.24.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/adaptation/client.py b/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/adaptation/client.py index b22750b37584..7bfbb4afdbee 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/adaptation/client.py +++ b/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/adaptation/client.py @@ -405,6 +405,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -423,6 +424,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -497,17 +499,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = AdaptationClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = AdaptationClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/speech/client.py b/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/speech/client.py index dcf1a4bc37ec..99e7d2a301c9 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/speech/client.py +++ b/packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/speech/client.py @@ -409,6 +409,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -427,6 +428,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -501,17 +503,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SpeechClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SpeechClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-speech/google/cloud/speech_v2/gapic_version.py b/packages/google-cloud-speech/google/cloud/speech_v2/gapic_version.py index ff6eaf3d5023..360a0d13ebdd 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v2/gapic_version.py +++ b/packages/google-cloud-speech/google/cloud/speech_v2/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.24.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-speech/google/cloud/speech_v2/services/speech/client.py b/packages/google-cloud-speech/google/cloud/speech_v2/services/speech/client.py index eee6fb4057fa..7432a733d009 100644 --- a/packages/google-cloud-speech/google/cloud/speech_v2/services/speech/client.py +++ b/packages/google-cloud-speech/google/cloud/speech_v2/services/speech/client.py @@ -505,6 +505,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -523,6 +524,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -597,17 +599,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = SpeechClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = SpeechClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1.json b/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1.json index a76461489c7f..c793efe0e3c8 100644 --- a/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1.json +++ b/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-speech", - "version": "2.24.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1p1beta1.json b/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1p1beta1.json index 336f3572ca69..b51d437c94b0 100644 --- a/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1p1beta1.json +++ b/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1p1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-speech", - "version": "2.24.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v2.json b/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v2.json index c01f550d3cc7..73ac2fc19d50 100644 --- a/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v2.json +++ b/packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-speech", - "version": "2.24.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-speech/setup.py b/packages/google-cloud-speech/setup.py index 00658afa62fe..d340b2acdf32 100644 --- a/packages/google-cloud-speech/setup.py +++ b/packages/google-cloud-speech/setup.py @@ -40,6 +40,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-speech/testing/constraints-3.7.txt b/packages/google-cloud-speech/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-speech/testing/constraints-3.7.txt +++ b/packages/google-cloud-speech/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_adaptation.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_adaptation.py index 0e7f064eb0a5..4512e98f00b2 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_adaptation.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_adaptation.py @@ -79,18 +79,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -294,7 +282,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -321,42 +309,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -367,7 +362,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_adaptation_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -419,7 +414,7 @@ def test_adaptation_client_service_account_always_use_jwt( ], ) def test_adaptation_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -482,9 +477,7 @@ def test_adaptation_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(AdaptationClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -877,20 +870,20 @@ def test_adaptation_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -902,13 +895,11 @@ def test_adaptation_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -924,8 +915,7 @@ def test_adaptation_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1066,8 +1056,8 @@ def test_adaptation_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1096,7 +1086,7 @@ def test_adaptation_client_create_channel_credentials_file( ) def test_create_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1130,7 +1120,7 @@ def test_create_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1150,7 +1140,7 @@ async def test_create_phrase_set_async( request_type=cloud_speech_adaptation.CreatePhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1189,7 +1179,7 @@ async def test_create_phrase_set_async_from_dict(): def test_create_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1221,7 +1211,7 @@ def test_create_phrase_set_field_headers(): @pytest.mark.asyncio async def test_create_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1252,7 +1242,7 @@ async def test_create_phrase_set_field_headers_async(): def test_create_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1286,7 +1276,7 @@ def test_create_phrase_set_flattened(): def test_create_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1303,7 +1293,7 @@ def test_create_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_create_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1340,7 +1330,7 @@ async def test_create_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_create_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1363,7 +1353,7 @@ async def test_create_phrase_set_flattened_error_async(): ) def test_get_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1395,7 +1385,7 @@ def test_get_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1413,7 +1403,7 @@ async def test_get_phrase_set_async( request_type=cloud_speech_adaptation.GetPhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1450,7 +1440,7 @@ async def test_get_phrase_set_async_from_dict(): def test_get_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1480,7 +1470,7 @@ def test_get_phrase_set_field_headers(): @pytest.mark.asyncio async def test_get_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1509,7 +1499,7 @@ async def test_get_phrase_set_field_headers_async(): def test_get_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1533,7 +1523,7 @@ def test_get_phrase_set_flattened(): def test_get_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1548,7 +1538,7 @@ def test_get_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_get_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1575,7 +1565,7 @@ async def test_get_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_get_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1596,7 +1586,7 @@ async def test_get_phrase_set_flattened_error_async(): ) def test_list_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1626,7 +1616,7 @@ def test_list_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1644,7 +1634,7 @@ async def test_list_phrase_set_async( request_type=cloud_speech_adaptation.ListPhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1679,7 +1669,7 @@ async def test_list_phrase_set_async_from_dict(): def test_list_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1709,7 +1699,7 @@ def test_list_phrase_set_field_headers(): @pytest.mark.asyncio async def test_list_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1740,7 +1730,7 @@ async def test_list_phrase_set_field_headers_async(): def test_list_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1764,7 +1754,7 @@ def test_list_phrase_set_flattened(): def test_list_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1779,7 +1769,7 @@ def test_list_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_list_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1808,7 +1798,7 @@ async def test_list_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_list_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1822,7 +1812,7 @@ async def test_list_phrase_set_flattened_error_async(): def test_list_phrase_set_pager(transport_name: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1872,7 +1862,7 @@ def test_list_phrase_set_pager(transport_name: str = "grpc"): def test_list_phrase_set_pages(transport_name: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1914,7 +1904,7 @@ def test_list_phrase_set_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_phrase_set_async_pager(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1964,7 +1954,7 @@ async def test_list_phrase_set_async_pager(): @pytest.mark.asyncio async def test_list_phrase_set_async_pages(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2019,7 +2009,7 @@ async def test_list_phrase_set_async_pages(): ) def test_update_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2053,7 +2043,7 @@ def test_update_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2073,7 +2063,7 @@ async def test_update_phrase_set_async( request_type=cloud_speech_adaptation.UpdatePhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2112,7 +2102,7 @@ async def test_update_phrase_set_async_from_dict(): def test_update_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2144,7 +2134,7 @@ def test_update_phrase_set_field_headers(): @pytest.mark.asyncio async def test_update_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2175,7 +2165,7 @@ async def test_update_phrase_set_field_headers_async(): def test_update_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2205,7 +2195,7 @@ def test_update_phrase_set_flattened(): def test_update_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2221,7 +2211,7 @@ def test_update_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_update_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2254,7 +2244,7 @@ async def test_update_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_update_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2276,7 +2266,7 @@ async def test_update_phrase_set_flattened_error_async(): ) def test_delete_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2305,7 +2295,7 @@ def test_delete_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2325,7 +2315,7 @@ async def test_delete_phrase_set_async( request_type=cloud_speech_adaptation.DeletePhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2357,7 +2347,7 @@ async def test_delete_phrase_set_async_from_dict(): def test_delete_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2389,7 +2379,7 @@ def test_delete_phrase_set_field_headers(): @pytest.mark.asyncio async def test_delete_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2420,7 +2410,7 @@ async def test_delete_phrase_set_field_headers_async(): def test_delete_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2446,7 +2436,7 @@ def test_delete_phrase_set_flattened(): def test_delete_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2461,7 +2451,7 @@ def test_delete_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_delete_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2490,7 +2480,7 @@ async def test_delete_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_delete_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2511,7 +2501,7 @@ async def test_delete_phrase_set_flattened_error_async(): ) def test_create_custom_class(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2545,7 +2535,7 @@ def test_create_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2565,7 +2555,7 @@ async def test_create_custom_class_async( request_type=cloud_speech_adaptation.CreateCustomClassRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2604,7 +2594,7 @@ async def test_create_custom_class_async_from_dict(): def test_create_custom_class_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2636,7 +2626,7 @@ def test_create_custom_class_field_headers(): @pytest.mark.asyncio async def test_create_custom_class_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2669,7 +2659,7 @@ async def test_create_custom_class_field_headers_async(): def test_create_custom_class_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2703,7 +2693,7 @@ def test_create_custom_class_flattened(): def test_create_custom_class_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2720,7 +2710,7 @@ def test_create_custom_class_flattened_error(): @pytest.mark.asyncio async def test_create_custom_class_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2759,7 +2749,7 @@ async def test_create_custom_class_flattened_async(): @pytest.mark.asyncio async def test_create_custom_class_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2782,7 +2772,7 @@ async def test_create_custom_class_flattened_error_async(): ) def test_get_custom_class(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2814,7 +2804,7 @@ def test_get_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2832,7 +2822,7 @@ async def test_get_custom_class_async( request_type=cloud_speech_adaptation.GetCustomClassRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2869,7 +2859,7 @@ async def test_get_custom_class_async_from_dict(): def test_get_custom_class_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2899,7 +2889,7 @@ def test_get_custom_class_field_headers(): @pytest.mark.asyncio async def test_get_custom_class_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2930,7 +2920,7 @@ async def test_get_custom_class_field_headers_async(): def test_get_custom_class_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2954,7 +2944,7 @@ def test_get_custom_class_flattened(): def test_get_custom_class_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2969,7 +2959,7 @@ def test_get_custom_class_flattened_error(): @pytest.mark.asyncio async def test_get_custom_class_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2998,7 +2988,7 @@ async def test_get_custom_class_flattened_async(): @pytest.mark.asyncio async def test_get_custom_class_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3019,7 +3009,7 @@ async def test_get_custom_class_flattened_error_async(): ) def test_list_custom_classes(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3051,7 +3041,7 @@ def test_list_custom_classes_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3071,7 +3061,7 @@ async def test_list_custom_classes_async( request_type=cloud_speech_adaptation.ListCustomClassesRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3108,7 +3098,7 @@ async def test_list_custom_classes_async_from_dict(): def test_list_custom_classes_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3140,7 +3130,7 @@ def test_list_custom_classes_field_headers(): @pytest.mark.asyncio async def test_list_custom_classes_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3173,7 +3163,7 @@ async def test_list_custom_classes_field_headers_async(): def test_list_custom_classes_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3199,7 +3189,7 @@ def test_list_custom_classes_flattened(): def test_list_custom_classes_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3214,7 +3204,7 @@ def test_list_custom_classes_flattened_error(): @pytest.mark.asyncio async def test_list_custom_classes_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3245,7 +3235,7 @@ async def test_list_custom_classes_flattened_async(): @pytest.mark.asyncio async def test_list_custom_classes_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3259,7 +3249,7 @@ async def test_list_custom_classes_flattened_error_async(): def test_list_custom_classes_pager(transport_name: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3311,7 +3301,7 @@ def test_list_custom_classes_pager(transport_name: str = "grpc"): def test_list_custom_classes_pages(transport_name: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3355,7 +3345,7 @@ def test_list_custom_classes_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_custom_classes_async_pager(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3407,7 +3397,7 @@ async def test_list_custom_classes_async_pager(): @pytest.mark.asyncio async def test_list_custom_classes_async_pages(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3464,7 +3454,7 @@ async def test_list_custom_classes_async_pages(): ) def test_update_custom_class(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3498,7 +3488,7 @@ def test_update_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3518,7 +3508,7 @@ async def test_update_custom_class_async( request_type=cloud_speech_adaptation.UpdateCustomClassRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3557,7 +3547,7 @@ async def test_update_custom_class_async_from_dict(): def test_update_custom_class_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3589,7 +3579,7 @@ def test_update_custom_class_field_headers(): @pytest.mark.asyncio async def test_update_custom_class_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3622,7 +3612,7 @@ async def test_update_custom_class_field_headers_async(): def test_update_custom_class_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3652,7 +3642,7 @@ def test_update_custom_class_flattened(): def test_update_custom_class_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3668,7 +3658,7 @@ def test_update_custom_class_flattened_error(): @pytest.mark.asyncio async def test_update_custom_class_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3703,7 +3693,7 @@ async def test_update_custom_class_flattened_async(): @pytest.mark.asyncio async def test_update_custom_class_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3725,7 +3715,7 @@ async def test_update_custom_class_flattened_error_async(): ) def test_delete_custom_class(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3754,7 +3744,7 @@ def test_delete_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3774,7 +3764,7 @@ async def test_delete_custom_class_async( request_type=cloud_speech_adaptation.DeleteCustomClassRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3806,7 +3796,7 @@ async def test_delete_custom_class_async_from_dict(): def test_delete_custom_class_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3838,7 +3828,7 @@ def test_delete_custom_class_field_headers(): @pytest.mark.asyncio async def test_delete_custom_class_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3869,7 +3859,7 @@ async def test_delete_custom_class_field_headers_async(): def test_delete_custom_class_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3895,7 +3885,7 @@ def test_delete_custom_class_flattened(): def test_delete_custom_class_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3910,7 +3900,7 @@ def test_delete_custom_class_flattened_error(): @pytest.mark.asyncio async def test_delete_custom_class_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3939,7 +3929,7 @@ async def test_delete_custom_class_flattened_async(): @pytest.mark.asyncio async def test_delete_custom_class_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3960,7 +3950,7 @@ async def test_delete_custom_class_flattened_error_async(): ) def test_create_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4014,7 +4004,7 @@ def test_create_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4024,7 +4014,7 @@ def test_create_phrase_set_rest_required_fields( jsonified_request["phraseSetId"] = "phrase_set_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4035,7 +4025,7 @@ def test_create_phrase_set_rest_required_fields( assert jsonified_request["phraseSetId"] == "phrase_set_id_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4078,7 +4068,7 @@ def test_create_phrase_set_rest_required_fields( def test_create_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_phrase_set._get_unset_required_fields({}) @@ -4097,7 +4087,7 @@ def test_create_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -4153,7 +4143,7 @@ def test_create_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.CreatePhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4175,7 +4165,7 @@ def test_create_phrase_set_rest_bad_request( def test_create_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4218,7 +4208,7 @@ def test_create_phrase_set_rest_flattened(): def test_create_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4235,7 +4225,7 @@ def test_create_phrase_set_rest_flattened_error(transport: str = "rest"): def test_create_phrase_set_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4248,7 +4238,7 @@ def test_create_phrase_set_rest_error(): ) def test_get_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4301,7 +4291,7 @@ def test_get_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4310,7 +4300,7 @@ def test_get_phrase_set_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4319,7 +4309,7 @@ def test_get_phrase_set_rest_required_fields( assert jsonified_request["name"] == "name_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4361,7 +4351,7 @@ def test_get_phrase_set_rest_required_fields( def test_get_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_phrase_set._get_unset_required_fields({}) @@ -4371,7 +4361,7 @@ def test_get_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -4427,7 +4417,7 @@ def test_get_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.GetPhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4449,7 +4439,7 @@ def test_get_phrase_set_rest_bad_request( def test_get_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4492,7 +4482,7 @@ def test_get_phrase_set_rest_flattened(): def test_get_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4507,7 +4497,7 @@ def test_get_phrase_set_rest_flattened_error(transport: str = "rest"): def test_get_phrase_set_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4520,7 +4510,7 @@ def test_get_phrase_set_rest_error(): ) def test_list_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4571,7 +4561,7 @@ def test_list_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4580,7 +4570,7 @@ def test_list_phrase_set_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_phrase_set._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4596,7 +4586,7 @@ def test_list_phrase_set_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4640,7 +4630,7 @@ def test_list_phrase_set_rest_required_fields( def test_list_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_phrase_set._get_unset_required_fields({}) @@ -4658,7 +4648,7 @@ def test_list_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -4718,7 +4708,7 @@ def test_list_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.ListPhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4740,7 +4730,7 @@ def test_list_phrase_set_rest_bad_request( def test_list_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4781,7 +4771,7 @@ def test_list_phrase_set_rest_flattened(): def test_list_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4796,7 +4786,7 @@ def test_list_phrase_set_rest_flattened_error(transport: str = "rest"): def test_list_phrase_set_rest_pager(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4866,7 +4856,7 @@ def test_list_phrase_set_rest_pager(transport: str = "rest"): ) def test_update_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4994,14 +4984,14 @@ def test_update_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_phrase_set._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5010,7 +5000,7 @@ def test_update_phrase_set_rest_required_fields( # verify required fields with non-default values are left alone client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5053,7 +5043,7 @@ def test_update_phrase_set_rest_required_fields( def test_update_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_phrase_set._get_unset_required_fields({}) @@ -5063,7 +5053,7 @@ def test_update_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -5119,7 +5109,7 @@ def test_update_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.UpdatePhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5143,7 +5133,7 @@ def test_update_phrase_set_rest_bad_request( def test_update_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5190,7 +5180,7 @@ def test_update_phrase_set_rest_flattened(): def test_update_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5206,7 +5196,7 @@ def test_update_phrase_set_rest_flattened_error(transport: str = "rest"): def test_update_phrase_set_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5219,7 +5209,7 @@ def test_update_phrase_set_rest_error(): ) def test_delete_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5265,7 +5255,7 @@ def test_delete_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5274,7 +5264,7 @@ def test_delete_phrase_set_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5283,7 +5273,7 @@ def test_delete_phrase_set_rest_required_fields( assert jsonified_request["name"] == "name_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5322,7 +5312,7 @@ def test_delete_phrase_set_rest_required_fields( def test_delete_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_phrase_set._get_unset_required_fields({}) @@ -5332,7 +5322,7 @@ def test_delete_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -5382,7 +5372,7 @@ def test_delete_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.DeletePhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5404,7 +5394,7 @@ def test_delete_phrase_set_rest_bad_request( def test_delete_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5445,7 +5435,7 @@ def test_delete_phrase_set_rest_flattened(): def test_delete_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5460,7 +5450,7 @@ def test_delete_phrase_set_rest_flattened_error(transport: str = "rest"): def test_delete_phrase_set_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5473,7 +5463,7 @@ def test_delete_phrase_set_rest_error(): ) def test_create_custom_class_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5527,7 +5517,7 @@ def test_create_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5537,7 +5527,7 @@ def test_create_custom_class_rest_required_fields( jsonified_request["customClassId"] = "custom_class_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5548,7 +5538,7 @@ def test_create_custom_class_rest_required_fields( assert jsonified_request["customClassId"] == "custom_class_id_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5591,7 +5581,7 @@ def test_create_custom_class_rest_required_fields( def test_create_custom_class_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_custom_class._get_unset_required_fields({}) @@ -5610,7 +5600,7 @@ def test_create_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_custom_class_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -5667,7 +5657,7 @@ def test_create_custom_class_rest_bad_request( request_type=cloud_speech_adaptation.CreateCustomClassRequest, ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5689,7 +5679,7 @@ def test_create_custom_class_rest_bad_request( def test_create_custom_class_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5733,7 +5723,7 @@ def test_create_custom_class_rest_flattened(): def test_create_custom_class_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5750,7 +5740,7 @@ def test_create_custom_class_rest_flattened_error(transport: str = "rest"): def test_create_custom_class_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5763,7 +5753,7 @@ def test_create_custom_class_rest_error(): ) def test_get_custom_class_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5816,7 +5806,7 @@ def test_get_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5825,7 +5815,7 @@ def test_get_custom_class_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5834,7 +5824,7 @@ def test_get_custom_class_rest_required_fields( assert jsonified_request["name"] == "name_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5876,7 +5866,7 @@ def test_get_custom_class_rest_required_fields( def test_get_custom_class_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_custom_class._get_unset_required_fields({}) @@ -5886,7 +5876,7 @@ def test_get_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_custom_class_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -5942,7 +5932,7 @@ def test_get_custom_class_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.GetCustomClassRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5964,7 +5954,7 @@ def test_get_custom_class_rest_bad_request( def test_get_custom_class_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6008,7 +5998,7 @@ def test_get_custom_class_rest_flattened(): def test_get_custom_class_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6023,7 +6013,7 @@ def test_get_custom_class_rest_flattened_error(transport: str = "rest"): def test_get_custom_class_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6036,7 +6026,7 @@ def test_get_custom_class_rest_error(): ) def test_list_custom_classes_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6089,7 +6079,7 @@ def test_list_custom_classes_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_custom_classes._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6098,7 +6088,7 @@ def test_list_custom_classes_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_custom_classes._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -6114,7 +6104,7 @@ def test_list_custom_classes_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6158,7 +6148,7 @@ def test_list_custom_classes_rest_required_fields( def test_list_custom_classes_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_custom_classes._get_unset_required_fields({}) @@ -6176,7 +6166,7 @@ def test_list_custom_classes_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_custom_classes_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -6237,7 +6227,7 @@ def test_list_custom_classes_rest_bad_request( request_type=cloud_speech_adaptation.ListCustomClassesRequest, ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6259,7 +6249,7 @@ def test_list_custom_classes_rest_bad_request( def test_list_custom_classes_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6303,7 +6293,7 @@ def test_list_custom_classes_rest_flattened(): def test_list_custom_classes_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6318,7 +6308,7 @@ def test_list_custom_classes_rest_flattened_error(transport: str = "rest"): def test_list_custom_classes_rest_pager(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6389,7 +6379,7 @@ def test_list_custom_classes_rest_pager(transport: str = "rest"): ) def test_update_custom_class_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6519,14 +6509,14 @@ def test_update_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_custom_class._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -6535,7 +6525,7 @@ def test_update_custom_class_rest_required_fields( # verify required fields with non-default values are left alone client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6578,7 +6568,7 @@ def test_update_custom_class_rest_required_fields( def test_update_custom_class_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_custom_class._get_unset_required_fields({}) @@ -6588,7 +6578,7 @@ def test_update_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_custom_class_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -6645,7 +6635,7 @@ def test_update_custom_class_rest_bad_request( request_type=cloud_speech_adaptation.UpdateCustomClassRequest, ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6671,7 +6661,7 @@ def test_update_custom_class_rest_bad_request( def test_update_custom_class_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6718,7 +6708,7 @@ def test_update_custom_class_rest_flattened(): def test_update_custom_class_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6734,7 +6724,7 @@ def test_update_custom_class_rest_flattened_error(transport: str = "rest"): def test_update_custom_class_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6747,7 +6737,7 @@ def test_update_custom_class_rest_error(): ) def test_delete_custom_class_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6793,7 +6783,7 @@ def test_delete_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6802,7 +6792,7 @@ def test_delete_custom_class_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6811,7 +6801,7 @@ def test_delete_custom_class_rest_required_fields( assert jsonified_request["name"] == "name_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6850,7 +6840,7 @@ def test_delete_custom_class_rest_required_fields( def test_delete_custom_class_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_custom_class._get_unset_required_fields({}) @@ -6860,7 +6850,7 @@ def test_delete_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_custom_class_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -6911,7 +6901,7 @@ def test_delete_custom_class_rest_bad_request( request_type=cloud_speech_adaptation.DeleteCustomClassRequest, ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6933,7 +6923,7 @@ def test_delete_custom_class_rest_bad_request( def test_delete_custom_class_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6975,7 +6965,7 @@ def test_delete_custom_class_rest_flattened(): def test_delete_custom_class_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6990,24 +6980,24 @@ def test_delete_custom_class_rest_flattened_error(transport: str = "rest"): def test_delete_custom_class_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AdaptationClient( @@ -7017,7 +7007,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7032,13 +7022,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = AdaptationClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AdaptationClient( @@ -7050,7 +7039,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = AdaptationClient(transport=transport) assert client.transport is transport @@ -7059,13 +7048,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.AdaptationGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7082,7 +7071,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7096,7 +7085,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = AdaptationClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7104,7 +7093,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7116,7 +7105,7 @@ def test_adaptation_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.AdaptationTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7128,7 +7117,7 @@ def test_adaptation_base_transport(): ) as Transport: Transport.return_value = None transport = transports.AdaptationTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7171,7 +7160,7 @@ def test_adaptation_base_transport_with_credentials_file(): "google.cloud.speech_v1.services.adaptation.transports.AdaptationTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AdaptationTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7190,7 +7179,7 @@ def test_adaptation_base_transport_with_adc(): "google.cloud.speech_v1.services.adaptation.transports.AdaptationTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AdaptationTransport() adc.assert_called_once() @@ -7198,7 +7187,7 @@ def test_adaptation_base_transport_with_adc(): def test_adaptation_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) AdaptationClient() adc.assert_called_once_with( scopes=None, @@ -7218,7 +7207,7 @@ def test_adaptation_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7265,7 +7254,7 @@ def test_adaptation_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7290,7 +7279,7 @@ def test_adaptation_transport_create_channel(transport_class, grpc_helpers): [transports.AdaptationGrpcTransport, transports.AdaptationGrpcAsyncIOTransport], ) def test_adaptation_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7328,7 +7317,7 @@ def test_adaptation_grpc_transport_client_cert_source_for_mtls(transport_class): def test_adaptation_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7348,7 +7337,7 @@ def test_adaptation_http_transport_client_cert_source_for_mtls(): ) def test_adaptation_host_no_port(transport_name): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com" ), @@ -7371,7 +7360,7 @@ def test_adaptation_host_no_port(transport_name): ) def test_adaptation_host_with_port(transport_name): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com:8000" ), @@ -7391,8 +7380,8 @@ def test_adaptation_host_with_port(transport_name): ], ) def test_adaptation_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = AdaptationClient( credentials=creds1, transport=transport_name, @@ -7478,7 +7467,7 @@ def test_adaptation_transport_channel_mtls_with_client_cert_source(transport_cla mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -7715,7 +7704,7 @@ def test_client_with_default_client_info(): transports.AdaptationTransport, "_prep_wrapped_messages" ) as prep: client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7725,7 +7714,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AdaptationClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7734,7 +7723,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -7749,7 +7738,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7777,7 +7766,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "sample1"} @@ -7805,7 +7794,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7833,7 +7822,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {} @@ -7859,7 +7848,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7884,7 +7873,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7910,7 +7899,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7939,7 +7928,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7968,7 +7957,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7986,7 +7975,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8004,7 +7993,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8029,7 +8018,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8055,7 +8044,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8084,7 +8073,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8113,7 +8102,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8131,7 +8120,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8155,7 +8144,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8172,7 +8161,7 @@ def test_client_ctx(): ] for transport in transports: client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_speech.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_speech.py index 78adf0c54afc..cdad539d96c8 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_speech.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_speech.py @@ -89,18 +89,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -291,7 +279,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -318,42 +306,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -364,7 +359,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_speech_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -414,7 +409,7 @@ def test_speech_client_service_account_always_use_jwt(transport_class, transport ], ) def test_speech_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -471,9 +466,7 @@ def test_speech_client_get_transport_class(): def test_speech_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(SpeechClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -864,20 +857,20 @@ def test_speech_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -889,13 +882,11 @@ def test_speech_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -911,8 +902,7 @@ def test_speech_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1049,8 +1039,8 @@ def test_speech_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1079,7 +1069,7 @@ def test_speech_client_create_channel_credentials_file( ) def test_recognize(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1109,7 +1099,7 @@ def test_recognize_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1126,7 +1116,7 @@ async def test_recognize_async( transport: str = "grpc_asyncio", request_type=cloud_speech.RecognizeRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1161,7 +1151,7 @@ async def test_recognize_async_from_dict(): def test_recognize_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1193,7 +1183,7 @@ def test_recognize_flattened(): def test_recognize_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1211,7 +1201,7 @@ def test_recognize_flattened_error(): @pytest.mark.asyncio async def test_recognize_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1248,7 +1238,7 @@ async def test_recognize_flattened_async(): @pytest.mark.asyncio async def test_recognize_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1272,7 +1262,7 @@ async def test_recognize_flattened_error_async(): ) def test_long_running_recognize(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1301,7 +1291,7 @@ def test_long_running_recognize_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1321,7 +1311,7 @@ async def test_long_running_recognize_async( request_type=cloud_speech.LongRunningRecognizeRequest, ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1355,7 +1345,7 @@ async def test_long_running_recognize_async_from_dict(): def test_long_running_recognize_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1389,7 +1379,7 @@ def test_long_running_recognize_flattened(): def test_long_running_recognize_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1407,7 +1397,7 @@ def test_long_running_recognize_flattened_error(): @pytest.mark.asyncio async def test_long_running_recognize_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1446,7 +1436,7 @@ async def test_long_running_recognize_flattened_async(): @pytest.mark.asyncio async def test_long_running_recognize_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1470,7 +1460,7 @@ async def test_long_running_recognize_flattened_error_async(): ) def test_streaming_recognize(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1502,7 +1492,7 @@ async def test_streaming_recognize_async( transport: str = "grpc_asyncio", request_type=cloud_speech.StreamingRecognizeRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1546,7 +1536,7 @@ async def test_streaming_recognize_async_from_dict(): ) def test_recognize_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1594,21 +1584,21 @@ def test_recognize_rest_required_fields(request_type=cloud_speech.RecognizeReque # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1651,7 +1641,7 @@ def test_recognize_rest_required_fields(request_type=cloud_speech.RecognizeReque def test_recognize_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.recognize._get_unset_required_fields({}) @@ -1669,7 +1659,7 @@ def test_recognize_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_recognize_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -1723,7 +1713,7 @@ def test_recognize_rest_bad_request( transport: str = "rest", request_type=cloud_speech.RecognizeRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1745,7 +1735,7 @@ def test_recognize_rest_bad_request( def test_recognize_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1788,7 +1778,7 @@ def test_recognize_rest_flattened(): def test_recognize_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1806,7 +1796,7 @@ def test_recognize_rest_flattened_error(transport: str = "rest"): def test_recognize_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -1819,7 +1809,7 @@ def test_recognize_rest_error(): ) def test_long_running_recognize_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1864,21 +1854,21 @@ def test_long_running_recognize_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).long_running_recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).long_running_recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1918,7 +1908,7 @@ def test_long_running_recognize_rest_required_fields( def test_long_running_recognize_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.long_running_recognize._get_unset_required_fields({}) @@ -1936,7 +1926,7 @@ def test_long_running_recognize_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_long_running_recognize_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -1994,7 +1984,7 @@ def test_long_running_recognize_rest_bad_request( transport: str = "rest", request_type=cloud_speech.LongRunningRecognizeRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2016,7 +2006,7 @@ def test_long_running_recognize_rest_bad_request( def test_long_running_recognize_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2057,7 +2047,7 @@ def test_long_running_recognize_rest_flattened(): def test_long_running_recognize_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2075,13 +2065,13 @@ def test_long_running_recognize_rest_flattened_error(transport: str = "rest"): def test_long_running_recognize_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_streaming_recognize_rest_no_http_options(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = cloud_speech.StreamingRecognizeRequest() @@ -2092,7 +2082,7 @@ def test_streaming_recognize_rest_no_http_options(): def test_streaming_recognize_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) # Since a `google.api.http` annotation is required for using a rest transport # method, this should error. @@ -2106,17 +2096,17 @@ def test_streaming_recognize_rest_error(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SpeechClient( @@ -2126,7 +2116,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -2141,13 +2131,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SpeechClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SpeechClient( @@ -2159,7 +2148,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SpeechClient(transport=transport) assert client.transport is transport @@ -2168,13 +2157,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SpeechGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -2191,7 +2180,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -2205,7 +2194,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SpeechClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -2213,7 +2202,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -2225,7 +2214,7 @@ def test_speech_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SpeechTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -2237,7 +2226,7 @@ def test_speech_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SpeechTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -2278,7 +2267,7 @@ def test_speech_base_transport_with_credentials_file(): "google.cloud.speech_v1.services.speech.transports.SpeechTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SpeechTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -2297,7 +2286,7 @@ def test_speech_base_transport_with_adc(): "google.cloud.speech_v1.services.speech.transports.SpeechTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SpeechTransport() adc.assert_called_once() @@ -2305,7 +2294,7 @@ def test_speech_base_transport_with_adc(): def test_speech_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SpeechClient() adc.assert_called_once_with( scopes=None, @@ -2325,7 +2314,7 @@ def test_speech_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2372,7 +2361,7 @@ def test_speech_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2397,7 +2386,7 @@ def test_speech_transport_create_channel(transport_class, grpc_helpers): [transports.SpeechGrpcTransport, transports.SpeechGrpcAsyncIOTransport], ) def test_speech_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2435,7 +2424,7 @@ def test_speech_grpc_transport_client_cert_source_for_mtls(transport_class): def test_speech_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2447,7 +2436,7 @@ def test_speech_http_transport_client_cert_source_for_mtls(): def test_speech_rest_lro_client(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -2472,7 +2461,7 @@ def test_speech_rest_lro_client(): ) def test_speech_host_no_port(transport_name): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com" ), @@ -2495,7 +2484,7 @@ def test_speech_host_no_port(transport_name): ) def test_speech_host_with_port(transport_name): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com:8000" ), @@ -2515,8 +2504,8 @@ def test_speech_host_with_port(transport_name): ], ) def test_speech_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SpeechClient( credentials=creds1, transport=transport_name, @@ -2581,7 +2570,7 @@ def test_speech_transport_channel_mtls_with_client_cert_source(transport_class): mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2656,7 +2645,7 @@ def test_speech_transport_channel_mtls_with_adc(transport_class): def test_speech_grpc_lro_client(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -2673,7 +2662,7 @@ def test_speech_grpc_lro_client(): def test_speech_grpc_lro_async_client(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -2852,7 +2841,7 @@ def test_client_with_default_client_info(): transports.SpeechTransport, "_prep_wrapped_messages" ) as prep: client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2862,7 +2851,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SpeechClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2871,7 +2860,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2886,7 +2875,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2914,7 +2903,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "sample1"} @@ -2942,7 +2931,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2970,7 +2959,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {} @@ -2996,7 +2985,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3021,7 +3010,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3047,7 +3036,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3076,7 +3065,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3105,7 +3094,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -3123,7 +3112,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -3141,7 +3130,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3166,7 +3155,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3192,7 +3181,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3221,7 +3210,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3250,7 +3239,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3268,7 +3257,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3292,7 +3281,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3309,7 +3298,7 @@ def test_client_ctx(): ] for transport in transports: client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py index af1138f77f12..00a903675c09 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py @@ -79,18 +79,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -294,7 +282,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -321,42 +309,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -367,7 +362,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_adaptation_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -419,7 +414,7 @@ def test_adaptation_client_service_account_always_use_jwt( ], ) def test_adaptation_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -482,9 +477,7 @@ def test_adaptation_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(AdaptationClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -877,20 +870,20 @@ def test_adaptation_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -902,13 +895,11 @@ def test_adaptation_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -924,8 +915,7 @@ def test_adaptation_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1066,8 +1056,8 @@ def test_adaptation_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1096,7 +1086,7 @@ def test_adaptation_client_create_channel_credentials_file( ) def test_create_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1130,7 +1120,7 @@ def test_create_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1150,7 +1140,7 @@ async def test_create_phrase_set_async( request_type=cloud_speech_adaptation.CreatePhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1189,7 +1179,7 @@ async def test_create_phrase_set_async_from_dict(): def test_create_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1221,7 +1211,7 @@ def test_create_phrase_set_field_headers(): @pytest.mark.asyncio async def test_create_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1252,7 +1242,7 @@ async def test_create_phrase_set_field_headers_async(): def test_create_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1286,7 +1276,7 @@ def test_create_phrase_set_flattened(): def test_create_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1303,7 +1293,7 @@ def test_create_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_create_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1340,7 +1330,7 @@ async def test_create_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_create_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1363,7 +1353,7 @@ async def test_create_phrase_set_flattened_error_async(): ) def test_get_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1395,7 +1385,7 @@ def test_get_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1413,7 +1403,7 @@ async def test_get_phrase_set_async( request_type=cloud_speech_adaptation.GetPhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1450,7 +1440,7 @@ async def test_get_phrase_set_async_from_dict(): def test_get_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1480,7 +1470,7 @@ def test_get_phrase_set_field_headers(): @pytest.mark.asyncio async def test_get_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1509,7 +1499,7 @@ async def test_get_phrase_set_field_headers_async(): def test_get_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1533,7 +1523,7 @@ def test_get_phrase_set_flattened(): def test_get_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1548,7 +1538,7 @@ def test_get_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_get_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1575,7 +1565,7 @@ async def test_get_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_get_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1596,7 +1586,7 @@ async def test_get_phrase_set_flattened_error_async(): ) def test_list_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1626,7 +1616,7 @@ def test_list_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1644,7 +1634,7 @@ async def test_list_phrase_set_async( request_type=cloud_speech_adaptation.ListPhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1679,7 +1669,7 @@ async def test_list_phrase_set_async_from_dict(): def test_list_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1709,7 +1699,7 @@ def test_list_phrase_set_field_headers(): @pytest.mark.asyncio async def test_list_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1740,7 +1730,7 @@ async def test_list_phrase_set_field_headers_async(): def test_list_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1764,7 +1754,7 @@ def test_list_phrase_set_flattened(): def test_list_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1779,7 +1769,7 @@ def test_list_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_list_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1808,7 +1798,7 @@ async def test_list_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_list_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1822,7 +1812,7 @@ async def test_list_phrase_set_flattened_error_async(): def test_list_phrase_set_pager(transport_name: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1872,7 +1862,7 @@ def test_list_phrase_set_pager(transport_name: str = "grpc"): def test_list_phrase_set_pages(transport_name: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1914,7 +1904,7 @@ def test_list_phrase_set_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_phrase_set_async_pager(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1964,7 +1954,7 @@ async def test_list_phrase_set_async_pager(): @pytest.mark.asyncio async def test_list_phrase_set_async_pages(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2019,7 +2009,7 @@ async def test_list_phrase_set_async_pages(): ) def test_update_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2053,7 +2043,7 @@ def test_update_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2073,7 +2063,7 @@ async def test_update_phrase_set_async( request_type=cloud_speech_adaptation.UpdatePhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2112,7 +2102,7 @@ async def test_update_phrase_set_async_from_dict(): def test_update_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2144,7 +2134,7 @@ def test_update_phrase_set_field_headers(): @pytest.mark.asyncio async def test_update_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2175,7 +2165,7 @@ async def test_update_phrase_set_field_headers_async(): def test_update_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2205,7 +2195,7 @@ def test_update_phrase_set_flattened(): def test_update_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2221,7 +2211,7 @@ def test_update_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_update_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2254,7 +2244,7 @@ async def test_update_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_update_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2276,7 +2266,7 @@ async def test_update_phrase_set_flattened_error_async(): ) def test_delete_phrase_set(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2305,7 +2295,7 @@ def test_delete_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2325,7 +2315,7 @@ async def test_delete_phrase_set_async( request_type=cloud_speech_adaptation.DeletePhraseSetRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2357,7 +2347,7 @@ async def test_delete_phrase_set_async_from_dict(): def test_delete_phrase_set_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2389,7 +2379,7 @@ def test_delete_phrase_set_field_headers(): @pytest.mark.asyncio async def test_delete_phrase_set_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2420,7 +2410,7 @@ async def test_delete_phrase_set_field_headers_async(): def test_delete_phrase_set_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2446,7 +2436,7 @@ def test_delete_phrase_set_flattened(): def test_delete_phrase_set_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2461,7 +2451,7 @@ def test_delete_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_delete_phrase_set_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2490,7 +2480,7 @@ async def test_delete_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_delete_phrase_set_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2511,7 +2501,7 @@ async def test_delete_phrase_set_flattened_error_async(): ) def test_create_custom_class(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2545,7 +2535,7 @@ def test_create_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2565,7 +2555,7 @@ async def test_create_custom_class_async( request_type=cloud_speech_adaptation.CreateCustomClassRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2604,7 +2594,7 @@ async def test_create_custom_class_async_from_dict(): def test_create_custom_class_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2636,7 +2626,7 @@ def test_create_custom_class_field_headers(): @pytest.mark.asyncio async def test_create_custom_class_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2669,7 +2659,7 @@ async def test_create_custom_class_field_headers_async(): def test_create_custom_class_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2703,7 +2693,7 @@ def test_create_custom_class_flattened(): def test_create_custom_class_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2720,7 +2710,7 @@ def test_create_custom_class_flattened_error(): @pytest.mark.asyncio async def test_create_custom_class_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2759,7 +2749,7 @@ async def test_create_custom_class_flattened_async(): @pytest.mark.asyncio async def test_create_custom_class_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2782,7 +2772,7 @@ async def test_create_custom_class_flattened_error_async(): ) def test_get_custom_class(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2814,7 +2804,7 @@ def test_get_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2832,7 +2822,7 @@ async def test_get_custom_class_async( request_type=cloud_speech_adaptation.GetCustomClassRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2869,7 +2859,7 @@ async def test_get_custom_class_async_from_dict(): def test_get_custom_class_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2899,7 +2889,7 @@ def test_get_custom_class_field_headers(): @pytest.mark.asyncio async def test_get_custom_class_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2930,7 +2920,7 @@ async def test_get_custom_class_field_headers_async(): def test_get_custom_class_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2954,7 +2944,7 @@ def test_get_custom_class_flattened(): def test_get_custom_class_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2969,7 +2959,7 @@ def test_get_custom_class_flattened_error(): @pytest.mark.asyncio async def test_get_custom_class_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2998,7 +2988,7 @@ async def test_get_custom_class_flattened_async(): @pytest.mark.asyncio async def test_get_custom_class_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3019,7 +3009,7 @@ async def test_get_custom_class_flattened_error_async(): ) def test_list_custom_classes(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3051,7 +3041,7 @@ def test_list_custom_classes_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3071,7 +3061,7 @@ async def test_list_custom_classes_async( request_type=cloud_speech_adaptation.ListCustomClassesRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3108,7 +3098,7 @@ async def test_list_custom_classes_async_from_dict(): def test_list_custom_classes_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3140,7 +3130,7 @@ def test_list_custom_classes_field_headers(): @pytest.mark.asyncio async def test_list_custom_classes_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3173,7 +3163,7 @@ async def test_list_custom_classes_field_headers_async(): def test_list_custom_classes_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3199,7 +3189,7 @@ def test_list_custom_classes_flattened(): def test_list_custom_classes_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3214,7 +3204,7 @@ def test_list_custom_classes_flattened_error(): @pytest.mark.asyncio async def test_list_custom_classes_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3245,7 +3235,7 @@ async def test_list_custom_classes_flattened_async(): @pytest.mark.asyncio async def test_list_custom_classes_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3259,7 +3249,7 @@ async def test_list_custom_classes_flattened_error_async(): def test_list_custom_classes_pager(transport_name: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3311,7 +3301,7 @@ def test_list_custom_classes_pager(transport_name: str = "grpc"): def test_list_custom_classes_pages(transport_name: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3355,7 +3345,7 @@ def test_list_custom_classes_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_custom_classes_async_pager(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3407,7 +3397,7 @@ async def test_list_custom_classes_async_pager(): @pytest.mark.asyncio async def test_list_custom_classes_async_pages(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3464,7 +3454,7 @@ async def test_list_custom_classes_async_pages(): ) def test_update_custom_class(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3498,7 +3488,7 @@ def test_update_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3518,7 +3508,7 @@ async def test_update_custom_class_async( request_type=cloud_speech_adaptation.UpdateCustomClassRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3557,7 +3547,7 @@ async def test_update_custom_class_async_from_dict(): def test_update_custom_class_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3589,7 +3579,7 @@ def test_update_custom_class_field_headers(): @pytest.mark.asyncio async def test_update_custom_class_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3622,7 +3612,7 @@ async def test_update_custom_class_field_headers_async(): def test_update_custom_class_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3652,7 +3642,7 @@ def test_update_custom_class_flattened(): def test_update_custom_class_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3668,7 +3658,7 @@ def test_update_custom_class_flattened_error(): @pytest.mark.asyncio async def test_update_custom_class_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3703,7 +3693,7 @@ async def test_update_custom_class_flattened_async(): @pytest.mark.asyncio async def test_update_custom_class_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3725,7 +3715,7 @@ async def test_update_custom_class_flattened_error_async(): ) def test_delete_custom_class(request_type, transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3754,7 +3744,7 @@ def test_delete_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3774,7 +3764,7 @@ async def test_delete_custom_class_async( request_type=cloud_speech_adaptation.DeleteCustomClassRequest, ): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3806,7 +3796,7 @@ async def test_delete_custom_class_async_from_dict(): def test_delete_custom_class_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3838,7 +3828,7 @@ def test_delete_custom_class_field_headers(): @pytest.mark.asyncio async def test_delete_custom_class_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3869,7 +3859,7 @@ async def test_delete_custom_class_field_headers_async(): def test_delete_custom_class_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3895,7 +3885,7 @@ def test_delete_custom_class_flattened(): def test_delete_custom_class_flattened_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3910,7 +3900,7 @@ def test_delete_custom_class_flattened_error(): @pytest.mark.asyncio async def test_delete_custom_class_flattened_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3939,7 +3929,7 @@ async def test_delete_custom_class_flattened_async(): @pytest.mark.asyncio async def test_delete_custom_class_flattened_error_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3960,7 +3950,7 @@ async def test_delete_custom_class_flattened_error_async(): ) def test_create_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4014,7 +4004,7 @@ def test_create_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4024,7 +4014,7 @@ def test_create_phrase_set_rest_required_fields( jsonified_request["phraseSetId"] = "phrase_set_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4035,7 +4025,7 @@ def test_create_phrase_set_rest_required_fields( assert jsonified_request["phraseSetId"] == "phrase_set_id_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4078,7 +4068,7 @@ def test_create_phrase_set_rest_required_fields( def test_create_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_phrase_set._get_unset_required_fields({}) @@ -4097,7 +4087,7 @@ def test_create_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -4153,7 +4143,7 @@ def test_create_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.CreatePhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4175,7 +4165,7 @@ def test_create_phrase_set_rest_bad_request( def test_create_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4219,7 +4209,7 @@ def test_create_phrase_set_rest_flattened(): def test_create_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4236,7 +4226,7 @@ def test_create_phrase_set_rest_flattened_error(transport: str = "rest"): def test_create_phrase_set_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4249,7 +4239,7 @@ def test_create_phrase_set_rest_error(): ) def test_get_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4302,7 +4292,7 @@ def test_get_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4311,7 +4301,7 @@ def test_get_phrase_set_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4320,7 +4310,7 @@ def test_get_phrase_set_rest_required_fields( assert jsonified_request["name"] == "name_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4362,7 +4352,7 @@ def test_get_phrase_set_rest_required_fields( def test_get_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_phrase_set._get_unset_required_fields({}) @@ -4372,7 +4362,7 @@ def test_get_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -4428,7 +4418,7 @@ def test_get_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.GetPhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4450,7 +4440,7 @@ def test_get_phrase_set_rest_bad_request( def test_get_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4494,7 +4484,7 @@ def test_get_phrase_set_rest_flattened(): def test_get_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4509,7 +4499,7 @@ def test_get_phrase_set_rest_flattened_error(transport: str = "rest"): def test_get_phrase_set_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4522,7 +4512,7 @@ def test_get_phrase_set_rest_error(): ) def test_list_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4573,7 +4563,7 @@ def test_list_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4582,7 +4572,7 @@ def test_list_phrase_set_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_phrase_set._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4598,7 +4588,7 @@ def test_list_phrase_set_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4642,7 +4632,7 @@ def test_list_phrase_set_rest_required_fields( def test_list_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_phrase_set._get_unset_required_fields({}) @@ -4660,7 +4650,7 @@ def test_list_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -4720,7 +4710,7 @@ def test_list_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.ListPhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4742,7 +4732,7 @@ def test_list_phrase_set_rest_bad_request( def test_list_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4784,7 +4774,7 @@ def test_list_phrase_set_rest_flattened(): def test_list_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4799,7 +4789,7 @@ def test_list_phrase_set_rest_flattened_error(transport: str = "rest"): def test_list_phrase_set_rest_pager(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4869,7 +4859,7 @@ def test_list_phrase_set_rest_pager(transport: str = "rest"): ) def test_update_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4997,14 +4987,14 @@ def test_update_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_phrase_set._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -5013,7 +5003,7 @@ def test_update_phrase_set_rest_required_fields( # verify required fields with non-default values are left alone client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5056,7 +5046,7 @@ def test_update_phrase_set_rest_required_fields( def test_update_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_phrase_set._get_unset_required_fields({}) @@ -5066,7 +5056,7 @@ def test_update_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -5122,7 +5112,7 @@ def test_update_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.UpdatePhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5146,7 +5136,7 @@ def test_update_phrase_set_rest_bad_request( def test_update_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5193,7 +5183,7 @@ def test_update_phrase_set_rest_flattened(): def test_update_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5209,7 +5199,7 @@ def test_update_phrase_set_rest_flattened_error(transport: str = "rest"): def test_update_phrase_set_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5222,7 +5212,7 @@ def test_update_phrase_set_rest_error(): ) def test_delete_phrase_set_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5268,7 +5258,7 @@ def test_delete_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5277,7 +5267,7 @@ def test_delete_phrase_set_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5286,7 +5276,7 @@ def test_delete_phrase_set_rest_required_fields( assert jsonified_request["name"] == "name_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5325,7 +5315,7 @@ def test_delete_phrase_set_rest_required_fields( def test_delete_phrase_set_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_phrase_set._get_unset_required_fields({}) @@ -5335,7 +5325,7 @@ def test_delete_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_phrase_set_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -5385,7 +5375,7 @@ def test_delete_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.DeletePhraseSetRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5407,7 +5397,7 @@ def test_delete_phrase_set_rest_bad_request( def test_delete_phrase_set_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5449,7 +5439,7 @@ def test_delete_phrase_set_rest_flattened(): def test_delete_phrase_set_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5464,7 +5454,7 @@ def test_delete_phrase_set_rest_flattened_error(transport: str = "rest"): def test_delete_phrase_set_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5477,7 +5467,7 @@ def test_delete_phrase_set_rest_error(): ) def test_create_custom_class_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5531,7 +5521,7 @@ def test_create_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5541,7 +5531,7 @@ def test_create_custom_class_rest_required_fields( jsonified_request["customClassId"] = "custom_class_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5552,7 +5542,7 @@ def test_create_custom_class_rest_required_fields( assert jsonified_request["customClassId"] == "custom_class_id_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5595,7 +5585,7 @@ def test_create_custom_class_rest_required_fields( def test_create_custom_class_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_custom_class._get_unset_required_fields({}) @@ -5614,7 +5604,7 @@ def test_create_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_custom_class_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -5671,7 +5661,7 @@ def test_create_custom_class_rest_bad_request( request_type=cloud_speech_adaptation.CreateCustomClassRequest, ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5693,7 +5683,7 @@ def test_create_custom_class_rest_bad_request( def test_create_custom_class_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5737,7 +5727,7 @@ def test_create_custom_class_rest_flattened(): def test_create_custom_class_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5754,7 +5744,7 @@ def test_create_custom_class_rest_flattened_error(transport: str = "rest"): def test_create_custom_class_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5767,7 +5757,7 @@ def test_create_custom_class_rest_error(): ) def test_get_custom_class_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5820,7 +5810,7 @@ def test_get_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5829,7 +5819,7 @@ def test_get_custom_class_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5838,7 +5828,7 @@ def test_get_custom_class_rest_required_fields( assert jsonified_request["name"] == "name_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5880,7 +5870,7 @@ def test_get_custom_class_rest_required_fields( def test_get_custom_class_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_custom_class._get_unset_required_fields({}) @@ -5890,7 +5880,7 @@ def test_get_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_custom_class_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -5946,7 +5936,7 @@ def test_get_custom_class_rest_bad_request( transport: str = "rest", request_type=cloud_speech_adaptation.GetCustomClassRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5968,7 +5958,7 @@ def test_get_custom_class_rest_bad_request( def test_get_custom_class_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6012,7 +6002,7 @@ def test_get_custom_class_rest_flattened(): def test_get_custom_class_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6027,7 +6017,7 @@ def test_get_custom_class_rest_flattened_error(transport: str = "rest"): def test_get_custom_class_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6040,7 +6030,7 @@ def test_get_custom_class_rest_error(): ) def test_list_custom_classes_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6093,7 +6083,7 @@ def test_list_custom_classes_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_custom_classes._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6102,7 +6092,7 @@ def test_list_custom_classes_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_custom_classes._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -6118,7 +6108,7 @@ def test_list_custom_classes_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6162,7 +6152,7 @@ def test_list_custom_classes_rest_required_fields( def test_list_custom_classes_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_custom_classes._get_unset_required_fields({}) @@ -6180,7 +6170,7 @@ def test_list_custom_classes_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_custom_classes_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -6241,7 +6231,7 @@ def test_list_custom_classes_rest_bad_request( request_type=cloud_speech_adaptation.ListCustomClassesRequest, ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6263,7 +6253,7 @@ def test_list_custom_classes_rest_bad_request( def test_list_custom_classes_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6307,7 +6297,7 @@ def test_list_custom_classes_rest_flattened(): def test_list_custom_classes_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6322,7 +6312,7 @@ def test_list_custom_classes_rest_flattened_error(transport: str = "rest"): def test_list_custom_classes_rest_pager(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6393,7 +6383,7 @@ def test_list_custom_classes_rest_pager(transport: str = "rest"): ) def test_update_custom_class_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6523,14 +6513,14 @@ def test_update_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_custom_class._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -6539,7 +6529,7 @@ def test_update_custom_class_rest_required_fields( # verify required fields with non-default values are left alone client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6582,7 +6572,7 @@ def test_update_custom_class_rest_required_fields( def test_update_custom_class_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_custom_class._get_unset_required_fields({}) @@ -6592,7 +6582,7 @@ def test_update_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_custom_class_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -6649,7 +6639,7 @@ def test_update_custom_class_rest_bad_request( request_type=cloud_speech_adaptation.UpdateCustomClassRequest, ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6675,7 +6665,7 @@ def test_update_custom_class_rest_bad_request( def test_update_custom_class_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6722,7 +6712,7 @@ def test_update_custom_class_rest_flattened(): def test_update_custom_class_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6738,7 +6728,7 @@ def test_update_custom_class_rest_flattened_error(transport: str = "rest"): def test_update_custom_class_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6751,7 +6741,7 @@ def test_update_custom_class_rest_error(): ) def test_delete_custom_class_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6797,7 +6787,7 @@ def test_delete_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6806,7 +6796,7 @@ def test_delete_custom_class_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6815,7 +6805,7 @@ def test_delete_custom_class_rest_required_fields( assert jsonified_request["name"] == "name_value" client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6854,7 +6844,7 @@ def test_delete_custom_class_rest_required_fields( def test_delete_custom_class_rest_unset_required_fields(): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_custom_class._get_unset_required_fields({}) @@ -6864,7 +6854,7 @@ def test_delete_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_custom_class_rest_interceptors(null_interceptor): transport = transports.AdaptationRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.AdaptationRestInterceptor(), @@ -6915,7 +6905,7 @@ def test_delete_custom_class_rest_bad_request( request_type=cloud_speech_adaptation.DeleteCustomClassRequest, ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6937,7 +6927,7 @@ def test_delete_custom_class_rest_bad_request( def test_delete_custom_class_rest_flattened(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6979,7 +6969,7 @@ def test_delete_custom_class_rest_flattened(): def test_delete_custom_class_rest_flattened_error(transport: str = "rest"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6994,24 +6984,24 @@ def test_delete_custom_class_rest_flattened_error(transport: str = "rest"): def test_delete_custom_class_rest_error(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AdaptationClient( @@ -7021,7 +7011,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7036,13 +7026,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = AdaptationClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = AdaptationClient( @@ -7054,7 +7043,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = AdaptationClient(transport=transport) assert client.transport is transport @@ -7063,13 +7052,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.AdaptationGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.AdaptationGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -7086,7 +7075,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -7100,7 +7089,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = AdaptationClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -7108,7 +7097,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -7120,7 +7109,7 @@ def test_adaptation_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.AdaptationTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -7132,7 +7121,7 @@ def test_adaptation_base_transport(): ) as Transport: Transport.return_value = None transport = transports.AdaptationTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -7175,7 +7164,7 @@ def test_adaptation_base_transport_with_credentials_file(): "google.cloud.speech_v1p1beta1.services.adaptation.transports.AdaptationTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AdaptationTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -7194,7 +7183,7 @@ def test_adaptation_base_transport_with_adc(): "google.cloud.speech_v1p1beta1.services.adaptation.transports.AdaptationTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AdaptationTransport() adc.assert_called_once() @@ -7202,7 +7191,7 @@ def test_adaptation_base_transport_with_adc(): def test_adaptation_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) AdaptationClient() adc.assert_called_once_with( scopes=None, @@ -7222,7 +7211,7 @@ def test_adaptation_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -7269,7 +7258,7 @@ def test_adaptation_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -7294,7 +7283,7 @@ def test_adaptation_transport_create_channel(transport_class, grpc_helpers): [transports.AdaptationGrpcTransport, transports.AdaptationGrpcAsyncIOTransport], ) def test_adaptation_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -7332,7 +7321,7 @@ def test_adaptation_grpc_transport_client_cert_source_for_mtls(transport_class): def test_adaptation_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -7352,7 +7341,7 @@ def test_adaptation_http_transport_client_cert_source_for_mtls(): ) def test_adaptation_host_no_port(transport_name): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com" ), @@ -7375,7 +7364,7 @@ def test_adaptation_host_no_port(transport_name): ) def test_adaptation_host_with_port(transport_name): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com:8000" ), @@ -7395,8 +7384,8 @@ def test_adaptation_host_with_port(transport_name): ], ) def test_adaptation_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = AdaptationClient( credentials=creds1, transport=transport_name, @@ -7482,7 +7471,7 @@ def test_adaptation_transport_channel_mtls_with_client_cert_source(transport_cla mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -7719,7 +7708,7 @@ def test_client_with_default_client_info(): transports.AdaptationTransport, "_prep_wrapped_messages" ) as prep: client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7729,7 +7718,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AdaptationClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7738,7 +7727,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -7753,7 +7742,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7781,7 +7770,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "sample1"} @@ -7809,7 +7798,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7837,7 +7826,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {} @@ -7863,7 +7852,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7888,7 +7877,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7914,7 +7903,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7943,7 +7932,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7972,7 +7961,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7990,7 +7979,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -8008,7 +7997,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8033,7 +8022,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8059,7 +8048,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8088,7 +8077,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -8117,7 +8106,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8135,7 +8124,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = AdaptationAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -8159,7 +8148,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -8176,7 +8165,7 @@ def test_client_ctx(): ] for transport in transports: client = AdaptationClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_speech.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_speech.py index 2b977f8913b3..89034dda234f 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_speech.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_speech.py @@ -89,18 +89,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -291,7 +279,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -318,42 +306,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -364,7 +359,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_speech_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -414,7 +409,7 @@ def test_speech_client_service_account_always_use_jwt(transport_class, transport ], ) def test_speech_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -471,9 +466,7 @@ def test_speech_client_get_transport_class(): def test_speech_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(SpeechClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -864,20 +857,20 @@ def test_speech_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -889,13 +882,11 @@ def test_speech_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -911,8 +902,7 @@ def test_speech_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1049,8 +1039,8 @@ def test_speech_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1079,7 +1069,7 @@ def test_speech_client_create_channel_credentials_file( ) def test_recognize(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1109,7 +1099,7 @@ def test_recognize_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1126,7 +1116,7 @@ async def test_recognize_async( transport: str = "grpc_asyncio", request_type=cloud_speech.RecognizeRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1161,7 +1151,7 @@ async def test_recognize_async_from_dict(): def test_recognize_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1193,7 +1183,7 @@ def test_recognize_flattened(): def test_recognize_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1211,7 +1201,7 @@ def test_recognize_flattened_error(): @pytest.mark.asyncio async def test_recognize_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1248,7 +1238,7 @@ async def test_recognize_flattened_async(): @pytest.mark.asyncio async def test_recognize_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1272,7 +1262,7 @@ async def test_recognize_flattened_error_async(): ) def test_long_running_recognize(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1301,7 +1291,7 @@ def test_long_running_recognize_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1321,7 +1311,7 @@ async def test_long_running_recognize_async( request_type=cloud_speech.LongRunningRecognizeRequest, ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1355,7 +1345,7 @@ async def test_long_running_recognize_async_from_dict(): def test_long_running_recognize_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1389,7 +1379,7 @@ def test_long_running_recognize_flattened(): def test_long_running_recognize_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1407,7 +1397,7 @@ def test_long_running_recognize_flattened_error(): @pytest.mark.asyncio async def test_long_running_recognize_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1446,7 +1436,7 @@ async def test_long_running_recognize_flattened_async(): @pytest.mark.asyncio async def test_long_running_recognize_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1470,7 +1460,7 @@ async def test_long_running_recognize_flattened_error_async(): ) def test_streaming_recognize(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1502,7 +1492,7 @@ async def test_streaming_recognize_async( transport: str = "grpc_asyncio", request_type=cloud_speech.StreamingRecognizeRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1546,7 +1536,7 @@ async def test_streaming_recognize_async_from_dict(): ) def test_recognize_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1594,21 +1584,21 @@ def test_recognize_rest_required_fields(request_type=cloud_speech.RecognizeReque # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1651,7 +1641,7 @@ def test_recognize_rest_required_fields(request_type=cloud_speech.RecognizeReque def test_recognize_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.recognize._get_unset_required_fields({}) @@ -1669,7 +1659,7 @@ def test_recognize_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_recognize_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -1723,7 +1713,7 @@ def test_recognize_rest_bad_request( transport: str = "rest", request_type=cloud_speech.RecognizeRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1745,7 +1735,7 @@ def test_recognize_rest_bad_request( def test_recognize_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1788,7 +1778,7 @@ def test_recognize_rest_flattened(): def test_recognize_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1806,7 +1796,7 @@ def test_recognize_rest_flattened_error(transport: str = "rest"): def test_recognize_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -1819,7 +1809,7 @@ def test_recognize_rest_error(): ) def test_long_running_recognize_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -1864,21 +1854,21 @@ def test_long_running_recognize_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).long_running_recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).long_running_recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -1918,7 +1908,7 @@ def test_long_running_recognize_rest_required_fields( def test_long_running_recognize_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.long_running_recognize._get_unset_required_fields({}) @@ -1936,7 +1926,7 @@ def test_long_running_recognize_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_long_running_recognize_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -1994,7 +1984,7 @@ def test_long_running_recognize_rest_bad_request( transport: str = "rest", request_type=cloud_speech.LongRunningRecognizeRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2016,7 +2006,7 @@ def test_long_running_recognize_rest_bad_request( def test_long_running_recognize_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -2057,7 +2047,7 @@ def test_long_running_recognize_rest_flattened(): def test_long_running_recognize_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2075,13 +2065,13 @@ def test_long_running_recognize_rest_flattened_error(transport: str = "rest"): def test_long_running_recognize_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_streaming_recognize_rest_no_http_options(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = cloud_speech.StreamingRecognizeRequest() @@ -2092,7 +2082,7 @@ def test_streaming_recognize_rest_no_http_options(): def test_streaming_recognize_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) # Since a `google.api.http` annotation is required for using a rest transport # method, this should error. @@ -2106,17 +2096,17 @@ def test_streaming_recognize_rest_error(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SpeechClient( @@ -2126,7 +2116,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -2141,13 +2131,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SpeechClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SpeechClient( @@ -2159,7 +2148,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SpeechClient(transport=transport) assert client.transport is transport @@ -2168,13 +2157,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SpeechGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -2191,7 +2180,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -2205,7 +2194,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SpeechClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -2213,7 +2202,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -2225,7 +2214,7 @@ def test_speech_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SpeechTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -2237,7 +2226,7 @@ def test_speech_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SpeechTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -2278,7 +2267,7 @@ def test_speech_base_transport_with_credentials_file(): "google.cloud.speech_v1p1beta1.services.speech.transports.SpeechTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SpeechTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -2297,7 +2286,7 @@ def test_speech_base_transport_with_adc(): "google.cloud.speech_v1p1beta1.services.speech.transports.SpeechTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SpeechTransport() adc.assert_called_once() @@ -2305,7 +2294,7 @@ def test_speech_base_transport_with_adc(): def test_speech_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SpeechClient() adc.assert_called_once_with( scopes=None, @@ -2325,7 +2314,7 @@ def test_speech_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -2372,7 +2361,7 @@ def test_speech_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -2397,7 +2386,7 @@ def test_speech_transport_create_channel(transport_class, grpc_helpers): [transports.SpeechGrpcTransport, transports.SpeechGrpcAsyncIOTransport], ) def test_speech_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -2435,7 +2424,7 @@ def test_speech_grpc_transport_client_cert_source_for_mtls(transport_class): def test_speech_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -2447,7 +2436,7 @@ def test_speech_http_transport_client_cert_source_for_mtls(): def test_speech_rest_lro_client(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -2472,7 +2461,7 @@ def test_speech_rest_lro_client(): ) def test_speech_host_no_port(transport_name): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com" ), @@ -2495,7 +2484,7 @@ def test_speech_host_no_port(transport_name): ) def test_speech_host_with_port(transport_name): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com:8000" ), @@ -2515,8 +2504,8 @@ def test_speech_host_with_port(transport_name): ], ) def test_speech_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SpeechClient( credentials=creds1, transport=transport_name, @@ -2581,7 +2570,7 @@ def test_speech_transport_channel_mtls_with_client_cert_source(transport_class): mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -2656,7 +2645,7 @@ def test_speech_transport_channel_mtls_with_adc(transport_class): def test_speech_grpc_lro_client(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -2673,7 +2662,7 @@ def test_speech_grpc_lro_client(): def test_speech_grpc_lro_async_client(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -2852,7 +2841,7 @@ def test_client_with_default_client_info(): transports.SpeechTransport, "_prep_wrapped_messages" ) as prep: client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2862,7 +2851,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SpeechClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2871,7 +2860,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -2886,7 +2875,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2914,7 +2903,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "sample1"} @@ -2942,7 +2931,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2970,7 +2959,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {} @@ -2996,7 +2985,7 @@ def test_list_operations_rest(request_type): def test_get_operation(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3021,7 +3010,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3047,7 +3036,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3076,7 +3065,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3105,7 +3094,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -3123,7 +3112,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -3141,7 +3130,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3166,7 +3155,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3192,7 +3181,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3221,7 +3210,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3250,7 +3239,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3268,7 +3257,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -3292,7 +3281,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -3309,7 +3298,7 @@ def test_client_ctx(): ] for transport in transports: client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py index f19a58af9e32..5c7b19037ac3 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py @@ -91,18 +91,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -293,7 +281,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -320,42 +308,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -366,7 +361,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name ], ) def test_speech_client_from_service_account_info(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -416,7 +411,7 @@ def test_speech_client_service_account_always_use_jwt(transport_class, transport ], ) def test_speech_client_from_service_account_file(client_class, transport_name): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -473,9 +468,7 @@ def test_speech_client_get_transport_class(): def test_speech_client_client_options(client_class, transport_class, transport_name): # Check that if channel is provided we won't create a new one. with mock.patch.object(SpeechClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -866,20 +859,20 @@ def test_speech_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -891,13 +884,11 @@ def test_speech_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -913,8 +904,7 @@ def test_speech_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1051,8 +1041,8 @@ def test_speech_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1081,7 +1071,7 @@ def test_speech_client_create_channel_credentials_file( ) def test_create_recognizer(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1110,7 +1100,7 @@ def test_create_recognizer_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1129,7 +1119,7 @@ async def test_create_recognizer_async( transport: str = "grpc_asyncio", request_type=cloud_speech.CreateRecognizerRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1163,7 +1153,7 @@ async def test_create_recognizer_async_from_dict(): def test_create_recognizer_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1195,7 +1185,7 @@ def test_create_recognizer_field_headers(): @pytest.mark.asyncio async def test_create_recognizer_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1228,7 +1218,7 @@ async def test_create_recognizer_field_headers_async(): def test_create_recognizer_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1262,7 +1252,7 @@ def test_create_recognizer_flattened(): def test_create_recognizer_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1279,7 +1269,7 @@ def test_create_recognizer_flattened_error(): @pytest.mark.asyncio async def test_create_recognizer_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1318,7 +1308,7 @@ async def test_create_recognizer_flattened_async(): @pytest.mark.asyncio async def test_create_recognizer_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1341,7 +1331,7 @@ async def test_create_recognizer_flattened_error_async(): ) def test_list_recognizers(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1371,7 +1361,7 @@ def test_list_recognizers_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1388,7 +1378,7 @@ async def test_list_recognizers_async( transport: str = "grpc_asyncio", request_type=cloud_speech.ListRecognizersRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1423,7 +1413,7 @@ async def test_list_recognizers_async_from_dict(): def test_list_recognizers_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1453,7 +1443,7 @@ def test_list_recognizers_field_headers(): @pytest.mark.asyncio async def test_list_recognizers_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1484,7 +1474,7 @@ async def test_list_recognizers_field_headers_async(): def test_list_recognizers_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1508,7 +1498,7 @@ def test_list_recognizers_flattened(): def test_list_recognizers_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1523,7 +1513,7 @@ def test_list_recognizers_flattened_error(): @pytest.mark.asyncio async def test_list_recognizers_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1552,7 +1542,7 @@ async def test_list_recognizers_flattened_async(): @pytest.mark.asyncio async def test_list_recognizers_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1566,7 +1556,7 @@ async def test_list_recognizers_flattened_error_async(): def test_list_recognizers_pager(transport_name: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1616,7 +1606,7 @@ def test_list_recognizers_pager(transport_name: str = "grpc"): def test_list_recognizers_pages(transport_name: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1658,7 +1648,7 @@ def test_list_recognizers_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_recognizers_async_pager(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1708,7 +1698,7 @@ async def test_list_recognizers_async_pager(): @pytest.mark.asyncio async def test_list_recognizers_async_pages(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1763,7 +1753,7 @@ async def test_list_recognizers_async_pages(): ) def test_get_recognizer(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1811,7 +1801,7 @@ def test_get_recognizer_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1828,7 +1818,7 @@ async def test_get_recognizer_async( transport: str = "grpc_asyncio", request_type=cloud_speech.GetRecognizerRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1881,7 +1871,7 @@ async def test_get_recognizer_async_from_dict(): def test_get_recognizer_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1911,7 +1901,7 @@ def test_get_recognizer_field_headers(): @pytest.mark.asyncio async def test_get_recognizer_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1942,7 +1932,7 @@ async def test_get_recognizer_field_headers_async(): def test_get_recognizer_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1966,7 +1956,7 @@ def test_get_recognizer_flattened(): def test_get_recognizer_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1981,7 +1971,7 @@ def test_get_recognizer_flattened_error(): @pytest.mark.asyncio async def test_get_recognizer_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2010,7 +2000,7 @@ async def test_get_recognizer_flattened_async(): @pytest.mark.asyncio async def test_get_recognizer_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2031,7 +2021,7 @@ async def test_get_recognizer_flattened_error_async(): ) def test_update_recognizer(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2060,7 +2050,7 @@ def test_update_recognizer_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2079,7 +2069,7 @@ async def test_update_recognizer_async( transport: str = "grpc_asyncio", request_type=cloud_speech.UpdateRecognizerRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2113,7 +2103,7 @@ async def test_update_recognizer_async_from_dict(): def test_update_recognizer_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2145,7 +2135,7 @@ def test_update_recognizer_field_headers(): @pytest.mark.asyncio async def test_update_recognizer_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2178,7 +2168,7 @@ async def test_update_recognizer_field_headers_async(): def test_update_recognizer_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2208,7 +2198,7 @@ def test_update_recognizer_flattened(): def test_update_recognizer_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2224,7 +2214,7 @@ def test_update_recognizer_flattened_error(): @pytest.mark.asyncio async def test_update_recognizer_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2259,7 +2249,7 @@ async def test_update_recognizer_flattened_async(): @pytest.mark.asyncio async def test_update_recognizer_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2281,7 +2271,7 @@ async def test_update_recognizer_flattened_error_async(): ) def test_delete_recognizer(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2310,7 +2300,7 @@ def test_delete_recognizer_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2329,7 +2319,7 @@ async def test_delete_recognizer_async( transport: str = "grpc_asyncio", request_type=cloud_speech.DeleteRecognizerRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2363,7 +2353,7 @@ async def test_delete_recognizer_async_from_dict(): def test_delete_recognizer_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2395,7 +2385,7 @@ def test_delete_recognizer_field_headers(): @pytest.mark.asyncio async def test_delete_recognizer_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2428,7 +2418,7 @@ async def test_delete_recognizer_field_headers_async(): def test_delete_recognizer_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2454,7 +2444,7 @@ def test_delete_recognizer_flattened(): def test_delete_recognizer_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2469,7 +2459,7 @@ def test_delete_recognizer_flattened_error(): @pytest.mark.asyncio async def test_delete_recognizer_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2500,7 +2490,7 @@ async def test_delete_recognizer_flattened_async(): @pytest.mark.asyncio async def test_delete_recognizer_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2521,7 +2511,7 @@ async def test_delete_recognizer_flattened_error_async(): ) def test_undelete_recognizer(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2550,7 +2540,7 @@ def test_undelete_recognizer_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2569,7 +2559,7 @@ async def test_undelete_recognizer_async( transport: str = "grpc_asyncio", request_type=cloud_speech.UndeleteRecognizerRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2603,7 +2593,7 @@ async def test_undelete_recognizer_async_from_dict(): def test_undelete_recognizer_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2635,7 +2625,7 @@ def test_undelete_recognizer_field_headers(): @pytest.mark.asyncio async def test_undelete_recognizer_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2668,7 +2658,7 @@ async def test_undelete_recognizer_field_headers_async(): def test_undelete_recognizer_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2694,7 +2684,7 @@ def test_undelete_recognizer_flattened(): def test_undelete_recognizer_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2709,7 +2699,7 @@ def test_undelete_recognizer_flattened_error(): @pytest.mark.asyncio async def test_undelete_recognizer_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2740,7 +2730,7 @@ async def test_undelete_recognizer_flattened_async(): @pytest.mark.asyncio async def test_undelete_recognizer_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2761,7 +2751,7 @@ async def test_undelete_recognizer_flattened_error_async(): ) def test_recognize(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2788,7 +2778,7 @@ def test_recognize_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2805,7 +2795,7 @@ async def test_recognize_async( transport: str = "grpc_asyncio", request_type=cloud_speech.RecognizeRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2837,7 +2827,7 @@ async def test_recognize_async_from_dict(): def test_recognize_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2867,7 +2857,7 @@ def test_recognize_field_headers(): @pytest.mark.asyncio async def test_recognize_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2898,7 +2888,7 @@ async def test_recognize_field_headers_async(): def test_recognize_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2933,7 +2923,7 @@ def test_recognize_flattened(): def test_recognize_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2952,7 +2942,7 @@ def test_recognize_flattened_error(): @pytest.mark.asyncio async def test_recognize_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2992,7 +2982,7 @@ async def test_recognize_flattened_async(): @pytest.mark.asyncio async def test_recognize_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3017,7 +3007,7 @@ async def test_recognize_flattened_error_async(): ) def test_streaming_recognize(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3049,7 +3039,7 @@ async def test_streaming_recognize_async( transport: str = "grpc_asyncio", request_type=cloud_speech.StreamingRecognizeRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3093,7 +3083,7 @@ async def test_streaming_recognize_async_from_dict(): ) def test_batch_recognize(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3120,7 +3110,7 @@ def test_batch_recognize_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3137,7 +3127,7 @@ async def test_batch_recognize_async( transport: str = "grpc_asyncio", request_type=cloud_speech.BatchRecognizeRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3169,7 +3159,7 @@ async def test_batch_recognize_async_from_dict(): def test_batch_recognize_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3199,7 +3189,7 @@ def test_batch_recognize_field_headers(): @pytest.mark.asyncio async def test_batch_recognize_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3230,7 +3220,7 @@ async def test_batch_recognize_field_headers_async(): def test_batch_recognize_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3266,7 +3256,7 @@ def test_batch_recognize_flattened(): def test_batch_recognize_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3284,7 +3274,7 @@ def test_batch_recognize_flattened_error(): @pytest.mark.asyncio async def test_batch_recognize_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3325,7 +3315,7 @@ async def test_batch_recognize_flattened_async(): @pytest.mark.asyncio async def test_batch_recognize_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3349,7 +3339,7 @@ async def test_batch_recognize_flattened_error_async(): ) def test_get_config(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3381,7 +3371,7 @@ def test_get_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3398,7 +3388,7 @@ async def test_get_config_async( transport: str = "grpc_asyncio", request_type=cloud_speech.GetConfigRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3435,7 +3425,7 @@ async def test_get_config_async_from_dict(): def test_get_config_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3465,7 +3455,7 @@ def test_get_config_field_headers(): @pytest.mark.asyncio async def test_get_config_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3494,7 +3484,7 @@ async def test_get_config_field_headers_async(): def test_get_config_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3518,7 +3508,7 @@ def test_get_config_flattened(): def test_get_config_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3533,7 +3523,7 @@ def test_get_config_flattened_error(): @pytest.mark.asyncio async def test_get_config_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3560,7 +3550,7 @@ async def test_get_config_flattened_async(): @pytest.mark.asyncio async def test_get_config_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3581,7 +3571,7 @@ async def test_get_config_flattened_error_async(): ) def test_update_config(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3613,7 +3603,7 @@ def test_update_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3630,7 +3620,7 @@ async def test_update_config_async( transport: str = "grpc_asyncio", request_type=cloud_speech.UpdateConfigRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3667,7 +3657,7 @@ async def test_update_config_async_from_dict(): def test_update_config_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3697,7 +3687,7 @@ def test_update_config_field_headers(): @pytest.mark.asyncio async def test_update_config_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3726,7 +3716,7 @@ async def test_update_config_field_headers_async(): def test_update_config_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3754,7 +3744,7 @@ def test_update_config_flattened(): def test_update_config_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3770,7 +3760,7 @@ def test_update_config_flattened_error(): @pytest.mark.asyncio async def test_update_config_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3801,7 +3791,7 @@ async def test_update_config_flattened_async(): @pytest.mark.asyncio async def test_update_config_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3823,7 +3813,7 @@ async def test_update_config_flattened_error_async(): ) def test_create_custom_class(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3852,7 +3842,7 @@ def test_create_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3871,7 +3861,7 @@ async def test_create_custom_class_async( transport: str = "grpc_asyncio", request_type=cloud_speech.CreateCustomClassRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3905,7 +3895,7 @@ async def test_create_custom_class_async_from_dict(): def test_create_custom_class_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3937,7 +3927,7 @@ def test_create_custom_class_field_headers(): @pytest.mark.asyncio async def test_create_custom_class_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3970,7 +3960,7 @@ async def test_create_custom_class_field_headers_async(): def test_create_custom_class_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4004,7 +3994,7 @@ def test_create_custom_class_flattened(): def test_create_custom_class_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4021,7 +4011,7 @@ def test_create_custom_class_flattened_error(): @pytest.mark.asyncio async def test_create_custom_class_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4060,7 +4050,7 @@ async def test_create_custom_class_flattened_async(): @pytest.mark.asyncio async def test_create_custom_class_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4083,7 +4073,7 @@ async def test_create_custom_class_flattened_error_async(): ) def test_list_custom_classes(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4115,7 +4105,7 @@ def test_list_custom_classes_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4134,7 +4124,7 @@ async def test_list_custom_classes_async( transport: str = "grpc_asyncio", request_type=cloud_speech.ListCustomClassesRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4171,7 +4161,7 @@ async def test_list_custom_classes_async_from_dict(): def test_list_custom_classes_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4203,7 +4193,7 @@ def test_list_custom_classes_field_headers(): @pytest.mark.asyncio async def test_list_custom_classes_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4236,7 +4226,7 @@ async def test_list_custom_classes_field_headers_async(): def test_list_custom_classes_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4262,7 +4252,7 @@ def test_list_custom_classes_flattened(): def test_list_custom_classes_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4277,7 +4267,7 @@ def test_list_custom_classes_flattened_error(): @pytest.mark.asyncio async def test_list_custom_classes_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4308,7 +4298,7 @@ async def test_list_custom_classes_flattened_async(): @pytest.mark.asyncio async def test_list_custom_classes_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4322,7 +4312,7 @@ async def test_list_custom_classes_flattened_error_async(): def test_list_custom_classes_pager(transport_name: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4374,7 +4364,7 @@ def test_list_custom_classes_pager(transport_name: str = "grpc"): def test_list_custom_classes_pages(transport_name: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -4418,7 +4408,7 @@ def test_list_custom_classes_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_custom_classes_async_pager(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4470,7 +4460,7 @@ async def test_list_custom_classes_async_pager(): @pytest.mark.asyncio async def test_list_custom_classes_async_pages(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4527,7 +4517,7 @@ async def test_list_custom_classes_async_pages(): ) def test_get_custom_class(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4571,7 +4561,7 @@ def test_get_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4588,7 +4578,7 @@ async def test_get_custom_class_async( transport: str = "grpc_asyncio", request_type=cloud_speech.GetCustomClassRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4637,7 +4627,7 @@ async def test_get_custom_class_async_from_dict(): def test_get_custom_class_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4667,7 +4657,7 @@ def test_get_custom_class_field_headers(): @pytest.mark.asyncio async def test_get_custom_class_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4698,7 +4688,7 @@ async def test_get_custom_class_field_headers_async(): def test_get_custom_class_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4722,7 +4712,7 @@ def test_get_custom_class_flattened(): def test_get_custom_class_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4737,7 +4727,7 @@ def test_get_custom_class_flattened_error(): @pytest.mark.asyncio async def test_get_custom_class_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4766,7 +4756,7 @@ async def test_get_custom_class_flattened_async(): @pytest.mark.asyncio async def test_get_custom_class_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4787,7 +4777,7 @@ async def test_get_custom_class_flattened_error_async(): ) def test_update_custom_class(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4816,7 +4806,7 @@ def test_update_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -4835,7 +4825,7 @@ async def test_update_custom_class_async( transport: str = "grpc_asyncio", request_type=cloud_speech.UpdateCustomClassRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4869,7 +4859,7 @@ async def test_update_custom_class_async_from_dict(): def test_update_custom_class_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4901,7 +4891,7 @@ def test_update_custom_class_field_headers(): @pytest.mark.asyncio async def test_update_custom_class_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4934,7 +4924,7 @@ async def test_update_custom_class_field_headers_async(): def test_update_custom_class_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4964,7 +4954,7 @@ def test_update_custom_class_flattened(): def test_update_custom_class_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4980,7 +4970,7 @@ def test_update_custom_class_flattened_error(): @pytest.mark.asyncio async def test_update_custom_class_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5015,7 +5005,7 @@ async def test_update_custom_class_flattened_async(): @pytest.mark.asyncio async def test_update_custom_class_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5037,7 +5027,7 @@ async def test_update_custom_class_flattened_error_async(): ) def test_delete_custom_class(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5066,7 +5056,7 @@ def test_delete_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5085,7 +5075,7 @@ async def test_delete_custom_class_async( transport: str = "grpc_asyncio", request_type=cloud_speech.DeleteCustomClassRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5119,7 +5109,7 @@ async def test_delete_custom_class_async_from_dict(): def test_delete_custom_class_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5151,7 +5141,7 @@ def test_delete_custom_class_field_headers(): @pytest.mark.asyncio async def test_delete_custom_class_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5184,7 +5174,7 @@ async def test_delete_custom_class_field_headers_async(): def test_delete_custom_class_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5210,7 +5200,7 @@ def test_delete_custom_class_flattened(): def test_delete_custom_class_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5225,7 +5215,7 @@ def test_delete_custom_class_flattened_error(): @pytest.mark.asyncio async def test_delete_custom_class_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5256,7 +5246,7 @@ async def test_delete_custom_class_flattened_async(): @pytest.mark.asyncio async def test_delete_custom_class_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5277,7 +5267,7 @@ async def test_delete_custom_class_flattened_error_async(): ) def test_undelete_custom_class(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5306,7 +5296,7 @@ def test_undelete_custom_class_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5326,7 +5316,7 @@ async def test_undelete_custom_class_async( request_type=cloud_speech.UndeleteCustomClassRequest, ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5360,7 +5350,7 @@ async def test_undelete_custom_class_async_from_dict(): def test_undelete_custom_class_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5392,7 +5382,7 @@ def test_undelete_custom_class_field_headers(): @pytest.mark.asyncio async def test_undelete_custom_class_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5425,7 +5415,7 @@ async def test_undelete_custom_class_field_headers_async(): def test_undelete_custom_class_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5451,7 +5441,7 @@ def test_undelete_custom_class_flattened(): def test_undelete_custom_class_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5466,7 +5456,7 @@ def test_undelete_custom_class_flattened_error(): @pytest.mark.asyncio async def test_undelete_custom_class_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5497,7 +5487,7 @@ async def test_undelete_custom_class_flattened_async(): @pytest.mark.asyncio async def test_undelete_custom_class_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5518,7 +5508,7 @@ async def test_undelete_custom_class_flattened_error_async(): ) def test_create_phrase_set(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5547,7 +5537,7 @@ def test_create_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5566,7 +5556,7 @@ async def test_create_phrase_set_async( transport: str = "grpc_asyncio", request_type=cloud_speech.CreatePhraseSetRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5600,7 +5590,7 @@ async def test_create_phrase_set_async_from_dict(): def test_create_phrase_set_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5632,7 +5622,7 @@ def test_create_phrase_set_field_headers(): @pytest.mark.asyncio async def test_create_phrase_set_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5665,7 +5655,7 @@ async def test_create_phrase_set_field_headers_async(): def test_create_phrase_set_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5699,7 +5689,7 @@ def test_create_phrase_set_flattened(): def test_create_phrase_set_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5716,7 +5706,7 @@ def test_create_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_create_phrase_set_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5755,7 +5745,7 @@ async def test_create_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_create_phrase_set_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5778,7 +5768,7 @@ async def test_create_phrase_set_flattened_error_async(): ) def test_list_phrase_sets(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5808,7 +5798,7 @@ def test_list_phrase_sets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -5825,7 +5815,7 @@ async def test_list_phrase_sets_async( transport: str = "grpc_asyncio", request_type=cloud_speech.ListPhraseSetsRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5860,7 +5850,7 @@ async def test_list_phrase_sets_async_from_dict(): def test_list_phrase_sets_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5890,7 +5880,7 @@ def test_list_phrase_sets_field_headers(): @pytest.mark.asyncio async def test_list_phrase_sets_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -5921,7 +5911,7 @@ async def test_list_phrase_sets_field_headers_async(): def test_list_phrase_sets_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5945,7 +5935,7 @@ def test_list_phrase_sets_flattened(): def test_list_phrase_sets_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -5960,7 +5950,7 @@ def test_list_phrase_sets_flattened_error(): @pytest.mark.asyncio async def test_list_phrase_sets_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5989,7 +5979,7 @@ async def test_list_phrase_sets_flattened_async(): @pytest.mark.asyncio async def test_list_phrase_sets_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6003,7 +5993,7 @@ async def test_list_phrase_sets_flattened_error_async(): def test_list_phrase_sets_pager(transport_name: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -6053,7 +6043,7 @@ def test_list_phrase_sets_pager(transport_name: str = "grpc"): def test_list_phrase_sets_pages(transport_name: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -6095,7 +6085,7 @@ def test_list_phrase_sets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_phrase_sets_async_pager(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6145,7 +6135,7 @@ async def test_list_phrase_sets_async_pager(): @pytest.mark.asyncio async def test_list_phrase_sets_async_pages(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6200,7 +6190,7 @@ async def test_list_phrase_sets_async_pages(): ) def test_get_phrase_set(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6246,7 +6236,7 @@ def test_get_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6263,7 +6253,7 @@ async def test_get_phrase_set_async( transport: str = "grpc_asyncio", request_type=cloud_speech.GetPhraseSetRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6314,7 +6304,7 @@ async def test_get_phrase_set_async_from_dict(): def test_get_phrase_set_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6344,7 +6334,7 @@ def test_get_phrase_set_field_headers(): @pytest.mark.asyncio async def test_get_phrase_set_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6375,7 +6365,7 @@ async def test_get_phrase_set_field_headers_async(): def test_get_phrase_set_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6399,7 +6389,7 @@ def test_get_phrase_set_flattened(): def test_get_phrase_set_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6414,7 +6404,7 @@ def test_get_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_get_phrase_set_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6443,7 +6433,7 @@ async def test_get_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_get_phrase_set_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6464,7 +6454,7 @@ async def test_get_phrase_set_flattened_error_async(): ) def test_update_phrase_set(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6493,7 +6483,7 @@ def test_update_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6512,7 +6502,7 @@ async def test_update_phrase_set_async( transport: str = "grpc_asyncio", request_type=cloud_speech.UpdatePhraseSetRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6546,7 +6536,7 @@ async def test_update_phrase_set_async_from_dict(): def test_update_phrase_set_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6578,7 +6568,7 @@ def test_update_phrase_set_field_headers(): @pytest.mark.asyncio async def test_update_phrase_set_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6611,7 +6601,7 @@ async def test_update_phrase_set_field_headers_async(): def test_update_phrase_set_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6641,7 +6631,7 @@ def test_update_phrase_set_flattened(): def test_update_phrase_set_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6657,7 +6647,7 @@ def test_update_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_update_phrase_set_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6692,7 +6682,7 @@ async def test_update_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_update_phrase_set_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6714,7 +6704,7 @@ async def test_update_phrase_set_flattened_error_async(): ) def test_delete_phrase_set(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6743,7 +6733,7 @@ def test_delete_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -6762,7 +6752,7 @@ async def test_delete_phrase_set_async( transport: str = "grpc_asyncio", request_type=cloud_speech.DeletePhraseSetRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6796,7 +6786,7 @@ async def test_delete_phrase_set_async_from_dict(): def test_delete_phrase_set_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6828,7 +6818,7 @@ def test_delete_phrase_set_field_headers(): @pytest.mark.asyncio async def test_delete_phrase_set_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6861,7 +6851,7 @@ async def test_delete_phrase_set_field_headers_async(): def test_delete_phrase_set_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6887,7 +6877,7 @@ def test_delete_phrase_set_flattened(): def test_delete_phrase_set_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6902,7 +6892,7 @@ def test_delete_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_delete_phrase_set_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6933,7 +6923,7 @@ async def test_delete_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_delete_phrase_set_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -6954,7 +6944,7 @@ async def test_delete_phrase_set_flattened_error_async(): ) def test_undelete_phrase_set(request_type, transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6983,7 +6973,7 @@ def test_undelete_phrase_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -7002,7 +6992,7 @@ async def test_undelete_phrase_set_async( transport: str = "grpc_asyncio", request_type=cloud_speech.UndeletePhraseSetRequest ): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7036,7 +7026,7 @@ async def test_undelete_phrase_set_async_from_dict(): def test_undelete_phrase_set_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7068,7 +7058,7 @@ def test_undelete_phrase_set_field_headers(): @pytest.mark.asyncio async def test_undelete_phrase_set_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7101,7 +7091,7 @@ async def test_undelete_phrase_set_field_headers_async(): def test_undelete_phrase_set_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7127,7 +7117,7 @@ def test_undelete_phrase_set_flattened(): def test_undelete_phrase_set_flattened_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7142,7 +7132,7 @@ def test_undelete_phrase_set_flattened_error(): @pytest.mark.asyncio async def test_undelete_phrase_set_flattened_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -7173,7 +7163,7 @@ async def test_undelete_phrase_set_flattened_async(): @pytest.mark.asyncio async def test_undelete_phrase_set_flattened_error_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -7194,7 +7184,7 @@ async def test_undelete_phrase_set_flattened_error_async(): ) def test_create_recognizer_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7399,7 +7389,7 @@ def test_create_recognizer_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_recognizer._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7408,7 +7398,7 @@ def test_create_recognizer_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_recognizer._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -7424,7 +7414,7 @@ def test_create_recognizer_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7464,7 +7454,7 @@ def test_create_recognizer_rest_required_fields( def test_create_recognizer_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_recognizer._get_unset_required_fields({}) @@ -7487,7 +7477,7 @@ def test_create_recognizer_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_recognizer_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -7545,7 +7535,7 @@ def test_create_recognizer_rest_bad_request( transport: str = "rest", request_type=cloud_speech.CreateRecognizerRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7567,7 +7557,7 @@ def test_create_recognizer_rest_bad_request( def test_create_recognizer_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7609,7 +7599,7 @@ def test_create_recognizer_rest_flattened(): def test_create_recognizer_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7626,7 +7616,7 @@ def test_create_recognizer_rest_flattened_error(transport: str = "rest"): def test_create_recognizer_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7639,7 +7629,7 @@ def test_create_recognizer_rest_error(): ) def test_list_recognizers_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7690,7 +7680,7 @@ def test_list_recognizers_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_recognizers._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7699,7 +7689,7 @@ def test_list_recognizers_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_recognizers._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -7716,7 +7706,7 @@ def test_list_recognizers_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7758,7 +7748,7 @@ def test_list_recognizers_rest_required_fields( def test_list_recognizers_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_recognizers._get_unset_required_fields({}) @@ -7777,7 +7767,7 @@ def test_list_recognizers_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_recognizers_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -7833,7 +7823,7 @@ def test_list_recognizers_rest_bad_request( transport: str = "rest", request_type=cloud_speech.ListRecognizersRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7855,7 +7845,7 @@ def test_list_recognizers_rest_bad_request( def test_list_recognizers_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7897,7 +7887,7 @@ def test_list_recognizers_rest_flattened(): def test_list_recognizers_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7912,7 +7902,7 @@ def test_list_recognizers_rest_flattened_error(transport: str = "rest"): def test_list_recognizers_rest_pager(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7982,7 +7972,7 @@ def test_list_recognizers_rest_pager(transport: str = "rest"): ) def test_get_recognizer_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8051,7 +8041,7 @@ def test_get_recognizer_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_recognizer._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8060,7 +8050,7 @@ def test_get_recognizer_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_recognizer._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8069,7 +8059,7 @@ def test_get_recognizer_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8111,7 +8101,7 @@ def test_get_recognizer_rest_required_fields( def test_get_recognizer_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_recognizer._get_unset_required_fields({}) @@ -8121,7 +8111,7 @@ def test_get_recognizer_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_recognizer_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -8177,7 +8167,7 @@ def test_get_recognizer_rest_bad_request( transport: str = "rest", request_type=cloud_speech.GetRecognizerRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8199,7 +8189,7 @@ def test_get_recognizer_rest_bad_request( def test_get_recognizer_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8243,7 +8233,7 @@ def test_get_recognizer_rest_flattened(): def test_get_recognizer_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8258,7 +8248,7 @@ def test_get_recognizer_rest_flattened_error(transport: str = "rest"): def test_get_recognizer_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8271,7 +8261,7 @@ def test_get_recognizer_rest_error(): ) def test_update_recognizer_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8477,14 +8467,14 @@ def test_update_recognizer_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_recognizer._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_recognizer._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -8498,7 +8488,7 @@ def test_update_recognizer_rest_required_fields( # verify required fields with non-default values are left alone client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8538,7 +8528,7 @@ def test_update_recognizer_rest_required_fields( def test_update_recognizer_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_recognizer._get_unset_required_fields({}) @@ -8556,7 +8546,7 @@ def test_update_recognizer_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_recognizer_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -8614,7 +8604,7 @@ def test_update_recognizer_rest_bad_request( transport: str = "rest", request_type=cloud_speech.UpdateRecognizerRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8638,7 +8628,7 @@ def test_update_recognizer_rest_bad_request( def test_update_recognizer_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8683,7 +8673,7 @@ def test_update_recognizer_rest_flattened(): def test_update_recognizer_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8699,7 +8689,7 @@ def test_update_recognizer_rest_flattened_error(transport: str = "rest"): def test_update_recognizer_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8712,7 +8702,7 @@ def test_update_recognizer_rest_error(): ) def test_delete_recognizer_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8758,7 +8748,7 @@ def test_delete_recognizer_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_recognizer._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -8767,7 +8757,7 @@ def test_delete_recognizer_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_recognizer._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -8784,7 +8774,7 @@ def test_delete_recognizer_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -8823,7 +8813,7 @@ def test_delete_recognizer_rest_required_fields( def test_delete_recognizer_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_recognizer._get_unset_required_fields({}) @@ -8842,7 +8832,7 @@ def test_delete_recognizer_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_recognizer_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -8900,7 +8890,7 @@ def test_delete_recognizer_rest_bad_request( transport: str = "rest", request_type=cloud_speech.DeleteRecognizerRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8922,7 +8912,7 @@ def test_delete_recognizer_rest_bad_request( def test_delete_recognizer_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -8964,7 +8954,7 @@ def test_delete_recognizer_rest_flattened(): def test_delete_recognizer_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8979,7 +8969,7 @@ def test_delete_recognizer_rest_flattened_error(transport: str = "rest"): def test_delete_recognizer_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -8992,7 +8982,7 @@ def test_delete_recognizer_rest_error(): ) def test_undelete_recognizer_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9038,7 +9028,7 @@ def test_undelete_recognizer_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_recognizer._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9047,7 +9037,7 @@ def test_undelete_recognizer_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_recognizer._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9056,7 +9046,7 @@ def test_undelete_recognizer_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9096,7 +9086,7 @@ def test_undelete_recognizer_rest_required_fields( def test_undelete_recognizer_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.undelete_recognizer._get_unset_required_fields({}) @@ -9106,7 +9096,7 @@ def test_undelete_recognizer_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_undelete_recognizer_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -9164,7 +9154,7 @@ def test_undelete_recognizer_rest_bad_request( transport: str = "rest", request_type=cloud_speech.UndeleteRecognizerRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9186,7 +9176,7 @@ def test_undelete_recognizer_rest_bad_request( def test_undelete_recognizer_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9228,7 +9218,7 @@ def test_undelete_recognizer_rest_flattened(): def test_undelete_recognizer_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9243,7 +9233,7 @@ def test_undelete_recognizer_rest_flattened_error(transport: str = "rest"): def test_undelete_recognizer_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9256,7 +9246,7 @@ def test_undelete_recognizer_rest_error(): ) def test_recognize_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9304,7 +9294,7 @@ def test_recognize_rest_required_fields(request_type=cloud_speech.RecognizeReque # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9313,7 +9303,7 @@ def test_recognize_rest_required_fields(request_type=cloud_speech.RecognizeReque jsonified_request["recognizer"] = "recognizer_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9322,7 +9312,7 @@ def test_recognize_rest_required_fields(request_type=cloud_speech.RecognizeReque assert jsonified_request["recognizer"] == "recognizer_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9365,7 +9355,7 @@ def test_recognize_rest_required_fields(request_type=cloud_speech.RecognizeReque def test_recognize_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.recognize._get_unset_required_fields({}) @@ -9375,7 +9365,7 @@ def test_recognize_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_recognize_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -9429,7 +9419,7 @@ def test_recognize_rest_bad_request( transport: str = "rest", request_type=cloud_speech.RecognizeRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9453,7 +9443,7 @@ def test_recognize_rest_bad_request( def test_recognize_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9499,7 +9489,7 @@ def test_recognize_rest_flattened(): def test_recognize_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9518,13 +9508,13 @@ def test_recognize_rest_flattened_error(transport: str = "rest"): def test_recognize_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_streaming_recognize_rest_no_http_options(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = cloud_speech.StreamingRecognizeRequest() @@ -9542,7 +9532,7 @@ def test_streaming_recognize_rest_no_http_options(): ) def test_batch_recognize_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9590,7 +9580,7 @@ def test_batch_recognize_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).batch_recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9599,7 +9589,7 @@ def test_batch_recognize_rest_required_fields( jsonified_request["recognizer"] = "recognizer_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).batch_recognize._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9608,7 +9598,7 @@ def test_batch_recognize_rest_required_fields( assert jsonified_request["recognizer"] == "recognizer_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9648,7 +9638,7 @@ def test_batch_recognize_rest_required_fields( def test_batch_recognize_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.batch_recognize._get_unset_required_fields({}) @@ -9658,7 +9648,7 @@ def test_batch_recognize_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_batch_recognize_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -9716,7 +9706,7 @@ def test_batch_recognize_rest_bad_request( transport: str = "rest", request_type=cloud_speech.BatchRecognizeRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9740,7 +9730,7 @@ def test_batch_recognize_rest_bad_request( def test_batch_recognize_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9785,7 +9775,7 @@ def test_batch_recognize_rest_flattened(): def test_batch_recognize_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9803,7 +9793,7 @@ def test_batch_recognize_rest_flattened_error(transport: str = "rest"): def test_batch_recognize_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -9816,7 +9806,7 @@ def test_batch_recognize_rest_error(): ) def test_get_config_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -9867,7 +9857,7 @@ def test_get_config_rest_required_fields(request_type=cloud_speech.GetConfigRequ # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9876,7 +9866,7 @@ def test_get_config_rest_required_fields(request_type=cloud_speech.GetConfigRequ jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -9885,7 +9875,7 @@ def test_get_config_rest_required_fields(request_type=cloud_speech.GetConfigRequ assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -9927,7 +9917,7 @@ def test_get_config_rest_required_fields(request_type=cloud_speech.GetConfigRequ def test_get_config_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_config._get_unset_required_fields({}) @@ -9937,7 +9927,7 @@ def test_get_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_config_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -9989,7 +9979,7 @@ def test_get_config_rest_bad_request( transport: str = "rest", request_type=cloud_speech.GetConfigRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10011,7 +10001,7 @@ def test_get_config_rest_bad_request( def test_get_config_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10052,7 +10042,7 @@ def test_get_config_rest_flattened(): def test_get_config_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10067,7 +10057,7 @@ def test_get_config_rest_flattened_error(transport: str = "rest"): def test_get_config_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10080,7 +10070,7 @@ def test_get_config_rest_error(): ) def test_update_config_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10204,14 +10194,14 @@ def test_update_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -10220,7 +10210,7 @@ def test_update_config_rest_required_fields( # verify required fields with non-default values are left alone client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10263,7 +10253,7 @@ def test_update_config_rest_required_fields( def test_update_config_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_config._get_unset_required_fields({}) @@ -10273,7 +10263,7 @@ def test_update_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_config_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -10327,7 +10317,7 @@ def test_update_config_rest_bad_request( transport: str = "rest", request_type=cloud_speech.UpdateConfigRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10349,7 +10339,7 @@ def test_update_config_rest_bad_request( def test_update_config_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10394,7 +10384,7 @@ def test_update_config_rest_flattened(): def test_update_config_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10410,7 +10400,7 @@ def test_update_config_rest_flattened_error(transport: str = "rest"): def test_update_config_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10423,7 +10413,7 @@ def test_update_config_rest_error(): ) def test_create_custom_class_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10552,7 +10542,7 @@ def test_create_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10561,7 +10551,7 @@ def test_create_custom_class_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_custom_class._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -10577,7 +10567,7 @@ def test_create_custom_class_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10617,7 +10607,7 @@ def test_create_custom_class_rest_required_fields( def test_create_custom_class_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_custom_class._get_unset_required_fields({}) @@ -10640,7 +10630,7 @@ def test_create_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_custom_class_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -10698,7 +10688,7 @@ def test_create_custom_class_rest_bad_request( transport: str = "rest", request_type=cloud_speech.CreateCustomClassRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10720,7 +10710,7 @@ def test_create_custom_class_rest_bad_request( def test_create_custom_class_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10762,7 +10752,7 @@ def test_create_custom_class_rest_flattened(): def test_create_custom_class_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10779,7 +10769,7 @@ def test_create_custom_class_rest_flattened_error(transport: str = "rest"): def test_create_custom_class_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -10792,7 +10782,7 @@ def test_create_custom_class_rest_error(): ) def test_list_custom_classes_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -10843,7 +10833,7 @@ def test_list_custom_classes_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_custom_classes._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -10852,7 +10842,7 @@ def test_list_custom_classes_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_custom_classes._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -10869,7 +10859,7 @@ def test_list_custom_classes_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -10911,7 +10901,7 @@ def test_list_custom_classes_rest_required_fields( def test_list_custom_classes_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_custom_classes._get_unset_required_fields({}) @@ -10930,7 +10920,7 @@ def test_list_custom_classes_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_custom_classes_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -10986,7 +10976,7 @@ def test_list_custom_classes_rest_bad_request( transport: str = "rest", request_type=cloud_speech.ListCustomClassesRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11008,7 +10998,7 @@ def test_list_custom_classes_rest_bad_request( def test_list_custom_classes_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11050,7 +11040,7 @@ def test_list_custom_classes_rest_flattened(): def test_list_custom_classes_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11065,7 +11055,7 @@ def test_list_custom_classes_rest_flattened_error(transport: str = "rest"): def test_list_custom_classes_rest_pager(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11135,7 +11125,7 @@ def test_list_custom_classes_rest_pager(transport: str = "rest"): ) def test_get_custom_class_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11200,7 +11190,7 @@ def test_get_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11209,7 +11199,7 @@ def test_get_custom_class_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11218,7 +11208,7 @@ def test_get_custom_class_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11260,7 +11250,7 @@ def test_get_custom_class_rest_required_fields( def test_get_custom_class_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_custom_class._get_unset_required_fields({}) @@ -11270,7 +11260,7 @@ def test_get_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_custom_class_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -11326,7 +11316,7 @@ def test_get_custom_class_rest_bad_request( transport: str = "rest", request_type=cloud_speech.GetCustomClassRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11348,7 +11338,7 @@ def test_get_custom_class_rest_bad_request( def test_get_custom_class_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11392,7 +11382,7 @@ def test_get_custom_class_rest_flattened(): def test_get_custom_class_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11407,7 +11397,7 @@ def test_get_custom_class_rest_flattened_error(transport: str = "rest"): def test_get_custom_class_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -11420,7 +11410,7 @@ def test_get_custom_class_rest_error(): ) def test_update_custom_class_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11552,14 +11542,14 @@ def test_update_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_custom_class._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -11573,7 +11563,7 @@ def test_update_custom_class_rest_required_fields( # verify required fields with non-default values are left alone client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11613,7 +11603,7 @@ def test_update_custom_class_rest_required_fields( def test_update_custom_class_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_custom_class._get_unset_required_fields({}) @@ -11631,7 +11621,7 @@ def test_update_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_custom_class_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -11689,7 +11679,7 @@ def test_update_custom_class_rest_bad_request( transport: str = "rest", request_type=cloud_speech.UpdateCustomClassRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11715,7 +11705,7 @@ def test_update_custom_class_rest_bad_request( def test_update_custom_class_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11760,7 +11750,7 @@ def test_update_custom_class_rest_flattened(): def test_update_custom_class_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11776,7 +11766,7 @@ def test_update_custom_class_rest_flattened_error(transport: str = "rest"): def test_update_custom_class_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -11789,7 +11779,7 @@ def test_update_custom_class_rest_error(): ) def test_delete_custom_class_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -11835,7 +11825,7 @@ def test_delete_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -11844,7 +11834,7 @@ def test_delete_custom_class_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_custom_class._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -11861,7 +11851,7 @@ def test_delete_custom_class_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -11900,7 +11890,7 @@ def test_delete_custom_class_rest_required_fields( def test_delete_custom_class_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_custom_class._get_unset_required_fields({}) @@ -11919,7 +11909,7 @@ def test_delete_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_custom_class_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -11977,7 +11967,7 @@ def test_delete_custom_class_rest_bad_request( transport: str = "rest", request_type=cloud_speech.DeleteCustomClassRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -11999,7 +11989,7 @@ def test_delete_custom_class_rest_bad_request( def test_delete_custom_class_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12041,7 +12031,7 @@ def test_delete_custom_class_rest_flattened(): def test_delete_custom_class_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12056,7 +12046,7 @@ def test_delete_custom_class_rest_flattened_error(transport: str = "rest"): def test_delete_custom_class_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -12069,7 +12059,7 @@ def test_delete_custom_class_rest_error(): ) def test_undelete_custom_class_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12115,7 +12105,7 @@ def test_undelete_custom_class_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -12124,7 +12114,7 @@ def test_undelete_custom_class_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_custom_class._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -12133,7 +12123,7 @@ def test_undelete_custom_class_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -12173,7 +12163,7 @@ def test_undelete_custom_class_rest_required_fields( def test_undelete_custom_class_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.undelete_custom_class._get_unset_required_fields({}) @@ -12183,7 +12173,7 @@ def test_undelete_custom_class_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_undelete_custom_class_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -12241,7 +12231,7 @@ def test_undelete_custom_class_rest_bad_request( transport: str = "rest", request_type=cloud_speech.UndeleteCustomClassRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12263,7 +12253,7 @@ def test_undelete_custom_class_rest_bad_request( def test_undelete_custom_class_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12305,7 +12295,7 @@ def test_undelete_custom_class_rest_flattened(): def test_undelete_custom_class_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12320,7 +12310,7 @@ def test_undelete_custom_class_rest_flattened_error(transport: str = "rest"): def test_undelete_custom_class_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -12333,7 +12323,7 @@ def test_undelete_custom_class_rest_error(): ) def test_create_phrase_set_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12463,7 +12453,7 @@ def test_create_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -12472,7 +12462,7 @@ def test_create_phrase_set_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_phrase_set._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -12488,7 +12478,7 @@ def test_create_phrase_set_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -12528,7 +12518,7 @@ def test_create_phrase_set_rest_required_fields( def test_create_phrase_set_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_phrase_set._get_unset_required_fields({}) @@ -12551,7 +12541,7 @@ def test_create_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_phrase_set_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -12609,7 +12599,7 @@ def test_create_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech.CreatePhraseSetRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12631,7 +12621,7 @@ def test_create_phrase_set_rest_bad_request( def test_create_phrase_set_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12672,7 +12662,7 @@ def test_create_phrase_set_rest_flattened(): def test_create_phrase_set_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12689,7 +12679,7 @@ def test_create_phrase_set_rest_flattened_error(transport: str = "rest"): def test_create_phrase_set_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -12702,7 +12692,7 @@ def test_create_phrase_set_rest_error(): ) def test_list_phrase_sets_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12753,7 +12743,7 @@ def test_list_phrase_sets_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_phrase_sets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -12762,7 +12752,7 @@ def test_list_phrase_sets_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_phrase_sets._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -12779,7 +12769,7 @@ def test_list_phrase_sets_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -12821,7 +12811,7 @@ def test_list_phrase_sets_rest_required_fields( def test_list_phrase_sets_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_phrase_sets._get_unset_required_fields({}) @@ -12840,7 +12830,7 @@ def test_list_phrase_sets_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_phrase_sets_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -12896,7 +12886,7 @@ def test_list_phrase_sets_rest_bad_request( transport: str = "rest", request_type=cloud_speech.ListPhraseSetsRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12918,7 +12908,7 @@ def test_list_phrase_sets_rest_bad_request( def test_list_phrase_sets_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -12959,7 +12949,7 @@ def test_list_phrase_sets_rest_flattened(): def test_list_phrase_sets_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -12974,7 +12964,7 @@ def test_list_phrase_sets_rest_flattened_error(transport: str = "rest"): def test_list_phrase_sets_rest_pager(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13044,7 +13034,7 @@ def test_list_phrase_sets_rest_pager(transport: str = "rest"): ) def test_get_phrase_set_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13111,7 +13101,7 @@ def test_get_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -13120,7 +13110,7 @@ def test_get_phrase_set_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -13129,7 +13119,7 @@ def test_get_phrase_set_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -13171,7 +13161,7 @@ def test_get_phrase_set_rest_required_fields( def test_get_phrase_set_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_phrase_set._get_unset_required_fields({}) @@ -13181,7 +13171,7 @@ def test_get_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_phrase_set_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -13237,7 +13227,7 @@ def test_get_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech.GetPhraseSetRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13259,7 +13249,7 @@ def test_get_phrase_set_rest_bad_request( def test_get_phrase_set_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13302,7 +13292,7 @@ def test_get_phrase_set_rest_flattened(): def test_get_phrase_set_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13317,7 +13307,7 @@ def test_get_phrase_set_rest_flattened_error(transport: str = "rest"): def test_get_phrase_set_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -13330,7 +13320,7 @@ def test_get_phrase_set_rest_error(): ) def test_update_phrase_set_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13461,14 +13451,14 @@ def test_update_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_phrase_set._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -13482,7 +13472,7 @@ def test_update_phrase_set_rest_required_fields( # verify required fields with non-default values are left alone client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -13522,7 +13512,7 @@ def test_update_phrase_set_rest_required_fields( def test_update_phrase_set_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_phrase_set._get_unset_required_fields({}) @@ -13540,7 +13530,7 @@ def test_update_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_phrase_set_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -13598,7 +13588,7 @@ def test_update_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech.UpdatePhraseSetRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13622,7 +13612,7 @@ def test_update_phrase_set_rest_bad_request( def test_update_phrase_set_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13667,7 +13657,7 @@ def test_update_phrase_set_rest_flattened(): def test_update_phrase_set_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13683,7 +13673,7 @@ def test_update_phrase_set_rest_flattened_error(transport: str = "rest"): def test_update_phrase_set_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -13696,7 +13686,7 @@ def test_update_phrase_set_rest_error(): ) def test_delete_phrase_set_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13742,7 +13732,7 @@ def test_delete_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -13751,7 +13741,7 @@ def test_delete_phrase_set_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_phrase_set._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -13768,7 +13758,7 @@ def test_delete_phrase_set_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -13807,7 +13797,7 @@ def test_delete_phrase_set_rest_required_fields( def test_delete_phrase_set_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_phrase_set._get_unset_required_fields({}) @@ -13826,7 +13816,7 @@ def test_delete_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_phrase_set_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -13884,7 +13874,7 @@ def test_delete_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech.DeletePhraseSetRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13906,7 +13896,7 @@ def test_delete_phrase_set_rest_bad_request( def test_delete_phrase_set_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -13947,7 +13937,7 @@ def test_delete_phrase_set_rest_flattened(): def test_delete_phrase_set_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -13962,7 +13952,7 @@ def test_delete_phrase_set_rest_flattened_error(transport: str = "rest"): def test_delete_phrase_set_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -13975,7 +13965,7 @@ def test_delete_phrase_set_rest_error(): ) def test_undelete_phrase_set_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -14021,7 +14011,7 @@ def test_undelete_phrase_set_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -14030,7 +14020,7 @@ def test_undelete_phrase_set_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).undelete_phrase_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -14039,7 +14029,7 @@ def test_undelete_phrase_set_rest_required_fields( assert jsonified_request["name"] == "name_value" client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -14079,7 +14069,7 @@ def test_undelete_phrase_set_rest_required_fields( def test_undelete_phrase_set_rest_unset_required_fields(): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.undelete_phrase_set._get_unset_required_fields({}) @@ -14089,7 +14079,7 @@ def test_undelete_phrase_set_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_undelete_phrase_set_rest_interceptors(null_interceptor): transport = transports.SpeechRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.SpeechRestInterceptor(), ) client = SpeechClient(transport=transport) @@ -14147,7 +14137,7 @@ def test_undelete_phrase_set_rest_bad_request( transport: str = "rest", request_type=cloud_speech.UndeletePhraseSetRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14169,7 +14159,7 @@ def test_undelete_phrase_set_rest_bad_request( def test_undelete_phrase_set_rest_flattened(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -14211,7 +14201,7 @@ def test_undelete_phrase_set_rest_flattened(): def test_undelete_phrase_set_rest_flattened_error(transport: str = "rest"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -14226,13 +14216,13 @@ def test_undelete_phrase_set_rest_flattened_error(transport: str = "rest"): def test_undelete_phrase_set_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_streaming_recognize_rest_error(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) # Since a `google.api.http` annotation is required for using a rest transport # method, this should error. @@ -14246,17 +14236,17 @@ def test_streaming_recognize_rest_error(): def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SpeechClient( @@ -14266,7 +14256,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -14281,13 +14271,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SpeechClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = SpeechClient( @@ -14299,7 +14288,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = SpeechClient(transport=transport) assert client.transport is transport @@ -14308,13 +14297,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.SpeechGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.SpeechGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -14331,7 +14320,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -14345,7 +14334,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = SpeechClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -14353,7 +14342,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -14365,7 +14354,7 @@ def test_speech_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.SpeechTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -14377,7 +14366,7 @@ def test_speech_base_transport(): ) as Transport: Transport.return_value = None transport = transports.SpeechTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -14442,7 +14431,7 @@ def test_speech_base_transport_with_credentials_file(): "google.cloud.speech_v2.services.speech.transports.SpeechTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SpeechTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -14461,7 +14450,7 @@ def test_speech_base_transport_with_adc(): "google.cloud.speech_v2.services.speech.transports.SpeechTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SpeechTransport() adc.assert_called_once() @@ -14469,7 +14458,7 @@ def test_speech_base_transport_with_adc(): def test_speech_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) SpeechClient() adc.assert_called_once_with( scopes=None, @@ -14489,7 +14478,7 @@ def test_speech_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -14536,7 +14525,7 @@ def test_speech_transport_create_channel(transport_class, grpc_helpers): ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -14561,7 +14550,7 @@ def test_speech_transport_create_channel(transport_class, grpc_helpers): [transports.SpeechGrpcTransport, transports.SpeechGrpcAsyncIOTransport], ) def test_speech_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -14599,7 +14588,7 @@ def test_speech_grpc_transport_client_cert_source_for_mtls(transport_class): def test_speech_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -14611,7 +14600,7 @@ def test_speech_http_transport_client_cert_source_for_mtls(): def test_speech_rest_lro_client(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -14636,7 +14625,7 @@ def test_speech_rest_lro_client(): ) def test_speech_host_no_port(transport_name): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com" ), @@ -14659,7 +14648,7 @@ def test_speech_host_no_port(transport_name): ) def test_speech_host_with_port(transport_name): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="speech.googleapis.com:8000" ), @@ -14679,8 +14668,8 @@ def test_speech_host_with_port(transport_name): ], ) def test_speech_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = SpeechClient( credentials=creds1, transport=transport_name, @@ -14805,7 +14794,7 @@ def test_speech_transport_channel_mtls_with_client_cert_source(transport_class): mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -14880,7 +14869,7 @@ def test_speech_transport_channel_mtls_with_adc(transport_class): def test_speech_grpc_lro_client(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -14897,7 +14886,7 @@ def test_speech_grpc_lro_client(): def test_speech_grpc_lro_async_client(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -15190,7 +15179,7 @@ def test_client_with_default_client_info(): transports.SpeechTransport, "_prep_wrapped_messages" ) as prep: client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -15200,7 +15189,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SpeechClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -15209,7 +15198,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -15224,7 +15213,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15254,7 +15243,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -15282,7 +15271,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15310,7 +15299,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -15338,7 +15327,7 @@ def test_cancel_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.CancelOperationRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15368,7 +15357,7 @@ def test_cancel_operation_rest_bad_request( ) def test_cancel_operation_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -15396,7 +15385,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15426,7 +15415,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -15454,7 +15443,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15484,7 +15473,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -15512,7 +15501,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15542,7 +15531,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -15568,7 +15557,7 @@ def test_list_operations_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15593,7 +15582,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15617,7 +15606,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15646,7 +15635,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15673,7 +15662,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -15691,7 +15680,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -15707,7 +15696,7 @@ async def test_delete_operation_from_dict_async(): def test_cancel_operation(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15732,7 +15721,7 @@ def test_cancel_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_cancel_operation_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15756,7 +15745,7 @@ async def test_cancel_operation_async(transport: str = "grpc_asyncio"): def test_cancel_operation_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15785,7 +15774,7 @@ def test_cancel_operation_field_headers(): @pytest.mark.asyncio async def test_cancel_operation_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15812,7 +15801,7 @@ async def test_cancel_operation_field_headers_async(): def test_cancel_operation_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -15830,7 +15819,7 @@ def test_cancel_operation_from_dict(): @pytest.mark.asyncio async def test_cancel_operation_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -15846,7 +15835,7 @@ async def test_cancel_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15871,7 +15860,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -15897,7 +15886,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15926,7 +15915,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -15955,7 +15944,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -15973,7 +15962,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -15991,7 +15980,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16016,7 +16005,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16042,7 +16031,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -16071,7 +16060,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -16100,7 +16089,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -16118,7 +16107,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -16136,7 +16125,7 @@ async def test_list_operations_from_dict_async(): def test_list_locations(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16161,7 +16150,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16187,7 +16176,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -16216,7 +16205,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -16245,7 +16234,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -16263,7 +16252,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -16281,7 +16270,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16306,7 +16295,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16331,7 +16320,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): - client = SpeechClient(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = SpeechClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -16358,7 +16347,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): - client = SpeechAsyncClient(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = SpeechAsyncClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -16386,7 +16375,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -16404,7 +16393,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = SpeechAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -16428,7 +16417,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -16445,7 +16434,7 @@ def test_client_ctx(): ] for transport in transports: client = SpeechClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-storage-transfer/google/cloud/storage_transfer/gapic_version.py b/packages/google-cloud-storage-transfer/google/cloud/storage_transfer/gapic_version.py index 4316e0e5df1f..360a0d13ebdd 100644 --- a/packages/google-cloud-storage-transfer/google/cloud/storage_transfer/gapic_version.py +++ b/packages/google-cloud-storage-transfer/google/cloud/storage_transfer/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.11.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/gapic_version.py b/packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/gapic_version.py index 4316e0e5df1f..360a0d13ebdd 100644 --- a/packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/gapic_version.py +++ b/packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.11.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/services/storage_transfer_service/client.py b/packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/services/storage_transfer_service/client.py index 083ccd0a1d3b..f484ca0aebc7 100644 --- a/packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/services/storage_transfer_service/client.py +++ b/packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/services/storage_transfer_service/client.py @@ -389,6 +389,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -407,6 +408,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -483,17 +485,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = StorageTransferServiceClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = StorageTransferServiceClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-storage-transfer/samples/generated_samples/snippet_metadata_google.storagetransfer.v1.json b/packages/google-cloud-storage-transfer/samples/generated_samples/snippet_metadata_google.storagetransfer.v1.json index 568c06724fe3..f3c5ac4b04c5 100644 --- a/packages/google-cloud-storage-transfer/samples/generated_samples/snippet_metadata_google.storagetransfer.v1.json +++ b/packages/google-cloud-storage-transfer/samples/generated_samples/snippet_metadata_google.storagetransfer.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-storage-transfer", - "version": "1.11.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-storage-transfer/setup.py b/packages/google-cloud-storage-transfer/setup.py index 5879ec12f0cc..3945a13a8382 100644 --- a/packages/google-cloud-storage-transfer/setup.py +++ b/packages/google-cloud-storage-transfer/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-storage-transfer/testing/constraints-3.7.txt b/packages/google-cloud-storage-transfer/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-storage-transfer/testing/constraints-3.7.txt +++ b/packages/google-cloud-storage-transfer/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-storage-transfer/tests/unit/gapic/storage_transfer_v1/test_storage_transfer_service.py b/packages/google-cloud-storage-transfer/tests/unit/gapic/storage_transfer_v1/test_storage_transfer_service.py index acf7a9f3fb40..029d1f381ed2 100644 --- a/packages/google-cloud-storage-transfer/tests/unit/gapic/storage_transfer_v1/test_storage_transfer_service.py +++ b/packages/google-cloud-storage-transfer/tests/unit/gapic/storage_transfer_v1/test_storage_transfer_service.py @@ -93,18 +93,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -356,7 +344,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -383,42 +371,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -431,7 +426,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_storage_transfer_service_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -485,7 +480,7 @@ def test_storage_transfer_service_client_service_account_always_use_jwt( def test_storage_transfer_service_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -556,9 +551,7 @@ def test_storage_transfer_service_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(StorageTransferServiceClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -979,20 +972,20 @@ def test_storage_transfer_service_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -1004,13 +997,11 @@ def test_storage_transfer_service_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -1026,8 +1017,7 @@ def test_storage_transfer_service_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1193,8 +1183,8 @@ def test_storage_transfer_service_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1223,7 +1213,7 @@ def test_storage_transfer_service_client_create_channel_credentials_file( ) def test_get_google_service_account(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1257,7 +1247,7 @@ def test_get_google_service_account_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1277,7 +1267,7 @@ async def test_get_google_service_account_async( request_type=transfer.GetGoogleServiceAccountRequest, ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1316,7 +1306,7 @@ async def test_get_google_service_account_async_from_dict(): def test_get_google_service_account_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1348,7 +1338,7 @@ def test_get_google_service_account_field_headers(): @pytest.mark.asyncio async def test_get_google_service_account_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1388,7 +1378,7 @@ async def test_get_google_service_account_field_headers_async(): ) def test_create_transfer_job(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1428,7 +1418,7 @@ def test_create_transfer_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1447,7 +1437,7 @@ async def test_create_transfer_job_async( transport: str = "grpc_asyncio", request_type=transfer.CreateTransferJobRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1499,7 +1489,7 @@ async def test_create_transfer_job_async_from_dict(): ) def test_update_transfer_job(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1539,7 +1529,7 @@ def test_update_transfer_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1558,7 +1548,7 @@ async def test_update_transfer_job_async( transport: str = "grpc_asyncio", request_type=transfer.UpdateTransferJobRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1603,7 +1593,7 @@ async def test_update_transfer_job_async_from_dict(): def test_update_transfer_job_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1635,7 +1625,7 @@ def test_update_transfer_job_field_headers(): @pytest.mark.asyncio async def test_update_transfer_job_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1675,7 +1665,7 @@ async def test_update_transfer_job_field_headers_async(): ) def test_get_transfer_job(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1713,7 +1703,7 @@ def test_get_transfer_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1730,7 +1720,7 @@ async def test_get_transfer_job_async( transport: str = "grpc_asyncio", request_type=transfer.GetTransferJobRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1773,7 +1763,7 @@ async def test_get_transfer_job_async_from_dict(): def test_get_transfer_job_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1803,7 +1793,7 @@ def test_get_transfer_job_field_headers(): @pytest.mark.asyncio async def test_get_transfer_job_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1841,7 +1831,7 @@ async def test_get_transfer_job_field_headers_async(): ) def test_list_transfer_jobs(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1873,7 +1863,7 @@ def test_list_transfer_jobs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1892,7 +1882,7 @@ async def test_list_transfer_jobs_async( transport: str = "grpc_asyncio", request_type=transfer.ListTransferJobsRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1929,7 +1919,7 @@ async def test_list_transfer_jobs_async_from_dict(): def test_list_transfer_jobs_pager(transport_name: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1978,7 +1968,7 @@ def test_list_transfer_jobs_pager(transport_name: str = "grpc"): def test_list_transfer_jobs_pages(transport_name: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2022,7 +2012,7 @@ def test_list_transfer_jobs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_transfer_jobs_async_pager(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2074,7 +2064,7 @@ async def test_list_transfer_jobs_async_pager(): @pytest.mark.asyncio async def test_list_transfer_jobs_async_pages(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2131,7 +2121,7 @@ async def test_list_transfer_jobs_async_pages(): ) def test_pause_transfer_operation(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2160,7 +2150,7 @@ def test_pause_transfer_operation_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2179,7 +2169,7 @@ async def test_pause_transfer_operation_async( transport: str = "grpc_asyncio", request_type=transfer.PauseTransferOperationRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2211,7 +2201,7 @@ async def test_pause_transfer_operation_async_from_dict(): def test_pause_transfer_operation_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2243,7 +2233,7 @@ def test_pause_transfer_operation_field_headers(): @pytest.mark.asyncio async def test_pause_transfer_operation_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2281,7 +2271,7 @@ async def test_pause_transfer_operation_field_headers_async(): ) def test_resume_transfer_operation(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2310,7 +2300,7 @@ def test_resume_transfer_operation_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2330,7 +2320,7 @@ async def test_resume_transfer_operation_async( request_type=transfer.ResumeTransferOperationRequest, ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2362,7 +2352,7 @@ async def test_resume_transfer_operation_async_from_dict(): def test_resume_transfer_operation_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2394,7 +2384,7 @@ def test_resume_transfer_operation_field_headers(): @pytest.mark.asyncio async def test_resume_transfer_operation_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2432,7 +2422,7 @@ async def test_resume_transfer_operation_field_headers_async(): ) def test_run_transfer_job(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2459,7 +2449,7 @@ def test_run_transfer_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2476,7 +2466,7 @@ async def test_run_transfer_job_async( transport: str = "grpc_asyncio", request_type=transfer.RunTransferJobRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2508,7 +2498,7 @@ async def test_run_transfer_job_async_from_dict(): def test_run_transfer_job_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2538,7 +2528,7 @@ def test_run_transfer_job_field_headers(): @pytest.mark.asyncio async def test_run_transfer_job_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2576,7 +2566,7 @@ async def test_run_transfer_job_field_headers_async(): ) def test_delete_transfer_job(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2605,7 +2595,7 @@ def test_delete_transfer_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2624,7 +2614,7 @@ async def test_delete_transfer_job_async( transport: str = "grpc_asyncio", request_type=transfer.DeleteTransferJobRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2656,7 +2646,7 @@ async def test_delete_transfer_job_async_from_dict(): def test_delete_transfer_job_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2688,7 +2678,7 @@ def test_delete_transfer_job_field_headers(): @pytest.mark.asyncio async def test_delete_transfer_job_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2726,7 +2716,7 @@ async def test_delete_transfer_job_field_headers_async(): ) def test_create_agent_pool(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2762,7 +2752,7 @@ def test_create_agent_pool_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2781,7 +2771,7 @@ async def test_create_agent_pool_async( transport: str = "grpc_asyncio", request_type=transfer.CreateAgentPoolRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2822,7 +2812,7 @@ async def test_create_agent_pool_async_from_dict(): def test_create_agent_pool_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2854,7 +2844,7 @@ def test_create_agent_pool_field_headers(): @pytest.mark.asyncio async def test_create_agent_pool_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2887,7 +2877,7 @@ async def test_create_agent_pool_field_headers_async(): def test_create_agent_pool_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2921,7 +2911,7 @@ def test_create_agent_pool_flattened(): def test_create_agent_pool_flattened_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2938,7 +2928,7 @@ def test_create_agent_pool_flattened_error(): @pytest.mark.asyncio async def test_create_agent_pool_flattened_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2977,7 +2967,7 @@ async def test_create_agent_pool_flattened_async(): @pytest.mark.asyncio async def test_create_agent_pool_flattened_error_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3000,7 +2990,7 @@ async def test_create_agent_pool_flattened_error_async(): ) def test_update_agent_pool(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3036,7 +3026,7 @@ def test_update_agent_pool_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3055,7 +3045,7 @@ async def test_update_agent_pool_async( transport: str = "grpc_asyncio", request_type=transfer.UpdateAgentPoolRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3096,7 +3086,7 @@ async def test_update_agent_pool_async_from_dict(): def test_update_agent_pool_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3128,7 +3118,7 @@ def test_update_agent_pool_field_headers(): @pytest.mark.asyncio async def test_update_agent_pool_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3161,7 +3151,7 @@ async def test_update_agent_pool_field_headers_async(): def test_update_agent_pool_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3191,7 +3181,7 @@ def test_update_agent_pool_flattened(): def test_update_agent_pool_flattened_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3207,7 +3197,7 @@ def test_update_agent_pool_flattened_error(): @pytest.mark.asyncio async def test_update_agent_pool_flattened_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3242,7 +3232,7 @@ async def test_update_agent_pool_flattened_async(): @pytest.mark.asyncio async def test_update_agent_pool_flattened_error_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3264,7 +3254,7 @@ async def test_update_agent_pool_flattened_error_async(): ) def test_get_agent_pool(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3298,7 +3288,7 @@ def test_get_agent_pool_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3315,7 +3305,7 @@ async def test_get_agent_pool_async( transport: str = "grpc_asyncio", request_type=transfer.GetAgentPoolRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3354,7 +3344,7 @@ async def test_get_agent_pool_async_from_dict(): def test_get_agent_pool_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3384,7 +3374,7 @@ def test_get_agent_pool_field_headers(): @pytest.mark.asyncio async def test_get_agent_pool_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3415,7 +3405,7 @@ async def test_get_agent_pool_field_headers_async(): def test_get_agent_pool_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3439,7 +3429,7 @@ def test_get_agent_pool_flattened(): def test_get_agent_pool_flattened_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3454,7 +3444,7 @@ def test_get_agent_pool_flattened_error(): @pytest.mark.asyncio async def test_get_agent_pool_flattened_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3483,7 +3473,7 @@ async def test_get_agent_pool_flattened_async(): @pytest.mark.asyncio async def test_get_agent_pool_flattened_error_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3504,7 +3494,7 @@ async def test_get_agent_pool_flattened_error_async(): ) def test_list_agent_pools(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3534,7 +3524,7 @@ def test_list_agent_pools_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3551,7 +3541,7 @@ async def test_list_agent_pools_async( transport: str = "grpc_asyncio", request_type=transfer.ListAgentPoolsRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3586,7 +3576,7 @@ async def test_list_agent_pools_async_from_dict(): def test_list_agent_pools_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3616,7 +3606,7 @@ def test_list_agent_pools_field_headers(): @pytest.mark.asyncio async def test_list_agent_pools_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3647,7 +3637,7 @@ async def test_list_agent_pools_field_headers_async(): def test_list_agent_pools_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3671,7 +3661,7 @@ def test_list_agent_pools_flattened(): def test_list_agent_pools_flattened_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3686,7 +3676,7 @@ def test_list_agent_pools_flattened_error(): @pytest.mark.asyncio async def test_list_agent_pools_flattened_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3715,7 +3705,7 @@ async def test_list_agent_pools_flattened_async(): @pytest.mark.asyncio async def test_list_agent_pools_flattened_error_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3729,7 +3719,7 @@ async def test_list_agent_pools_flattened_error_async(): def test_list_agent_pools_pager(transport_name: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3779,7 +3769,7 @@ def test_list_agent_pools_pager(transport_name: str = "grpc"): def test_list_agent_pools_pages(transport_name: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -3821,7 +3811,7 @@ def test_list_agent_pools_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_agent_pools_async_pager(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3871,7 +3861,7 @@ async def test_list_agent_pools_async_pager(): @pytest.mark.asyncio async def test_list_agent_pools_async_pages(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3926,7 +3916,7 @@ async def test_list_agent_pools_async_pages(): ) def test_delete_agent_pool(request_type, transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3955,7 +3945,7 @@ def test_delete_agent_pool_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3974,7 +3964,7 @@ async def test_delete_agent_pool_async( transport: str = "grpc_asyncio", request_type=transfer.DeleteAgentPoolRequest ): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4006,7 +3996,7 @@ async def test_delete_agent_pool_async_from_dict(): def test_delete_agent_pool_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4038,7 +4028,7 @@ def test_delete_agent_pool_field_headers(): @pytest.mark.asyncio async def test_delete_agent_pool_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -4069,7 +4059,7 @@ async def test_delete_agent_pool_field_headers_async(): def test_delete_agent_pool_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4095,7 +4085,7 @@ def test_delete_agent_pool_flattened(): def test_delete_agent_pool_flattened_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4110,7 +4100,7 @@ def test_delete_agent_pool_flattened_error(): @pytest.mark.asyncio async def test_delete_agent_pool_flattened_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4139,7 +4129,7 @@ async def test_delete_agent_pool_flattened_async(): @pytest.mark.asyncio async def test_delete_agent_pool_flattened_error_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -4160,7 +4150,7 @@ async def test_delete_agent_pool_flattened_error_async(): ) def test_get_google_service_account_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4213,7 +4203,7 @@ def test_get_google_service_account_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_google_service_account._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4222,7 +4212,7 @@ def test_get_google_service_account_rest_required_fields( jsonified_request["projectId"] = "project_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_google_service_account._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4231,7 +4221,7 @@ def test_get_google_service_account_rest_required_fields( assert jsonified_request["projectId"] == "project_id_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4273,7 +4263,7 @@ def test_get_google_service_account_rest_required_fields( def test_get_google_service_account_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_google_service_account._get_unset_required_fields({}) @@ -4283,7 +4273,7 @@ def test_get_google_service_account_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_google_service_account_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -4343,7 +4333,7 @@ def test_get_google_service_account_rest_bad_request( transport: str = "rest", request_type=transfer.GetGoogleServiceAccountRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4365,7 +4355,7 @@ def test_get_google_service_account_rest_bad_request( def test_get_google_service_account_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4378,7 +4368,7 @@ def test_get_google_service_account_rest_error(): ) def test_create_transfer_job_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4614,21 +4604,21 @@ def test_create_transfer_job_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_transfer_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_transfer_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4671,7 +4661,7 @@ def test_create_transfer_job_rest_required_fields( def test_create_transfer_job_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_transfer_job._get_unset_required_fields({}) @@ -4681,7 +4671,7 @@ def test_create_transfer_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_transfer_job_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -4739,7 +4729,7 @@ def test_create_transfer_job_rest_bad_request( transport: str = "rest", request_type=transfer.CreateTransferJobRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4761,7 +4751,7 @@ def test_create_transfer_job_rest_bad_request( def test_create_transfer_job_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4774,7 +4764,7 @@ def test_create_transfer_job_rest_error(): ) def test_update_transfer_job_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4834,7 +4824,7 @@ def test_update_transfer_job_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_transfer_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4844,7 +4834,7 @@ def test_update_transfer_job_rest_required_fields( jsonified_request["projectId"] = "project_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_transfer_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4855,7 +4845,7 @@ def test_update_transfer_job_rest_required_fields( assert jsonified_request["projectId"] == "project_id_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4898,7 +4888,7 @@ def test_update_transfer_job_rest_required_fields( def test_update_transfer_job_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_transfer_job._get_unset_required_fields({}) @@ -4917,7 +4907,7 @@ def test_update_transfer_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_transfer_job_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -4975,7 +4965,7 @@ def test_update_transfer_job_rest_bad_request( transport: str = "rest", request_type=transfer.UpdateTransferJobRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4997,7 +4987,7 @@ def test_update_transfer_job_rest_bad_request( def test_update_transfer_job_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5010,7 +5000,7 @@ def test_update_transfer_job_rest_error(): ) def test_get_transfer_job_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5071,7 +5061,7 @@ def test_get_transfer_job_rest_required_fields( assert "projectId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_transfer_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5083,7 +5073,7 @@ def test_get_transfer_job_rest_required_fields( jsonified_request["projectId"] = "project_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_transfer_job._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("project_id",)) @@ -5096,7 +5086,7 @@ def test_get_transfer_job_rest_required_fields( assert jsonified_request["projectId"] == "project_id_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5144,7 +5134,7 @@ def test_get_transfer_job_rest_required_fields( def test_get_transfer_job_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_transfer_job._get_unset_required_fields({}) @@ -5162,7 +5152,7 @@ def test_get_transfer_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_transfer_job_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -5218,7 +5208,7 @@ def test_get_transfer_job_rest_bad_request( transport: str = "rest", request_type=transfer.GetTransferJobRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5240,7 +5230,7 @@ def test_get_transfer_job_rest_bad_request( def test_get_transfer_job_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5253,7 +5243,7 @@ def test_get_transfer_job_rest_error(): ) def test_list_transfer_jobs_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5305,7 +5295,7 @@ def test_list_transfer_jobs_rest_required_fields( assert "filter" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_transfer_jobs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5316,7 +5306,7 @@ def test_list_transfer_jobs_rest_required_fields( jsonified_request["filter"] = "filter_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_transfer_jobs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5333,7 +5323,7 @@ def test_list_transfer_jobs_rest_required_fields( assert jsonified_request["filter"] == "filter_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5381,7 +5371,7 @@ def test_list_transfer_jobs_rest_required_fields( def test_list_transfer_jobs_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_transfer_jobs._get_unset_required_fields({}) @@ -5400,7 +5390,7 @@ def test_list_transfer_jobs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_transfer_jobs_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -5458,7 +5448,7 @@ def test_list_transfer_jobs_rest_bad_request( transport: str = "rest", request_type=transfer.ListTransferJobsRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5480,7 +5470,7 @@ def test_list_transfer_jobs_rest_bad_request( def test_list_transfer_jobs_rest_pager(transport: str = "rest"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5548,7 +5538,7 @@ def test_list_transfer_jobs_rest_pager(transport: str = "rest"): ) def test_pause_transfer_operation_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5594,7 +5584,7 @@ def test_pause_transfer_operation_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_transfer_operation._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5603,7 +5593,7 @@ def test_pause_transfer_operation_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).pause_transfer_operation._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5612,7 +5602,7 @@ def test_pause_transfer_operation_rest_required_fields( assert jsonified_request["name"] == "name_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5652,7 +5642,7 @@ def test_pause_transfer_operation_rest_required_fields( def test_pause_transfer_operation_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.pause_transfer_operation._get_unset_required_fields({}) @@ -5662,7 +5652,7 @@ def test_pause_transfer_operation_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_pause_transfer_operation_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -5712,7 +5702,7 @@ def test_pause_transfer_operation_rest_bad_request( transport: str = "rest", request_type=transfer.PauseTransferOperationRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5734,7 +5724,7 @@ def test_pause_transfer_operation_rest_bad_request( def test_pause_transfer_operation_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5747,7 +5737,7 @@ def test_pause_transfer_operation_rest_error(): ) def test_resume_transfer_operation_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5793,7 +5783,7 @@ def test_resume_transfer_operation_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_transfer_operation._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5802,7 +5792,7 @@ def test_resume_transfer_operation_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).resume_transfer_operation._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5811,7 +5801,7 @@ def test_resume_transfer_operation_rest_required_fields( assert jsonified_request["name"] == "name_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5851,7 +5841,7 @@ def test_resume_transfer_operation_rest_required_fields( def test_resume_transfer_operation_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.resume_transfer_operation._get_unset_required_fields({}) @@ -5861,7 +5851,7 @@ def test_resume_transfer_operation_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_resume_transfer_operation_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -5912,7 +5902,7 @@ def test_resume_transfer_operation_rest_bad_request( transport: str = "rest", request_type=transfer.ResumeTransferOperationRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5934,7 +5924,7 @@ def test_resume_transfer_operation_rest_bad_request( def test_resume_transfer_operation_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -5947,7 +5937,7 @@ def test_resume_transfer_operation_rest_error(): ) def test_run_transfer_job_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5994,7 +5984,7 @@ def test_run_transfer_job_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_transfer_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6004,7 +5994,7 @@ def test_run_transfer_job_rest_required_fields( jsonified_request["projectId"] = "project_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).run_transfer_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6015,7 +6005,7 @@ def test_run_transfer_job_rest_required_fields( assert jsonified_request["projectId"] == "project_id_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6055,7 +6045,7 @@ def test_run_transfer_job_rest_required_fields( def test_run_transfer_job_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.run_transfer_job._get_unset_required_fields({}) @@ -6073,7 +6063,7 @@ def test_run_transfer_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_run_transfer_job_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -6131,7 +6121,7 @@ def test_run_transfer_job_rest_bad_request( transport: str = "rest", request_type=transfer.RunTransferJobRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6153,7 +6143,7 @@ def test_run_transfer_job_rest_bad_request( def test_run_transfer_job_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6166,7 +6156,7 @@ def test_run_transfer_job_rest_error(): ) def test_delete_transfer_job_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6214,7 +6204,7 @@ def test_delete_transfer_job_rest_required_fields( assert "projectId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_transfer_job._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6226,7 +6216,7 @@ def test_delete_transfer_job_rest_required_fields( jsonified_request["projectId"] = "project_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_transfer_job._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("project_id",)) @@ -6239,7 +6229,7 @@ def test_delete_transfer_job_rest_required_fields( assert jsonified_request["projectId"] == "project_id_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6284,7 +6274,7 @@ def test_delete_transfer_job_rest_required_fields( def test_delete_transfer_job_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_transfer_job._get_unset_required_fields({}) @@ -6302,7 +6292,7 @@ def test_delete_transfer_job_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_transfer_job_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -6352,7 +6342,7 @@ def test_delete_transfer_job_rest_bad_request( transport: str = "rest", request_type=transfer.DeleteTransferJobRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6374,7 +6364,7 @@ def test_delete_transfer_job_rest_bad_request( def test_delete_transfer_job_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6387,7 +6377,7 @@ def test_delete_transfer_job_rest_error(): ) def test_create_agent_pool_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6517,7 +6507,7 @@ def test_create_agent_pool_rest_required_fields( assert "agentPoolId" not in jsonified_request unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_agent_pool._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -6529,7 +6519,7 @@ def test_create_agent_pool_rest_required_fields( jsonified_request["agentPoolId"] = "agent_pool_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_agent_pool._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("agent_pool_id",)) @@ -6542,7 +6532,7 @@ def test_create_agent_pool_rest_required_fields( assert jsonified_request["agentPoolId"] == "agent_pool_id_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6591,7 +6581,7 @@ def test_create_agent_pool_rest_required_fields( def test_create_agent_pool_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_agent_pool._get_unset_required_fields({}) @@ -6610,7 +6600,7 @@ def test_create_agent_pool_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_agent_pool_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -6668,7 +6658,7 @@ def test_create_agent_pool_rest_bad_request( transport: str = "rest", request_type=transfer.CreateAgentPoolRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6690,7 +6680,7 @@ def test_create_agent_pool_rest_bad_request( def test_create_agent_pool_rest_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6732,7 +6722,7 @@ def test_create_agent_pool_rest_flattened(): def test_create_agent_pool_rest_flattened_error(transport: str = "rest"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6749,7 +6739,7 @@ def test_create_agent_pool_rest_flattened_error(transport: str = "rest"): def test_create_agent_pool_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -6762,7 +6752,7 @@ def test_create_agent_pool_rest_error(): ) def test_update_agent_pool_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -6889,14 +6879,14 @@ def test_update_agent_pool_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_agent_pool._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_agent_pool._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) @@ -6905,7 +6895,7 @@ def test_update_agent_pool_rest_required_fields( # verify required fields with non-default values are left alone client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -6948,7 +6938,7 @@ def test_update_agent_pool_rest_required_fields( def test_update_agent_pool_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_agent_pool._get_unset_required_fields({}) @@ -6958,7 +6948,7 @@ def test_update_agent_pool_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_agent_pool_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -7016,7 +7006,7 @@ def test_update_agent_pool_rest_bad_request( transport: str = "rest", request_type=transfer.UpdateAgentPoolRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7038,7 +7028,7 @@ def test_update_agent_pool_rest_bad_request( def test_update_agent_pool_rest_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7080,7 +7070,7 @@ def test_update_agent_pool_rest_flattened(): def test_update_agent_pool_rest_flattened_error(transport: str = "rest"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7096,7 +7086,7 @@ def test_update_agent_pool_rest_flattened_error(transport: str = "rest"): def test_update_agent_pool_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7109,7 +7099,7 @@ def test_update_agent_pool_rest_error(): ) def test_get_agent_pool_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7162,7 +7152,7 @@ def test_get_agent_pool_rest_required_fields(request_type=transfer.GetAgentPoolR # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_agent_pool._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7171,7 +7161,7 @@ def test_get_agent_pool_rest_required_fields(request_type=transfer.GetAgentPoolR jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_agent_pool._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7180,7 +7170,7 @@ def test_get_agent_pool_rest_required_fields(request_type=transfer.GetAgentPoolR assert jsonified_request["name"] == "name_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7222,7 +7212,7 @@ def test_get_agent_pool_rest_required_fields(request_type=transfer.GetAgentPoolR def test_get_agent_pool_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_agent_pool._get_unset_required_fields({}) @@ -7232,7 +7222,7 @@ def test_get_agent_pool_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_agent_pool_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -7288,7 +7278,7 @@ def test_get_agent_pool_rest_bad_request( transport: str = "rest", request_type=transfer.GetAgentPoolRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7310,7 +7300,7 @@ def test_get_agent_pool_rest_bad_request( def test_get_agent_pool_rest_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7350,7 +7340,7 @@ def test_get_agent_pool_rest_flattened(): def test_get_agent_pool_rest_flattened_error(transport: str = "rest"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7365,7 +7355,7 @@ def test_get_agent_pool_rest_flattened_error(transport: str = "rest"): def test_get_agent_pool_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -7378,7 +7368,7 @@ def test_get_agent_pool_rest_error(): ) def test_list_agent_pools_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7429,7 +7419,7 @@ def test_list_agent_pools_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_agent_pools._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7438,7 +7428,7 @@ def test_list_agent_pools_rest_required_fields( jsonified_request["projectId"] = "project_id_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_agent_pools._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -7455,7 +7445,7 @@ def test_list_agent_pools_rest_required_fields( assert jsonified_request["projectId"] == "project_id_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7497,7 +7487,7 @@ def test_list_agent_pools_rest_required_fields( def test_list_agent_pools_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_agent_pools._get_unset_required_fields({}) @@ -7516,7 +7506,7 @@ def test_list_agent_pools_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_agent_pools_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -7572,7 +7562,7 @@ def test_list_agent_pools_rest_bad_request( transport: str = "rest", request_type=transfer.ListAgentPoolsRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7594,7 +7584,7 @@ def test_list_agent_pools_rest_bad_request( def test_list_agent_pools_rest_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7634,7 +7624,7 @@ def test_list_agent_pools_rest_flattened(): def test_list_agent_pools_rest_flattened_error(transport: str = "rest"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7649,7 +7639,7 @@ def test_list_agent_pools_rest_flattened_error(transport: str = "rest"): def test_list_agent_pools_rest_pager(transport: str = "rest"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7717,7 +7707,7 @@ def test_list_agent_pools_rest_pager(transport: str = "rest"): ) def test_delete_agent_pool_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7763,7 +7753,7 @@ def test_delete_agent_pool_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_agent_pool._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7772,7 +7762,7 @@ def test_delete_agent_pool_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_agent_pool._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -7781,7 +7771,7 @@ def test_delete_agent_pool_rest_required_fields( assert jsonified_request["name"] == "name_value" client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -7820,7 +7810,7 @@ def test_delete_agent_pool_rest_required_fields( def test_delete_agent_pool_rest_unset_required_fields(): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_agent_pool._get_unset_required_fields({}) @@ -7830,7 +7820,7 @@ def test_delete_agent_pool_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_agent_pool_rest_interceptors(null_interceptor): transport = transports.StorageTransferServiceRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageTransferServiceRestInterceptor(), @@ -7880,7 +7870,7 @@ def test_delete_agent_pool_rest_bad_request( transport: str = "rest", request_type=transfer.DeleteAgentPoolRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7902,7 +7892,7 @@ def test_delete_agent_pool_rest_bad_request( def test_delete_agent_pool_rest_flattened(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -7940,7 +7930,7 @@ def test_delete_agent_pool_rest_flattened(): def test_delete_agent_pool_rest_flattened_error(transport: str = "rest"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7955,24 +7945,24 @@ def test_delete_agent_pool_rest_flattened_error(transport: str = "rest"): def test_delete_agent_pool_rest_error(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.StorageTransferServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.StorageTransferServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = StorageTransferServiceClient( @@ -7982,7 +7972,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.StorageTransferServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -7997,13 +7987,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = StorageTransferServiceClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.StorageTransferServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = StorageTransferServiceClient( @@ -8015,7 +8004,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.StorageTransferServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = StorageTransferServiceClient(transport=transport) assert client.transport is transport @@ -8024,13 +8013,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.StorageTransferServiceGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.StorageTransferServiceGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -8047,7 +8036,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -8061,7 +8050,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = StorageTransferServiceClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -8069,7 +8058,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -8081,7 +8070,7 @@ def test_storage_transfer_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.StorageTransferServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -8093,7 +8082,7 @@ def test_storage_transfer_service_base_transport(): ) as Transport: Transport.return_value = None transport = transports.StorageTransferServiceTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -8146,7 +8135,7 @@ def test_storage_transfer_service_base_transport_with_credentials_file(): "google.cloud.storage_transfer_v1.services.storage_transfer_service.transports.StorageTransferServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.StorageTransferServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -8165,7 +8154,7 @@ def test_storage_transfer_service_base_transport_with_adc(): "google.cloud.storage_transfer_v1.services.storage_transfer_service.transports.StorageTransferServiceTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.StorageTransferServiceTransport() adc.assert_called_once() @@ -8173,7 +8162,7 @@ def test_storage_transfer_service_base_transport_with_adc(): def test_storage_transfer_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) StorageTransferServiceClient() adc.assert_called_once_with( scopes=None, @@ -8193,7 +8182,7 @@ def test_storage_transfer_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -8242,7 +8231,7 @@ def test_storage_transfer_service_transport_create_channel( ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -8272,7 +8261,7 @@ def test_storage_transfer_service_transport_create_channel( def test_storage_transfer_service_grpc_transport_client_cert_source_for_mtls( transport_class, ): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -8310,7 +8299,7 @@ def test_storage_transfer_service_grpc_transport_client_cert_source_for_mtls( def test_storage_transfer_service_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -8322,7 +8311,7 @@ def test_storage_transfer_service_http_transport_client_cert_source_for_mtls(): def test_storage_transfer_service_rest_lro_client(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) transport = client.transport @@ -8347,7 +8336,7 @@ def test_storage_transfer_service_rest_lro_client(): ) def test_storage_transfer_service_host_no_port(transport_name): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="storagetransfer.googleapis.com" ), @@ -8370,7 +8359,7 @@ def test_storage_transfer_service_host_no_port(transport_name): ) def test_storage_transfer_service_host_with_port(transport_name): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="storagetransfer.googleapis.com:8000" ), @@ -8390,8 +8379,8 @@ def test_storage_transfer_service_host_with_port(transport_name): ], ) def test_storage_transfer_service_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = StorageTransferServiceClient( credentials=creds1, transport=transport_name, @@ -8494,7 +8483,7 @@ def test_storage_transfer_service_transport_channel_mtls_with_client_cert_source mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -8572,7 +8561,7 @@ def test_storage_transfer_service_transport_channel_mtls_with_adc(transport_clas def test_storage_transfer_service_grpc_lro_client(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) transport = client.transport @@ -8589,7 +8578,7 @@ def test_storage_transfer_service_grpc_lro_client(): def test_storage_transfer_service_grpc_lro_async_client(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) transport = client.transport @@ -8737,7 +8726,7 @@ def test_client_with_default_client_info(): transports.StorageTransferServiceTransport, "_prep_wrapped_messages" ) as prep: client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8747,7 +8736,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = StorageTransferServiceClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -8756,7 +8745,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -8771,7 +8760,7 @@ def test_cancel_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.CancelOperationRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8799,7 +8788,7 @@ def test_cancel_operation_rest_bad_request( ) def test_cancel_operation_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "transferOperations/sample1"} @@ -8827,7 +8816,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8855,7 +8844,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "transferOperations/sample1"} @@ -8883,7 +8872,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8911,7 +8900,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "transferOperations"} @@ -8937,7 +8926,7 @@ def test_list_operations_rest(request_type): def test_cancel_operation(transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8962,7 +8951,7 @@ def test_cancel_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_cancel_operation_async(transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8986,7 +8975,7 @@ async def test_cancel_operation_async(transport: str = "grpc_asyncio"): def test_cancel_operation_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9015,7 +9004,7 @@ def test_cancel_operation_field_headers(): @pytest.mark.asyncio async def test_cancel_operation_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9042,7 +9031,7 @@ async def test_cancel_operation_field_headers_async(): def test_cancel_operation_from_dict(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -9060,7 +9049,7 @@ def test_cancel_operation_from_dict(): @pytest.mark.asyncio async def test_cancel_operation_from_dict_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -9076,7 +9065,7 @@ async def test_cancel_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9101,7 +9090,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9127,7 +9116,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9156,7 +9145,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9185,7 +9174,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -9203,7 +9192,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -9221,7 +9210,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9246,7 +9235,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9272,7 +9261,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9301,7 +9290,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -9330,7 +9319,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -9348,7 +9337,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = StorageTransferServiceAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -9372,7 +9361,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -9389,7 +9378,7 @@ def test_client_ctx(): ] for transport in transports: client = StorageTransferServiceClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: diff --git a/packages/google-cloud-storageinsights/google/cloud/storageinsights/gapic_version.py b/packages/google-cloud-storageinsights/google/cloud/storageinsights/gapic_version.py index ae12f4dfd596..360a0d13ebdd 100644 --- a/packages/google-cloud-storageinsights/google/cloud/storageinsights/gapic_version.py +++ b/packages/google-cloud-storageinsights/google/cloud/storageinsights/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.5" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-storageinsights/google/cloud/storageinsights_v1/gapic_version.py b/packages/google-cloud-storageinsights/google/cloud/storageinsights_v1/gapic_version.py index ae12f4dfd596..360a0d13ebdd 100644 --- a/packages/google-cloud-storageinsights/google/cloud/storageinsights_v1/gapic_version.py +++ b/packages/google-cloud-storageinsights/google/cloud/storageinsights_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.5" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-storageinsights/google/cloud/storageinsights_v1/services/storage_insights/client.py b/packages/google-cloud-storageinsights/google/cloud/storageinsights_v1/services/storage_insights/client.py index ef8c5c7da094..0d300c232f72 100644 --- a/packages/google-cloud-storageinsights/google/cloud/storageinsights_v1/services/storage_insights/client.py +++ b/packages/google-cloud-storageinsights/google/cloud/storageinsights_v1/services/storage_insights/client.py @@ -413,6 +413,7 @@ def _read_environment_variables(): ) return use_client_cert == "true", use_mtls_endpoint, universe_domain_env + @staticmethod def _get_client_cert_source(provided_cert_source, use_cert_flag): """Return the client cert source to be used by the client. @@ -431,6 +432,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag): client_cert_source = mtls.default_client_cert_source() return client_cert_source + @staticmethod def _get_api_endpoint( api_override, client_cert_source, universe_domain, use_mtls_endpoint ): @@ -505,17 +507,18 @@ def _compare_universes( Raises: ValueError: when client_universe does not match the universe in credentials. """ - if credentials: - credentials_universe = credentials.universe_domain - if client_universe != credentials_universe: - default_universe = StorageInsightsClient._DEFAULT_UNIVERSE - raise ValueError( - "The configured universe domain " - f"({client_universe}) does not match the universe domain " - f"found in the credentials ({credentials_universe}). " - "If you haven't configured the universe domain explicitly, " - f"`{default_universe}` is the default." - ) + + default_universe = StorageInsightsClient._DEFAULT_UNIVERSE + credentials_universe = getattr(credentials, "universe_domain", default_universe) + + if client_universe != credentials_universe: + raise ValueError( + "The configured universe domain " + f"({client_universe}) does not match the universe domain " + f"found in the credentials ({credentials_universe}). " + "If you haven't configured the universe domain explicitly, " + f"`{default_universe}` is the default." + ) return True def _validate_universe_domain(self): diff --git a/packages/google-cloud-storageinsights/samples/generated_samples/snippet_metadata_google.cloud.storageinsights.v1.json b/packages/google-cloud-storageinsights/samples/generated_samples/snippet_metadata_google.cloud.storageinsights.v1.json index 1f297dc2e889..7411c6d3c4bf 100644 --- a/packages/google-cloud-storageinsights/samples/generated_samples/snippet_metadata_google.cloud.storageinsights.v1.json +++ b/packages/google-cloud-storageinsights/samples/generated_samples/snippet_metadata_google.cloud.storageinsights.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-storageinsights", - "version": "0.1.5" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-storageinsights/setup.py b/packages/google-cloud-storageinsights/setup.py index ece461690d42..425e9940d701 100644 --- a/packages/google-cloud-storageinsights/setup.py +++ b/packages/google-cloud-storageinsights/setup.py @@ -42,6 +42,7 @@ dependencies = [ "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "google-auth >= 2.14.1, <3.0.0dev", "proto-plus >= 1.22.3, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-storageinsights/testing/constraints-3.7.txt b/packages/google-cloud-storageinsights/testing/constraints-3.7.txt index 185f7d366c2f..2c74b9860b39 100644 --- a/packages/google-cloud-storageinsights/testing/constraints-3.7.txt +++ b/packages/google-cloud-storageinsights/testing/constraints-3.7.txt @@ -5,5 +5,6 @@ # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.0 +google-auth==2.14.1 proto-plus==1.22.3 protobuf==3.19.5 diff --git a/packages/google-cloud-storageinsights/tests/unit/gapic/storageinsights_v1/test_storage_insights.py b/packages/google-cloud-storageinsights/tests/unit/gapic/storageinsights_v1/test_storage_insights.py index 7486fb964f59..11eaeeeee426 100644 --- a/packages/google-cloud-storageinsights/tests/unit/gapic/storageinsights_v1/test_storage_insights.py +++ b/packages/google-cloud-storageinsights/tests/unit/gapic/storageinsights_v1/test_storage_insights.py @@ -84,18 +84,6 @@ def modify_default_endpoint_template(client): ) -# Anonymous Credentials with universe domain property. If no universe domain is provided, then -# the default universe domain is "googleapis.com". -class _AnonymousCredentialsWithUniverseDomain(ga_credentials.AnonymousCredentials): - def __init__(self, universe_domain="googleapis.com"): - super(_AnonymousCredentialsWithUniverseDomain, self).__init__() - self._universe_domain = universe_domain - - @property - def universe_domain(self): - return self._universe_domain - - def test__get_default_mtls_endpoint(): api_endpoint = "example.googleapis.com" api_mtls_endpoint = "example.mtls.googleapis.com" @@ -322,7 +310,7 @@ def test__get_universe_domain(): ) def test__validate_universe_domain(client_class, transport_class, transport_name): client = client_class( - transport=transport_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + transport=transport_class(credentials=ga_credentials.AnonymousCredentials()) ) assert client._validate_universe_domain() == True @@ -349,42 +337,49 @@ def test__validate_universe_domain(client_class, transport_class, transport_name client = client_class(transport=transport) assert client._validate_universe_domain() == True - # Test the case when there is a universe mismatch from the credentials. - client = client_class( - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain( - universe_domain="foo.com" - ) - ) - ) - with pytest.raises(ValueError) as excinfo: - client._validate_universe_domain() - assert ( - str(excinfo.value) - == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." - ) - - # Test the case when there is a universe mismatch from the client. - # - # TODO: Make this test unconditional once the minimum supported version of - # google-api-core becomes 2.15.0 or higher. - api_core_major, api_core_minor, _ = [ - int(part) for part in api_core_version.__version__.split(".") + # TODO: This is needed to cater for older versions of google-auth + # Make this test unconditional once the minimum supported version of + # google-auth becomes 2.23.0 or higher. + google_auth_major, google_auth_minor, _ = [ + int(part) for part in google.auth.__version__.split(".") ] - if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): - client = client_class( - client_options={"universe_domain": "bar.com"}, - transport=transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), - ), - ) + if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23): + credentials = ga_credentials.AnonymousCredentials() + credentials._universe_domain = "foo.com" + # Test the case when there is a universe mismatch from the credentials. + client = client_class(transport=transport_class(credentials=credentials)) with pytest.raises(ValueError) as excinfo: client._validate_universe_domain() assert ( str(excinfo.value) - == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + == "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." ) + # Test the case when there is a universe mismatch from the client. + # + # TODO: Make this test unconditional once the minimum supported version of + # google-api-core becomes 2.15.0 or higher. + api_core_major, api_core_minor, _ = [ + int(part) for part in api_core_version.__version__.split(".") + ] + if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15): + client = client_class( + client_options={"universe_domain": "bar.com"}, + transport=transport_class( + credentials=ga_credentials.AnonymousCredentials(), + ), + ) + with pytest.raises(ValueError) as excinfo: + client._validate_universe_domain() + assert ( + str(excinfo.value) + == "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default." + ) + + # Test that ValueError is raised if universe_domain is provided via client options and credentials is None + with pytest.raises(ValueError): + client._compare_universes("foo.bar", None) + @pytest.mark.parametrize( "client_class,transport_name", @@ -397,7 +392,7 @@ def test__validate_universe_domain(client_class, transport_class, transport_name def test_storage_insights_client_from_service_account_info( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: @@ -451,7 +446,7 @@ def test_storage_insights_client_service_account_always_use_jwt( def test_storage_insights_client_from_service_account_file( client_class, transport_name ): - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: @@ -514,9 +509,7 @@ def test_storage_insights_client_client_options( ): # Check that if channel is provided we won't create a new one. with mock.patch.object(StorageInsightsClient, "get_transport_class") as gtc: - transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() @@ -935,20 +928,20 @@ def test_storage_insights_client_client_api_endpoint(client_class): ) client = client_class( client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert client.api_endpoint == api_override # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="never", # use the _DEFAULT_ENDPOINT_TEMPLATE populated with GDU as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == default_endpoint # If ClientOptions.api_endpoint is not set and GOOGLE_API_USE_MTLS_ENDPOINT="always", # use the DEFAULT_MTLS_ENDPOINT as the api endpoint. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - client = client_class(credentials=_AnonymousCredentialsWithUniverseDomain()) + client = client_class(credentials=ga_credentials.AnonymousCredentials()) assert client.api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT # If ClientOptions.api_endpoint is not set, GOOGLE_API_USE_MTLS_ENDPOINT="auto" (default), @@ -960,13 +953,11 @@ def test_storage_insights_client_client_api_endpoint(client_class): if universe_exists: options = client_options.ClientOptions(universe_domain=mock_universe) client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) else: client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == ( mock_endpoint if universe_exists else default_endpoint @@ -982,8 +973,7 @@ def test_storage_insights_client_client_api_endpoint(client_class): delattr(options, "universe_domain") with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): client = client_class( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) assert client.api_endpoint == default_endpoint @@ -1136,8 +1126,8 @@ def test_storage_insights_client_create_channel_credentials_file( ) as adc, mock.patch.object( grpc_helpers, "create_channel" ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() - file_creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() load_creds.return_value = (file_creds, None) adc.return_value = (creds, None) client = client_class(client_options=options, transport=transport_name) @@ -1166,7 +1156,7 @@ def test_storage_insights_client_create_channel_credentials_file( ) def test_list_report_configs(request_type, transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1200,7 +1190,7 @@ def test_list_report_configs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1220,7 +1210,7 @@ async def test_list_report_configs_async( request_type=storageinsights.ListReportConfigsRequest, ): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1259,7 +1249,7 @@ async def test_list_report_configs_async_from_dict(): def test_list_report_configs_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1291,7 +1281,7 @@ def test_list_report_configs_field_headers(): @pytest.mark.asyncio async def test_list_report_configs_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1324,7 +1314,7 @@ async def test_list_report_configs_field_headers_async(): def test_list_report_configs_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1350,7 +1340,7 @@ def test_list_report_configs_flattened(): def test_list_report_configs_flattened_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1365,7 +1355,7 @@ def test_list_report_configs_flattened_error(): @pytest.mark.asyncio async def test_list_report_configs_flattened_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1396,7 +1386,7 @@ async def test_list_report_configs_flattened_async(): @pytest.mark.asyncio async def test_list_report_configs_flattened_error_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1410,7 +1400,7 @@ async def test_list_report_configs_flattened_error_async(): def test_list_report_configs_pager(transport_name: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1462,7 +1452,7 @@ def test_list_report_configs_pager(transport_name: str = "grpc"): def test_list_report_configs_pages(transport_name: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -1506,7 +1496,7 @@ def test_list_report_configs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_report_configs_async_pager(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1558,7 +1548,7 @@ async def test_list_report_configs_async_pager(): @pytest.mark.asyncio async def test_list_report_configs_async_pages(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1615,7 +1605,7 @@ async def test_list_report_configs_async_pages(): ) def test_get_report_config(request_type, transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1649,7 +1639,7 @@ def test_get_report_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1668,7 +1658,7 @@ async def test_get_report_config_async( transport: str = "grpc_asyncio", request_type=storageinsights.GetReportConfigRequest ): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1707,7 +1697,7 @@ async def test_get_report_config_async_from_dict(): def test_get_report_config_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1739,7 +1729,7 @@ def test_get_report_config_field_headers(): @pytest.mark.asyncio async def test_get_report_config_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1772,7 +1762,7 @@ async def test_get_report_config_field_headers_async(): def test_get_report_config_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1798,7 +1788,7 @@ def test_get_report_config_flattened(): def test_get_report_config_flattened_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1813,7 +1803,7 @@ def test_get_report_config_flattened_error(): @pytest.mark.asyncio async def test_get_report_config_flattened_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1844,7 +1834,7 @@ async def test_get_report_config_flattened_async(): @pytest.mark.asyncio async def test_get_report_config_flattened_error_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -1865,7 +1855,7 @@ async def test_get_report_config_flattened_error_async(): ) def test_create_report_config(request_type, transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1899,7 +1889,7 @@ def test_create_report_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -1919,7 +1909,7 @@ async def test_create_report_config_async( request_type=storageinsights.CreateReportConfigRequest, ): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1958,7 +1948,7 @@ async def test_create_report_config_async_from_dict(): def test_create_report_config_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -1990,7 +1980,7 @@ def test_create_report_config_field_headers(): @pytest.mark.asyncio async def test_create_report_config_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2023,7 +2013,7 @@ async def test_create_report_config_field_headers_async(): def test_create_report_config_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2053,7 +2043,7 @@ def test_create_report_config_flattened(): def test_create_report_config_flattened_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2069,7 +2059,7 @@ def test_create_report_config_flattened_error(): @pytest.mark.asyncio async def test_create_report_config_flattened_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2104,7 +2094,7 @@ async def test_create_report_config_flattened_async(): @pytest.mark.asyncio async def test_create_report_config_flattened_error_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2126,7 +2116,7 @@ async def test_create_report_config_flattened_error_async(): ) def test_update_report_config(request_type, transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2160,7 +2150,7 @@ def test_update_report_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2180,7 +2170,7 @@ async def test_update_report_config_async( request_type=storageinsights.UpdateReportConfigRequest, ): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2219,7 +2209,7 @@ async def test_update_report_config_async_from_dict(): def test_update_report_config_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2251,7 +2241,7 @@ def test_update_report_config_field_headers(): @pytest.mark.asyncio async def test_update_report_config_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2284,7 +2274,7 @@ async def test_update_report_config_field_headers_async(): def test_update_report_config_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2314,7 +2304,7 @@ def test_update_report_config_flattened(): def test_update_report_config_flattened_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2330,7 +2320,7 @@ def test_update_report_config_flattened_error(): @pytest.mark.asyncio async def test_update_report_config_flattened_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2365,7 +2355,7 @@ async def test_update_report_config_flattened_async(): @pytest.mark.asyncio async def test_update_report_config_flattened_error_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2387,7 +2377,7 @@ async def test_update_report_config_flattened_error_async(): ) def test_delete_report_config(request_type, transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2416,7 +2406,7 @@ def test_delete_report_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2436,7 +2426,7 @@ async def test_delete_report_config_async( request_type=storageinsights.DeleteReportConfigRequest, ): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2468,7 +2458,7 @@ async def test_delete_report_config_async_from_dict(): def test_delete_report_config_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2500,7 +2490,7 @@ def test_delete_report_config_field_headers(): @pytest.mark.asyncio async def test_delete_report_config_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2531,7 +2521,7 @@ async def test_delete_report_config_field_headers_async(): def test_delete_report_config_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2557,7 +2547,7 @@ def test_delete_report_config_flattened(): def test_delete_report_config_flattened_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2572,7 +2562,7 @@ def test_delete_report_config_flattened_error(): @pytest.mark.asyncio async def test_delete_report_config_flattened_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2601,7 +2591,7 @@ async def test_delete_report_config_flattened_async(): @pytest.mark.asyncio async def test_delete_report_config_flattened_error_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2622,7 +2612,7 @@ async def test_delete_report_config_flattened_error_async(): ) def test_list_report_details(request_type, transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2656,7 +2646,7 @@ def test_list_report_details_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -2676,7 +2666,7 @@ async def test_list_report_details_async( request_type=storageinsights.ListReportDetailsRequest, ): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2715,7 +2705,7 @@ async def test_list_report_details_async_from_dict(): def test_list_report_details_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2747,7 +2737,7 @@ def test_list_report_details_field_headers(): @pytest.mark.asyncio async def test_list_report_details_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -2780,7 +2770,7 @@ async def test_list_report_details_field_headers_async(): def test_list_report_details_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2806,7 +2796,7 @@ def test_list_report_details_flattened(): def test_list_report_details_flattened_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2821,7 +2811,7 @@ def test_list_report_details_flattened_error(): @pytest.mark.asyncio async def test_list_report_details_flattened_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2852,7 +2842,7 @@ async def test_list_report_details_flattened_async(): @pytest.mark.asyncio async def test_list_report_details_flattened_error_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -2866,7 +2856,7 @@ async def test_list_report_details_flattened_error_async(): def test_list_report_details_pager(transport_name: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2918,7 +2908,7 @@ def test_list_report_details_pager(transport_name: str = "grpc"): def test_list_report_details_pages(transport_name: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport_name, ) @@ -2962,7 +2952,7 @@ def test_list_report_details_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_report_details_async_pager(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3014,7 +3004,7 @@ async def test_list_report_details_async_pager(): @pytest.mark.asyncio async def test_list_report_details_async_pages(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3071,7 +3061,7 @@ async def test_list_report_details_async_pages(): ) def test_get_report_detail(request_type, transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3107,7 +3097,7 @@ def test_get_report_detail_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) @@ -3126,7 +3116,7 @@ async def test_get_report_detail_async( transport: str = "grpc_asyncio", request_type=storageinsights.GetReportDetailRequest ): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3167,7 +3157,7 @@ async def test_get_report_detail_async_from_dict(): def test_get_report_detail_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3199,7 +3189,7 @@ def test_get_report_detail_field_headers(): @pytest.mark.asyncio async def test_get_report_detail_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -3232,7 +3222,7 @@ async def test_get_report_detail_field_headers_async(): def test_get_report_detail_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3258,7 +3248,7 @@ def test_get_report_detail_flattened(): def test_get_report_detail_flattened_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3273,7 +3263,7 @@ def test_get_report_detail_flattened_error(): @pytest.mark.asyncio async def test_get_report_detail_flattened_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3304,7 +3294,7 @@ async def test_get_report_detail_flattened_async(): @pytest.mark.asyncio async def test_get_report_detail_flattened_error_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Attempting to call a method with both a request object and flattened @@ -3325,7 +3315,7 @@ async def test_get_report_detail_flattened_error_async(): ) def test_list_report_configs_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3378,7 +3368,7 @@ def test_list_report_configs_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_report_configs._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3387,7 +3377,7 @@ def test_list_report_configs_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_report_configs._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -3405,7 +3395,7 @@ def test_list_report_configs_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3447,7 +3437,7 @@ def test_list_report_configs_rest_required_fields( def test_list_report_configs_rest_unset_required_fields(): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_report_configs._get_unset_required_fields({}) @@ -3467,7 +3457,7 @@ def test_list_report_configs_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_report_configs_rest_interceptors(null_interceptor): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageInsightsRestInterceptor(), @@ -3525,7 +3515,7 @@ def test_list_report_configs_rest_bad_request( transport: str = "rest", request_type=storageinsights.ListReportConfigsRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3547,7 +3537,7 @@ def test_list_report_configs_rest_bad_request( def test_list_report_configs_rest_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3589,7 +3579,7 @@ def test_list_report_configs_rest_flattened(): def test_list_report_configs_rest_flattened_error(transport: str = "rest"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3604,7 +3594,7 @@ def test_list_report_configs_rest_flattened_error(transport: str = "rest"): def test_list_report_configs_rest_pager(transport: str = "rest"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3674,7 +3664,7 @@ def test_list_report_configs_rest_pager(transport: str = "rest"): ) def test_get_report_config_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3727,7 +3717,7 @@ def test_get_report_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_report_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3736,7 +3726,7 @@ def test_get_report_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_report_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -3745,7 +3735,7 @@ def test_get_report_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -3787,7 +3777,7 @@ def test_get_report_config_rest_required_fields( def test_get_report_config_rest_unset_required_fields(): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_report_config._get_unset_required_fields({}) @@ -3797,7 +3787,7 @@ def test_get_report_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_report_config_rest_interceptors(null_interceptor): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageInsightsRestInterceptor(), @@ -3855,7 +3845,7 @@ def test_get_report_config_rest_bad_request( transport: str = "rest", request_type=storageinsights.GetReportConfigRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3877,7 +3867,7 @@ def test_get_report_config_rest_bad_request( def test_get_report_config_rest_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -3921,7 +3911,7 @@ def test_get_report_config_rest_flattened(): def test_get_report_config_rest_flattened_error(transport: str = "rest"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3936,7 +3926,7 @@ def test_get_report_config_rest_flattened_error(transport: str = "rest"): def test_get_report_config_rest_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -3949,7 +3939,7 @@ def test_get_report_config_rest_error(): ) def test_create_report_config_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4095,7 +4085,7 @@ def test_create_report_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_report_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4104,7 +4094,7 @@ def test_create_report_config_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).create_report_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("request_id",)) @@ -4115,7 +4105,7 @@ def test_create_report_config_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4158,7 +4148,7 @@ def test_create_report_config_rest_required_fields( def test_create_report_config_rest_unset_required_fields(): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.create_report_config._get_unset_required_fields({}) @@ -4176,7 +4166,7 @@ def test_create_report_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_create_report_config_rest_interceptors(null_interceptor): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageInsightsRestInterceptor(), @@ -4234,7 +4224,7 @@ def test_create_report_config_rest_bad_request( transport: str = "rest", request_type=storageinsights.CreateReportConfigRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4256,7 +4246,7 @@ def test_create_report_config_rest_bad_request( def test_create_report_config_rest_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4299,7 +4289,7 @@ def test_create_report_config_rest_flattened(): def test_create_report_config_rest_flattened_error(transport: str = "rest"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4315,7 +4305,7 @@ def test_create_report_config_rest_flattened_error(transport: str = "rest"): def test_create_report_config_rest_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4328,7 +4318,7 @@ def test_create_report_config_rest_error(): ) def test_update_report_config_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4477,14 +4467,14 @@ def test_update_report_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_report_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).update_report_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4498,7 +4488,7 @@ def test_update_report_config_rest_required_fields( # verify required fields with non-default values are left alone client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4541,7 +4531,7 @@ def test_update_report_config_rest_required_fields( def test_update_report_config_rest_unset_required_fields(): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.update_report_config._get_unset_required_fields({}) @@ -4564,7 +4554,7 @@ def test_update_report_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_update_report_config_rest_interceptors(null_interceptor): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageInsightsRestInterceptor(), @@ -4622,7 +4612,7 @@ def test_update_report_config_rest_bad_request( transport: str = "rest", request_type=storageinsights.UpdateReportConfigRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4648,7 +4638,7 @@ def test_update_report_config_rest_bad_request( def test_update_report_config_rest_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4695,7 +4685,7 @@ def test_update_report_config_rest_flattened(): def test_update_report_config_rest_flattened_error(transport: str = "rest"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4711,7 +4701,7 @@ def test_update_report_config_rest_flattened_error(transport: str = "rest"): def test_update_report_config_rest_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4724,7 +4714,7 @@ def test_update_report_config_rest_error(): ) def test_delete_report_config_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4770,7 +4760,7 @@ def test_delete_report_config_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_report_config._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -4779,7 +4769,7 @@ def test_delete_report_config_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).delete_report_config._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -4795,7 +4785,7 @@ def test_delete_report_config_rest_required_fields( assert jsonified_request["name"] == "name_value" client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -4834,7 +4824,7 @@ def test_delete_report_config_rest_required_fields( def test_delete_report_config_rest_unset_required_fields(): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.delete_report_config._get_unset_required_fields({}) @@ -4852,7 +4842,7 @@ def test_delete_report_config_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_delete_report_config_rest_interceptors(null_interceptor): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageInsightsRestInterceptor(), @@ -4902,7 +4892,7 @@ def test_delete_report_config_rest_bad_request( transport: str = "rest", request_type=storageinsights.DeleteReportConfigRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4924,7 +4914,7 @@ def test_delete_report_config_rest_bad_request( def test_delete_report_config_rest_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -4966,7 +4956,7 @@ def test_delete_report_config_rest_flattened(): def test_delete_report_config_rest_flattened_error(transport: str = "rest"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4981,7 +4971,7 @@ def test_delete_report_config_rest_flattened_error(transport: str = "rest"): def test_delete_report_config_rest_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -4994,7 +4984,7 @@ def test_delete_report_config_rest_error(): ) def test_list_report_details_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5049,7 +5039,7 @@ def test_list_report_details_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_report_details._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5058,7 +5048,7 @@ def test_list_report_details_rest_required_fields( jsonified_request["parent"] = "parent_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).list_report_details._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( @@ -5076,7 +5066,7 @@ def test_list_report_details_rest_required_fields( assert jsonified_request["parent"] == "parent_value" client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5118,7 +5108,7 @@ def test_list_report_details_rest_required_fields( def test_list_report_details_rest_unset_required_fields(): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.list_report_details._get_unset_required_fields({}) @@ -5138,7 +5128,7 @@ def test_list_report_details_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_list_report_details_rest_interceptors(null_interceptor): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageInsightsRestInterceptor(), @@ -5196,7 +5186,7 @@ def test_list_report_details_rest_bad_request( transport: str = "rest", request_type=storageinsights.ListReportDetailsRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5220,7 +5210,7 @@ def test_list_report_details_rest_bad_request( def test_list_report_details_rest_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5264,7 +5254,7 @@ def test_list_report_details_rest_flattened(): def test_list_report_details_rest_flattened_error(transport: str = "rest"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5279,7 +5269,7 @@ def test_list_report_details_rest_flattened_error(transport: str = "rest"): def test_list_report_details_rest_pager(transport: str = "rest"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5351,7 +5341,7 @@ def test_list_report_details_rest_pager(transport: str = "rest"): ) def test_get_report_detail_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5408,7 +5398,7 @@ def test_get_report_detail_rest_required_fields( # verify fields with default values are dropped unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_report_detail._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5417,7 +5407,7 @@ def test_get_report_detail_rest_required_fields( jsonified_request["name"] = "name_value" unset_fields = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ).get_report_detail._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) @@ -5426,7 +5416,7 @@ def test_get_report_detail_rest_required_fields( assert jsonified_request["name"] == "name_value" client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request = request_type(**request_init) @@ -5468,7 +5458,7 @@ def test_get_report_detail_rest_required_fields( def test_get_report_detail_rest_unset_required_fields(): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain + credentials=ga_credentials.AnonymousCredentials ) unset_fields = transport.get_report_detail._get_unset_required_fields({}) @@ -5478,7 +5468,7 @@ def test_get_report_detail_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) def test_get_report_detail_rest_interceptors(null_interceptor): transport = transports.StorageInsightsRestTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), interceptor=None if null_interceptor else transports.StorageInsightsRestInterceptor(), @@ -5536,7 +5526,7 @@ def test_get_report_detail_rest_bad_request( transport: str = "rest", request_type=storageinsights.GetReportDetailRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5560,7 +5550,7 @@ def test_get_report_detail_rest_bad_request( def test_get_report_detail_rest_flattened(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) @@ -5604,7 +5594,7 @@ def test_get_report_detail_rest_flattened(): def test_get_report_detail_rest_flattened_error(transport: str = "rest"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5619,24 +5609,24 @@ def test_get_report_detail_rest_flattened_error(transport: str = "rest"): def test_get_report_detail_rest_error(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.StorageInsightsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) # It is an error to provide a credentials file and a transport instance. transport = transports.StorageInsightsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = StorageInsightsClient( @@ -5646,7 +5636,7 @@ def test_credentials_transport_error(): # It is an error to provide an api_key and a transport instance. transport = transports.StorageInsightsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) options = client_options.ClientOptions() options.api_key = "api_key" @@ -5661,13 +5651,12 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = StorageInsightsClient( - client_options=options, - credentials=_AnonymousCredentialsWithUniverseDomain(), + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. transport = transports.StorageInsightsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = StorageInsightsClient( @@ -5679,7 +5668,7 @@ def test_credentials_transport_error(): def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.StorageInsightsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) client = StorageInsightsClient(transport=transport) assert client.transport is transport @@ -5688,13 +5677,13 @@ def test_transport_instance(): def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.StorageInsightsGrpcTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel transport = transports.StorageInsightsGrpcAsyncIOTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) channel = transport.grpc_channel assert channel @@ -5711,7 +5700,7 @@ def test_transport_get_channel(): def test_transport_adc(transport_class): # Test default credentials are used if not provided. with mock.patch.object(google.auth, "default") as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() @@ -5725,7 +5714,7 @@ def test_transport_adc(transport_class): ) def test_transport_kind(transport_name): transport = StorageInsightsClient.get_transport_class(transport_name)( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name @@ -5733,7 +5722,7 @@ def test_transport_kind(transport_name): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( client.transport, @@ -5745,7 +5734,7 @@ def test_storage_insights_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.StorageInsightsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), credentials_file="credentials.json", ) @@ -5757,7 +5746,7 @@ def test_storage_insights_base_transport(): ) as Transport: Transport.return_value = None transport = transports.StorageInsightsTransport( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Every method on the transport should just blindly @@ -5801,7 +5790,7 @@ def test_storage_insights_base_transport_with_credentials_file(): "google.cloud.storageinsights_v1.services.storage_insights.transports.StorageInsightsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - load_creds.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.StorageInsightsTransport( credentials_file="credentials.json", quota_project_id="octopus", @@ -5820,7 +5809,7 @@ def test_storage_insights_base_transport_with_adc(): "google.cloud.storageinsights_v1.services.storage_insights.transports.StorageInsightsTransport._prep_wrapped_messages" ) as Transport: Transport.return_value = None - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.StorageInsightsTransport() adc.assert_called_once() @@ -5828,7 +5817,7 @@ def test_storage_insights_base_transport_with_adc(): def test_storage_insights_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) StorageInsightsClient() adc.assert_called_once_with( scopes=None, @@ -5848,7 +5837,7 @@ def test_storage_insights_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (_AnonymousCredentialsWithUniverseDomain(), None) + adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], @@ -5895,7 +5884,7 @@ def test_storage_insights_transport_create_channel(transport_class, grpc_helpers ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: - creds = _AnonymousCredentialsWithUniverseDomain() + creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) @@ -5923,7 +5912,7 @@ def test_storage_insights_transport_create_channel(transport_class, grpc_helpers ], ) def test_storage_insights_grpc_transport_client_cert_source_for_mtls(transport_class): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() # Check ssl_channel_credentials is used if provided. with mock.patch.object(transport_class, "create_channel") as mock_create_channel: @@ -5961,7 +5950,7 @@ def test_storage_insights_grpc_transport_client_cert_source_for_mtls(transport_c def test_storage_insights_http_transport_client_cert_source_for_mtls(): - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with mock.patch( "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" ) as mock_configure_mtls_channel: @@ -5981,7 +5970,7 @@ def test_storage_insights_http_transport_client_cert_source_for_mtls(): ) def test_storage_insights_host_no_port(transport_name): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="storageinsights.googleapis.com" ), @@ -6004,7 +5993,7 @@ def test_storage_insights_host_no_port(transport_name): ) def test_storage_insights_host_with_port(transport_name): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="storageinsights.googleapis.com:8000" ), @@ -6024,8 +6013,8 @@ def test_storage_insights_host_with_port(transport_name): ], ) def test_storage_insights_client_transport_session_collision(transport_name): - creds1 = _AnonymousCredentialsWithUniverseDomain() - creds2 = _AnonymousCredentialsWithUniverseDomain() + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() client1 = StorageInsightsClient( credentials=creds1, transport=transport_name, @@ -6107,7 +6096,7 @@ def test_storage_insights_transport_channel_mtls_with_client_cert_source( mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel - cred = _AnonymousCredentialsWithUniverseDomain() + cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) @@ -6352,7 +6341,7 @@ def test_client_with_default_client_info(): transports.StorageInsightsTransport, "_prep_wrapped_messages" ) as prep: client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6362,7 +6351,7 @@ def test_client_with_default_client_info(): ) as prep: transport_class = StorageInsightsClient.get_transport_class() transport = transport_class( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6371,7 +6360,7 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) with mock.patch.object( @@ -6386,7 +6375,7 @@ def test_get_location_rest_bad_request( transport: str = "rest", request_type=locations_pb2.GetLocationRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6416,7 +6405,7 @@ def test_get_location_rest_bad_request( ) def test_get_location_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -6444,7 +6433,7 @@ def test_list_locations_rest_bad_request( transport: str = "rest", request_type=locations_pb2.ListLocationsRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6472,7 +6461,7 @@ def test_list_locations_rest_bad_request( ) def test_list_locations_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1"} @@ -6500,7 +6489,7 @@ def test_cancel_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.CancelOperationRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6530,7 +6519,7 @@ def test_cancel_operation_rest_bad_request( ) def test_cancel_operation_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6558,7 +6547,7 @@ def test_delete_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.DeleteOperationRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6588,7 +6577,7 @@ def test_delete_operation_rest_bad_request( ) def test_delete_operation_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6616,7 +6605,7 @@ def test_get_operation_rest_bad_request( transport: str = "rest", request_type=operations_pb2.GetOperationRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6646,7 +6635,7 @@ def test_get_operation_rest_bad_request( ) def test_get_operation_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2/operations/sample3"} @@ -6674,7 +6663,7 @@ def test_list_operations_rest_bad_request( transport: str = "rest", request_type=operations_pb2.ListOperationsRequest ): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6704,7 +6693,7 @@ def test_list_operations_rest_bad_request( ) def test_list_operations_rest(request_type): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) request_init = {"name": "projects/sample1/locations/sample2"} @@ -6730,7 +6719,7 @@ def test_list_operations_rest(request_type): def test_delete_operation(transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6755,7 +6744,7 @@ def test_delete_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6779,7 +6768,7 @@ async def test_delete_operation_async(transport: str = "grpc_asyncio"): def test_delete_operation_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6808,7 +6797,7 @@ def test_delete_operation_field_headers(): @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6835,7 +6824,7 @@ async def test_delete_operation_field_headers_async(): def test_delete_operation_from_dict(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -6853,7 +6842,7 @@ def test_delete_operation_from_dict(): @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: @@ -6869,7 +6858,7 @@ async def test_delete_operation_from_dict_async(): def test_cancel_operation(transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6894,7 +6883,7 @@ def test_cancel_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_cancel_operation_async(transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6918,7 +6907,7 @@ async def test_cancel_operation_async(transport: str = "grpc_asyncio"): def test_cancel_operation_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6947,7 +6936,7 @@ def test_cancel_operation_field_headers(): @pytest.mark.asyncio async def test_cancel_operation_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -6974,7 +6963,7 @@ async def test_cancel_operation_field_headers_async(): def test_cancel_operation_from_dict(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -6992,7 +6981,7 @@ def test_cancel_operation_from_dict(): @pytest.mark.asyncio async def test_cancel_operation_from_dict_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: @@ -7008,7 +6997,7 @@ async def test_cancel_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7033,7 +7022,7 @@ def test_get_operation(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7059,7 +7048,7 @@ async def test_get_operation_async(transport: str = "grpc_asyncio"): def test_get_operation_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7088,7 +7077,7 @@ def test_get_operation_field_headers(): @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7117,7 +7106,7 @@ async def test_get_operation_field_headers_async(): def test_get_operation_from_dict(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7135,7 +7124,7 @@ def test_get_operation_from_dict(): @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_operation), "__call__") as call: @@ -7153,7 +7142,7 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7178,7 +7167,7 @@ def test_list_operations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7204,7 +7193,7 @@ async def test_list_operations_async(transport: str = "grpc_asyncio"): def test_list_operations_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7233,7 +7222,7 @@ def test_list_operations_field_headers(): @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7262,7 +7251,7 @@ async def test_list_operations_field_headers_async(): def test_list_operations_from_dict(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7280,7 +7269,7 @@ def test_list_operations_from_dict(): @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_operations), "__call__") as call: @@ -7298,7 +7287,7 @@ async def test_list_operations_from_dict_async(): def test_list_locations(transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7323,7 +7312,7 @@ def test_list_locations(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_locations_async(transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7349,7 +7338,7 @@ async def test_list_locations_async(transport: str = "grpc_asyncio"): def test_list_locations_field_headers(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7378,7 +7367,7 @@ def test_list_locations_field_headers(): @pytest.mark.asyncio async def test_list_locations_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7407,7 +7396,7 @@ async def test_list_locations_field_headers_async(): def test_list_locations_from_dict(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -7425,7 +7414,7 @@ def test_list_locations_from_dict(): @pytest.mark.asyncio async def test_list_locations_from_dict_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -7443,7 +7432,7 @@ async def test_list_locations_from_dict_async(): def test_get_location(transport: str = "grpc"): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7468,7 +7457,7 @@ def test_get_location(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_location_async(transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7493,9 +7482,7 @@ async def test_get_location_async(transport: str = "grpc_asyncio"): def test_get_location_field_headers(): - client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain() - ) + client = StorageInsightsClient(credentials=ga_credentials.AnonymousCredentials()) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -7523,7 +7510,7 @@ def test_get_location_field_headers(): @pytest.mark.asyncio async def test_get_location_field_headers_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain() + credentials=ga_credentials.AnonymousCredentials() ) # Any value that is part of the HTTP/1.1 URI should be sent as @@ -7552,7 +7539,7 @@ async def test_get_location_field_headers_async(): def test_get_location_from_dict(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -7570,7 +7557,7 @@ def test_get_location_from_dict(): @pytest.mark.asyncio async def test_get_location_from_dict_async(): client = StorageInsightsAsyncClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_locations), "__call__") as call: @@ -7594,7 +7581,7 @@ def test_transport_close(): for transport, close_name in transports.items(): client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) with mock.patch.object( type(getattr(client.transport, close_name)), "close" @@ -7611,7 +7598,7 @@ def test_client_ctx(): ] for transport in transports: client = StorageInsightsClient( - credentials=_AnonymousCredentialsWithUniverseDomain(), transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: