Skip to content

Commit 583cdd4

Browse files
chore: use gapic-generator-python 0.58.4 (#87)
* chore: use gapic-generator-python 0.58.4 fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: googleapis/googleapis@73da669 Source-Link: googleapis/googleapis-gen@46df624 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 83c3417 commit 583cdd4

File tree

2 files changed

+9
-15
lines changed
  • packages/google-cloud-policy-troubleshooter
    • google/cloud/policytroubleshooter_v1/services/iam_checker/transports
    • tests/unit/gapic/policytroubleshooter_v1

2 files changed

+9
-15
lines changed

packages/google-cloud-policy-troubleshooter/google/cloud/policytroubleshooter_v1/services/iam_checker/transports/base.py

Lines changed: 0 additions & 1 deletion
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

packages/google-cloud-policy-troubleshooter/tests/unit/gapic/policytroubleshooter_v1/test_iam_checker.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,20 @@ def test_iam_checker_client_client_options(
239239
# unsupported value.
240240
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
241241
with pytest.raises(MutualTLSChannelError):
242-
client = client_class()
242+
client = client_class(transport=transport_name)
243243

244244
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
245245
with mock.patch.dict(
246246
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
247247
):
248248
with pytest.raises(ValueError):
249-
client = client_class()
249+
client = client_class(transport=transport_name)
250250

251251
# Check the case quota_project_id is provided
252252
options = client_options.ClientOptions(quota_project_id="octopus")
253253
with mock.patch.object(transport_class, "__init__") as patched:
254254
patched.return_value = None
255-
client = client_class(transport=transport_name, client_options=options)
255+
client = client_class(client_options=options, transport=transport_name)
256256
patched.assert_called_once_with(
257257
credentials=None,
258258
credentials_file=None,
@@ -309,7 +309,7 @@ def test_iam_checker_client_mtls_env_auto(
309309
)
310310
with mock.patch.object(transport_class, "__init__") as patched:
311311
patched.return_value = None
312-
client = client_class(transport=transport_name, client_options=options)
312+
client = client_class(client_options=options, transport=transport_name)
313313

314314
if use_client_cert_env == "false":
315315
expected_client_cert_source = None
@@ -404,7 +404,7 @@ def test_iam_checker_client_client_options_scopes(
404404
options = client_options.ClientOptions(scopes=["1", "2"],)
405405
with mock.patch.object(transport_class, "__init__") as patched:
406406
patched.return_value = None
407-
client = client_class(transport=transport_name, client_options=options)
407+
client = client_class(client_options=options, transport=transport_name)
408408
patched.assert_called_once_with(
409409
credentials=None,
410410
credentials_file=None,
@@ -435,7 +435,7 @@ def test_iam_checker_client_client_options_credentials_file(
435435
options = client_options.ClientOptions(credentials_file="credentials.json")
436436
with mock.patch.object(transport_class, "__init__") as patched:
437437
patched.return_value = None
438-
client = client_class(transport=transport_name, client_options=options)
438+
client = client_class(client_options=options, transport=transport_name)
439439
patched.assert_called_once_with(
440440
credentials=None,
441441
credentials_file="credentials.json",
@@ -466,9 +466,8 @@ def test_iam_checker_client_client_options_from_dict():
466466
)
467467

468468

469-
def test_troubleshoot_iam_policy(
470-
transport: str = "grpc", request_type=checker.TroubleshootIamPolicyRequest
471-
):
469+
@pytest.mark.parametrize("request_type", [checker.TroubleshootIamPolicyRequest, dict,])
470+
def test_troubleshoot_iam_policy(request_type, transport: str = "grpc"):
472471
client = IamCheckerClient(
473472
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
474473
)
@@ -497,10 +496,6 @@ def test_troubleshoot_iam_policy(
497496
assert response.access == explanations.AccessState.GRANTED
498497

499498

500-
def test_troubleshoot_iam_policy_from_dict():
501-
test_troubleshoot_iam_policy(request_type=dict)
502-
503-
504499
def test_troubleshoot_iam_policy_empty_call():
505500
# This test is a coverage failsafe to make sure that totally empty calls,
506501
# i.e. request == None and no flattened fields passed, work.
@@ -1028,7 +1023,7 @@ def test_parse_common_location_path():
10281023
assert expected == actual
10291024

10301025

1031-
def test_client_withDEFAULT_CLIENT_INFO():
1026+
def test_client_with_default_client_info():
10321027
client_info = gapic_v1.client_info.ClientInfo()
10331028

10341029
with mock.patch.object(

0 commit comments

Comments
 (0)