diff --git a/google/cloud/orchestration/airflow/service_v1/services/environments/transports/base.py b/google/cloud/orchestration/airflow/service_v1/services/environments/transports/base.py index d6c581c..3d67004 100644 --- a/google/cloud/orchestration/airflow/service_v1/services/environments/transports/base.py +++ b/google/cloud/orchestration/airflow/service_v1/services/environments/transports/base.py @@ -103,7 +103,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/base.py b/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/base.py index bab4283..576c2fe 100644 --- a/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/base.py +++ b/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/base.py @@ -101,7 +101,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/base.py b/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/base.py index 219753c..81e6e30 100644 --- a/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/base.py +++ b/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/base.py @@ -103,7 +103,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/base.py b/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/base.py index 55d4d3c..0e468e7 100644 --- a/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/base.py +++ b/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/base.py @@ -101,7 +101,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/tests/unit/gapic/service_v1/test_environments.py b/tests/unit/gapic/service_v1/test_environments.py index 4d3e011..ddad466 100644 --- a/tests/unit/gapic/service_v1/test_environments.py +++ b/tests/unit/gapic/service_v1/test_environments.py @@ -250,20 +250,20 @@ def test_environments_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -320,7 +320,7 @@ def test_environments_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -415,7 +415,7 @@ def test_environments_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -446,7 +446,7 @@ def test_environments_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -477,9 +477,8 @@ def test_environments_client_client_options_from_dict(): ) -def test_create_environment( - transport: str = "grpc", request_type=environments.CreateEnvironmentRequest -): +@pytest.mark.parametrize("request_type", [environments.CreateEnvironmentRequest, dict,]) +def test_create_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -505,10 +504,6 @@ def test_create_environment( assert isinstance(response, future.Future) -def test_create_environment_from_dict(): - test_create_environment(request_type=dict) - - def test_create_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. @@ -705,9 +700,8 @@ async def test_create_environment_flattened_error_async(): ) -def test_get_environment( - transport: str = "grpc", request_type=environments.GetEnvironmentRequest -): +@pytest.mark.parametrize("request_type", [environments.GetEnvironmentRequest, dict,]) +def test_get_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -738,10 +732,6 @@ def test_get_environment( assert response.state == environments.Environment.State.CREATING -def test_get_environment_from_dict(): - test_get_environment(request_type=dict) - - 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. @@ -917,9 +907,8 @@ async def test_get_environment_flattened_error_async(): ) -def test_list_environments( - transport: str = "grpc", request_type=environments.ListEnvironmentsRequest -): +@pytest.mark.parametrize("request_type", [environments.ListEnvironmentsRequest, dict,]) +def test_list_environments(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -948,10 +937,6 @@ def test_list_environments( assert response.next_page_token == "next_page_token_value" -def test_list_environments_from_dict(): - test_list_environments(request_type=dict) - - def test_list_environments_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1135,8 +1120,10 @@ async def test_list_environments_flattened_error_async(): ) -def test_list_environments_pager(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_environments_pager(transport_name: str = "grpc"): + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1177,8 +1164,10 @@ def test_list_environments_pager(): assert all(isinstance(i, environments.Environment) for i in results) -def test_list_environments_pages(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_environments_pages(transport_name: str = "grpc"): + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1289,9 +1278,8 @@ async def test_list_environments_async_pages(): assert page_.raw_page.next_page_token == token -def test_update_environment( - transport: str = "grpc", request_type=environments.UpdateEnvironmentRequest -): +@pytest.mark.parametrize("request_type", [environments.UpdateEnvironmentRequest, dict,]) +def test_update_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1317,10 +1305,6 @@ def test_update_environment( assert isinstance(response, future.Future) -def test_update_environment_from_dict(): - test_update_environment(request_type=dict) - - def test_update_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. @@ -1527,9 +1511,8 @@ async def test_update_environment_flattened_error_async(): ) -def test_delete_environment( - transport: str = "grpc", request_type=environments.DeleteEnvironmentRequest -): +@pytest.mark.parametrize("request_type", [environments.DeleteEnvironmentRequest, dict,]) +def test_delete_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1555,10 +1538,6 @@ def test_delete_environment( assert isinstance(response, future.Future) -def test_delete_environment_from_dict(): - test_delete_environment(request_type=dict) - - def test_delete_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. @@ -2277,7 +2256,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( diff --git a/tests/unit/gapic/service_v1/test_image_versions.py b/tests/unit/gapic/service_v1/test_image_versions.py index a502b91..83f293a 100644 --- a/tests/unit/gapic/service_v1/test_image_versions.py +++ b/tests/unit/gapic/service_v1/test_image_versions.py @@ -252,20 +252,20 @@ def test_image_versions_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -324,7 +324,7 @@ def test_image_versions_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -419,7 +419,7 @@ def test_image_versions_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -450,7 +450,7 @@ def test_image_versions_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -483,9 +483,10 @@ def test_image_versions_client_client_options_from_dict(): ) -def test_list_image_versions( - transport: str = "grpc", request_type=image_versions.ListImageVersionsRequest -): +@pytest.mark.parametrize( + "request_type", [image_versions.ListImageVersionsRequest, dict,] +) +def test_list_image_versions(request_type, transport: str = "grpc"): client = ImageVersionsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -514,10 +515,6 @@ def test_list_image_versions( assert response.next_page_token == "next_page_token_value" -def test_list_image_versions_from_dict(): - test_list_image_versions(request_type=dict) - - def test_list_image_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. @@ -708,8 +705,10 @@ async def test_list_image_versions_flattened_error_async(): ) -def test_list_image_versions_pager(): - client = ImageVersionsClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_image_versions_pager(transport_name: str = "grpc"): + client = ImageVersionsClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -753,8 +752,10 @@ def test_list_image_versions_pager(): assert all(isinstance(i, image_versions.ImageVersion) for i in results) -def test_list_image_versions_pages(): - client = ImageVersionsClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_image_versions_pages(transport_name: str = "grpc"): + client = ImageVersionsClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1360,7 +1361,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( diff --git a/tests/unit/gapic/service_v1beta1/test_environments.py b/tests/unit/gapic/service_v1beta1/test_environments.py index 6722d49..69cd39f 100644 --- a/tests/unit/gapic/service_v1beta1/test_environments.py +++ b/tests/unit/gapic/service_v1beta1/test_environments.py @@ -252,20 +252,20 @@ def test_environments_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -322,7 +322,7 @@ def test_environments_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -417,7 +417,7 @@ def test_environments_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -448,7 +448,7 @@ def test_environments_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -479,9 +479,8 @@ def test_environments_client_client_options_from_dict(): ) -def test_create_environment( - transport: str = "grpc", request_type=environments.CreateEnvironmentRequest -): +@pytest.mark.parametrize("request_type", [environments.CreateEnvironmentRequest, dict,]) +def test_create_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -507,10 +506,6 @@ def test_create_environment( assert isinstance(response, future.Future) -def test_create_environment_from_dict(): - test_create_environment(request_type=dict) - - def test_create_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. @@ -707,9 +702,8 @@ async def test_create_environment_flattened_error_async(): ) -def test_get_environment( - transport: str = "grpc", request_type=environments.GetEnvironmentRequest -): +@pytest.mark.parametrize("request_type", [environments.GetEnvironmentRequest, dict,]) +def test_get_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -740,10 +734,6 @@ def test_get_environment( assert response.state == environments.Environment.State.CREATING -def test_get_environment_from_dict(): - test_get_environment(request_type=dict) - - 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. @@ -919,9 +909,8 @@ async def test_get_environment_flattened_error_async(): ) -def test_list_environments( - transport: str = "grpc", request_type=environments.ListEnvironmentsRequest -): +@pytest.mark.parametrize("request_type", [environments.ListEnvironmentsRequest, dict,]) +def test_list_environments(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -950,10 +939,6 @@ def test_list_environments( assert response.next_page_token == "next_page_token_value" -def test_list_environments_from_dict(): - test_list_environments(request_type=dict) - - def test_list_environments_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1137,8 +1122,10 @@ async def test_list_environments_flattened_error_async(): ) -def test_list_environments_pager(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_environments_pager(transport_name: str = "grpc"): + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1179,8 +1166,10 @@ def test_list_environments_pager(): assert all(isinstance(i, environments.Environment) for i in results) -def test_list_environments_pages(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_environments_pages(transport_name: str = "grpc"): + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1291,9 +1280,8 @@ async def test_list_environments_async_pages(): assert page_.raw_page.next_page_token == token -def test_update_environment( - transport: str = "grpc", request_type=environments.UpdateEnvironmentRequest -): +@pytest.mark.parametrize("request_type", [environments.UpdateEnvironmentRequest, dict,]) +def test_update_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1319,10 +1307,6 @@ def test_update_environment( assert isinstance(response, future.Future) -def test_update_environment_from_dict(): - test_update_environment(request_type=dict) - - def test_update_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. @@ -1529,9 +1513,8 @@ async def test_update_environment_flattened_error_async(): ) -def test_delete_environment( - transport: str = "grpc", request_type=environments.DeleteEnvironmentRequest -): +@pytest.mark.parametrize("request_type", [environments.DeleteEnvironmentRequest, dict,]) +def test_delete_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1557,10 +1540,6 @@ def test_delete_environment( assert isinstance(response, future.Future) -def test_delete_environment_from_dict(): - test_delete_environment(request_type=dict) - - def test_delete_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. @@ -1741,9 +1720,8 @@ async def test_delete_environment_flattened_error_async(): ) -def test_restart_web_server( - transport: str = "grpc", request_type=environments.RestartWebServerRequest -): +@pytest.mark.parametrize("request_type", [environments.RestartWebServerRequest, dict,]) +def test_restart_web_server(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1769,10 +1747,6 @@ def test_restart_web_server( assert isinstance(response, future.Future) -def test_restart_web_server_from_dict(): - test_restart_web_server(request_type=dict) - - def test_restart_web_server_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1881,9 +1855,8 @@ async def test_restart_web_server_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_check_upgrade( - transport: str = "grpc", request_type=environments.CheckUpgradeRequest -): +@pytest.mark.parametrize("request_type", [environments.CheckUpgradeRequest, dict,]) +def test_check_upgrade(request_type, transport: str = "grpc"): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1907,10 +1880,6 @@ def test_check_upgrade( assert isinstance(response, future.Future) -def test_check_upgrade_from_dict(): - test_check_upgrade(request_type=dict) - - def test_check_upgrade_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2551,7 +2520,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( diff --git a/tests/unit/gapic/service_v1beta1/test_image_versions.py b/tests/unit/gapic/service_v1beta1/test_image_versions.py index 870856c..89044f4 100644 --- a/tests/unit/gapic/service_v1beta1/test_image_versions.py +++ b/tests/unit/gapic/service_v1beta1/test_image_versions.py @@ -254,20 +254,20 @@ def test_image_versions_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -326,7 +326,7 @@ def test_image_versions_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -421,7 +421,7 @@ def test_image_versions_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -452,7 +452,7 @@ def test_image_versions_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -485,9 +485,10 @@ def test_image_versions_client_client_options_from_dict(): ) -def test_list_image_versions( - transport: str = "grpc", request_type=image_versions.ListImageVersionsRequest -): +@pytest.mark.parametrize( + "request_type", [image_versions.ListImageVersionsRequest, dict,] +) +def test_list_image_versions(request_type, transport: str = "grpc"): client = ImageVersionsClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -516,10 +517,6 @@ def test_list_image_versions( assert response.next_page_token == "next_page_token_value" -def test_list_image_versions_from_dict(): - test_list_image_versions(request_type=dict) - - def test_list_image_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. @@ -710,8 +707,10 @@ async def test_list_image_versions_flattened_error_async(): ) -def test_list_image_versions_pager(): - client = ImageVersionsClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_image_versions_pager(transport_name: str = "grpc"): + client = ImageVersionsClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -755,8 +754,10 @@ def test_list_image_versions_pager(): assert all(isinstance(i, image_versions.ImageVersion) for i in results) -def test_list_image_versions_pages(): - client = ImageVersionsClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_image_versions_pages(transport_name: str = "grpc"): + client = ImageVersionsClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1362,7 +1363,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object(