Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Jan 27, 2022
1 parent b2aee17 commit a61c9e7
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ def test_{{ service.client_name|snake_case }}_client_options_credentials_file(cl
always_use_jwt_access=True,
)

{% if 'grpc' in opts.transport %}
# test that the credentials from file are saved and used as the credentials.
with mock.patch.object(
google.auth, "load_credentials_from_file", autospec=True
Expand All @@ -412,7 +413,6 @@ def test_{{ service.client_name|snake_case }}_client_options_credentials_file(cl
create_channel.assert_called_with(
"{{ host }}{% if ":" not in service.host %}:443{% endif %}",
credentials=file_creds,
credentials_file=None,
quota_project_id=None,
default_scopes=(
{% for scope in service.oauth_scopes %}
Expand All @@ -427,6 +427,7 @@ def test_{{ service.client_name|snake_case }}_client_options_credentials_file(cl
],
)
{% endwith %}
{% endif %}
{% if 'grpc' in opts.transport %}
{# TODO(dovs): genericize this function#}

Expand Down Expand Up @@ -1707,7 +1708,6 @@ def test_{{ service.name|snake_case }}_transport_create_channel(transport_class,
create_channel.assert_called_with(
"{{ host }}{% if ":" not in service.host %}:443{% endif %}",
credentials=creds,
credentials_file=None,
quota_project_id="octopus",
default_scopes=(
{% for scope in service.oauth_scopes %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def test_{{ service.client_name|snake_case }}_client_options_scopes(client_class
({{ service.async_client_name }}, transports.{{ service.grpc_asyncio_transport_name }}, "grpc_asyncio", grpc_helpers_async),
{% endif %}
{% if 'rest' in opts.transport %}
({{ service.client_name }}, transports.{{ service.rest_transport_name }}, "rest"),
({{ service.client_name }}, transports.{{ service.rest_transport_name }}, "rest", ""),
{% endif %}
])
def test_{{ service.client_name|snake_case }}_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers):
Expand All @@ -476,6 +476,7 @@ def test_{{ service.client_name|snake_case }}_client_options_credentials_file(cl
always_use_jwt_access=True,
)

{% if 'grpc' in opts.transport %}
# test that the credentials from file are saved and used as the credentials.
with mock.patch.object(
google.auth, "load_credentials_from_file", autospec=True
Expand All @@ -493,7 +494,6 @@ def test_{{ service.client_name|snake_case }}_client_options_credentials_file(cl
create_channel.assert_called_with(
"{{ host }}{% if ":" not in service.host %}:443{% endif %}",
credentials=file_creds,
credentials_file=None,
quota_project_id=None,
default_scopes=(
{% for scope in service.oauth_scopes %}
Expand All @@ -508,6 +508,7 @@ def test_{{ service.client_name|snake_case }}_client_options_credentials_file(cl
],
)
{% endwith %}
{% endif %}
{% if 'grpc' in opts.transport %}
{# TODO(dovs): genericize this function#}

Expand Down Expand Up @@ -2138,7 +2139,6 @@ def test_{{ service.name|snake_case }}_transport_create_channel(transport_class,
create_channel.assert_called_with(
"{{ host }}{% if ":" not in service.host %}:443{% endif %}",
credentials=creds,
credentials_file=None,
quota_project_id="octopus",
default_scopes=(
{% for scope in service.oauth_scopes %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ def test_asset_service_client_client_options_credentials_file(client_class, tran
create_channel.assert_called_with(
"cloudasset.googleapis.com:443",
credentials=file_creds,
credentials_file=None,
quota_project_id=None,
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down Expand Up @@ -3784,7 +3783,6 @@ def test_asset_service_transport_create_channel(transport_class, grpc_helpers):
create_channel.assert_called_with(
"cloudasset.googleapis.com:443",
credentials=creds,
credentials_file=None,
quota_project_id="octopus",
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ def test_iam_credentials_client_client_options_credentials_file(client_class, tr
create_channel.assert_called_with(
"iamcredentials.googleapis.com:443",
credentials=file_creds,
credentials_file=None,
quota_project_id=None,
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down Expand Up @@ -1714,7 +1713,6 @@ def test_iam_credentials_transport_create_channel(transport_class, grpc_helpers)
create_channel.assert_called_with(
"iamcredentials.googleapis.com:443",
credentials=creds,
credentials_file=None,
quota_project_id="octopus",
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ def test_config_service_v2_client_client_options_credentials_file(client_class,
create_channel.assert_called_with(
"logging.googleapis.com:443",
credentials=file_creds,
credentials_file=None,
quota_project_id=None,
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down Expand Up @@ -6173,7 +6172,6 @@ def test_config_service_v2_transport_create_channel(transport_class, grpc_helper
create_channel.assert_called_with(
"logging.googleapis.com:443",
credentials=creds,
credentials_file=None,
quota_project_id="octopus",
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ def test_logging_service_v2_client_client_options_credentials_file(client_class,
create_channel.assert_called_with(
"logging.googleapis.com:443",
credentials=file_creds,
credentials_file=None,
quota_project_id=None,
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down Expand Up @@ -2260,7 +2259,6 @@ def test_logging_service_v2_transport_create_channel(transport_class, grpc_helpe
create_channel.assert_called_with(
"logging.googleapis.com:443",
credentials=creds,
credentials_file=None,
quota_project_id="octopus",
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ def test_metrics_service_v2_client_client_options_credentials_file(client_class,
create_channel.assert_called_with(
"logging.googleapis.com:443",
credentials=file_creds,
credentials_file=None,
quota_project_id=None,
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down Expand Up @@ -2113,7 +2112,6 @@ def test_metrics_service_v2_transport_create_channel(transport_class, grpc_helpe
create_channel.assert_called_with(
"logging.googleapis.com:443",
credentials=creds,
credentials_file=None,
quota_project_id="octopus",
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ def test_cloud_redis_client_client_options_credentials_file(client_class, transp
create_channel.assert_called_with(
"redis.googleapis.com:443",
credentials=file_creds,
credentials_file=None,
quota_project_id=None,
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down Expand Up @@ -3109,7 +3108,6 @@ def test_cloud_redis_transport_create_channel(transport_class, grpc_helpers):
create_channel.assert_called_with(
"redis.googleapis.com:443",
credentials=creds,
credentials_file=None,
quota_project_id="octopus",
default_scopes=(
'https://www.googleapis.com/auth/cloud-platform',
Expand Down

0 comments on commit a61c9e7

Please sign in to comment.