Skip to content

Commit 56dc762

Browse files
fix: Update tests for coverage of all branches
Signed-off-by: Radhika Agrawal <agrawalradhika@google.com>
1 parent da0747c commit 56dc762

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/unit/operations_v1/test_operations_rest_client.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,16 @@ def test_operations_client_client_options(
351351
with mock.patch.dict(
352352
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
353353
):
354-
if hasattr(google.auth.transport.mtls, "should_use_client_cert"):
355-
pytest.skip(
356-
"The should_use_client_cert function is available in this "
357-
"version of google-auth. Skipping this test."
358-
)
354+
if not hasattr(google.auth.transport.mtls, "should_use_client_cert"):
355+
with pytest.raises(ValueError):
356+
client = client_class()
357+
else:
358+
with mock.patch.object(transport_class, "__init__") as patched:
359+
patched.return_value = None
360+
client = client_class(
361+
credentials=ga_credentials.AnonymousCredentials(),
362+
transport=transport_name
363+
)
359364

360365
# Check the case quota_project_id is provided
361366
options = client_options.ClientOptions(quota_project_id="octopus")

0 commit comments

Comments
 (0)