Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit 24cf144

Browse files
chore: use gapic-generator-python 0.58.4 (#62)
- [ ] Regenerate this pull request now. fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: googleapis/googleapis@73da669 Source-Link: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9
1 parent 1f846f4 commit 24cf144

File tree

2 files changed

+19
-43
lines changed

2 files changed

+19
-43
lines changed

google/cloud/shell_v1/services/cloud_shell_service/transports/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def __init__(
101101
credentials, _ = google.auth.load_credentials_from_file(
102102
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
103103
)
104-
105104
elif credentials is None:
106105
credentials, _ = google.auth.default(
107106
**scopes_kwargs, quota_project_id=quota_project_id

tests/unit/gapic/shell_v1/test_cloud_shell_service.py

+19-42
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,20 @@ def test_cloud_shell_service_client_client_options(
253253
# unsupported value.
254254
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
255255
with pytest.raises(MutualTLSChannelError):
256-
client = client_class()
256+
client = client_class(transport=transport_name)
257257

258258
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
259259
with mock.patch.dict(
260260
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
261261
):
262262
with pytest.raises(ValueError):
263-
client = client_class()
263+
client = client_class(transport=transport_name)
264264

265265
# Check the case quota_project_id is provided
266266
options = client_options.ClientOptions(quota_project_id="octopus")
267267
with mock.patch.object(transport_class, "__init__") as patched:
268268
patched.return_value = None
269-
client = client_class(transport=transport_name, client_options=options)
269+
client = client_class(client_options=options, transport=transport_name)
270270
patched.assert_called_once_with(
271271
credentials=None,
272272
credentials_file=None,
@@ -335,7 +335,7 @@ def test_cloud_shell_service_client_mtls_env_auto(
335335
)
336336
with mock.patch.object(transport_class, "__init__") as patched:
337337
patched.return_value = None
338-
client = client_class(transport=transport_name, client_options=options)
338+
client = client_class(client_options=options, transport=transport_name)
339339

340340
if use_client_cert_env == "false":
341341
expected_client_cert_source = None
@@ -430,7 +430,7 @@ def test_cloud_shell_service_client_client_options_scopes(
430430
options = client_options.ClientOptions(scopes=["1", "2"],)
431431
with mock.patch.object(transport_class, "__init__") as patched:
432432
patched.return_value = None
433-
client = client_class(transport=transport_name, client_options=options)
433+
client = client_class(client_options=options, transport=transport_name)
434434
patched.assert_called_once_with(
435435
credentials=None,
436436
credentials_file=None,
@@ -461,7 +461,7 @@ def test_cloud_shell_service_client_client_options_credentials_file(
461461
options = client_options.ClientOptions(credentials_file="credentials.json")
462462
with mock.patch.object(transport_class, "__init__") as patched:
463463
patched.return_value = None
464-
client = client_class(transport=transport_name, client_options=options)
464+
client = client_class(client_options=options, transport=transport_name)
465465
patched.assert_called_once_with(
466466
credentials=None,
467467
credentials_file="credentials.json",
@@ -494,9 +494,8 @@ def test_cloud_shell_service_client_client_options_from_dict():
494494
)
495495

496496

497-
def test_get_environment(
498-
transport: str = "grpc", request_type=cloudshell.GetEnvironmentRequest
499-
):
497+
@pytest.mark.parametrize("request_type", [cloudshell.GetEnvironmentRequest, dict,])
498+
def test_get_environment(request_type, transport: str = "grpc"):
500499
client = CloudShellServiceClient(
501500
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
502501
)
@@ -539,10 +538,6 @@ def test_get_environment(
539538
assert response.public_keys == ["public_keys_value"]
540539

541540

542-
def test_get_environment_from_dict():
543-
test_get_environment(request_type=dict)
544-
545-
546541
def test_get_environment_empty_call():
547542
# This test is a coverage failsafe to make sure that totally empty calls,
548543
# i.e. request == None and no flattened fields passed, work.
@@ -736,9 +731,8 @@ async def test_get_environment_flattened_error_async():
736731
)
737732

738733

739-
def test_start_environment(
740-
transport: str = "grpc", request_type=cloudshell.StartEnvironmentRequest
741-
):
734+
@pytest.mark.parametrize("request_type", [cloudshell.StartEnvironmentRequest, dict,])
735+
def test_start_environment(request_type, transport: str = "grpc"):
742736
client = CloudShellServiceClient(
743737
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
744738
)
@@ -764,10 +758,6 @@ def test_start_environment(
764758
assert isinstance(response, future.Future)
765759

766760

767-
def test_start_environment_from_dict():
768-
test_start_environment(request_type=dict)
769-
770-
771761
def test_start_environment_empty_call():
772762
# This test is a coverage failsafe to make sure that totally empty calls,
773763
# i.e. request == None and no flattened fields passed, work.
@@ -878,9 +868,10 @@ async def test_start_environment_field_headers_async():
878868
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
879869

880870

881-
def test_authorize_environment(
882-
transport: str = "grpc", request_type=cloudshell.AuthorizeEnvironmentRequest
883-
):
871+
@pytest.mark.parametrize(
872+
"request_type", [cloudshell.AuthorizeEnvironmentRequest, dict,]
873+
)
874+
def test_authorize_environment(request_type, transport: str = "grpc"):
884875
client = CloudShellServiceClient(
885876
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
886877
)
@@ -906,10 +897,6 @@ def test_authorize_environment(
906897
assert isinstance(response, future.Future)
907898

908899

909-
def test_authorize_environment_from_dict():
910-
test_authorize_environment(request_type=dict)
911-
912-
913900
def test_authorize_environment_empty_call():
914901
# This test is a coverage failsafe to make sure that totally empty calls,
915902
# i.e. request == None and no flattened fields passed, work.
@@ -1020,9 +1007,8 @@ async def test_authorize_environment_field_headers_async():
10201007
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
10211008

10221009

1023-
def test_add_public_key(
1024-
transport: str = "grpc", request_type=cloudshell.AddPublicKeyRequest
1025-
):
1010+
@pytest.mark.parametrize("request_type", [cloudshell.AddPublicKeyRequest, dict,])
1011+
def test_add_public_key(request_type, transport: str = "grpc"):
10261012
client = CloudShellServiceClient(
10271013
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
10281014
)
@@ -1046,10 +1032,6 @@ def test_add_public_key(
10461032
assert isinstance(response, future.Future)
10471033

10481034

1049-
def test_add_public_key_from_dict():
1050-
test_add_public_key(request_type=dict)
1051-
1052-
10531035
def test_add_public_key_empty_call():
10541036
# This test is a coverage failsafe to make sure that totally empty calls,
10551037
# i.e. request == None and no flattened fields passed, work.
@@ -1152,9 +1134,8 @@ async def test_add_public_key_field_headers_async():
11521134
assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"]
11531135

11541136

1155-
def test_remove_public_key(
1156-
transport: str = "grpc", request_type=cloudshell.RemovePublicKeyRequest
1157-
):
1137+
@pytest.mark.parametrize("request_type", [cloudshell.RemovePublicKeyRequest, dict,])
1138+
def test_remove_public_key(request_type, transport: str = "grpc"):
11581139
client = CloudShellServiceClient(
11591140
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
11601141
)
@@ -1180,10 +1161,6 @@ def test_remove_public_key(
11801161
assert isinstance(response, future.Future)
11811162

11821163

1183-
def test_remove_public_key_from_dict():
1184-
test_remove_public_key(request_type=dict)
1185-
1186-
11871164
def test_remove_public_key_empty_call():
11881165
# This test is a coverage failsafe to make sure that totally empty calls,
11891166
# i.e. request == None and no flattened fields passed, work.
@@ -1843,7 +1820,7 @@ def test_parse_common_location_path():
18431820
assert expected == actual
18441821

18451822

1846-
def test_client_withDEFAULT_CLIENT_INFO():
1823+
def test_client_with_default_client_info():
18471824
client_info = gapic_v1.client_info.ClientInfo()
18481825

18491826
with mock.patch.object(

0 commit comments

Comments
 (0)