Skip to content

Commit 5533e0c

Browse files
committed
test(mtls): fix mTLS auto-enablement test failure in test_grpc.py
1 parent 3aa269b commit 5533e0c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

packages/google-auth/tests/transport/test_grpc.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,16 @@ def test_get_client_ssl_credentials_auto_enablement(
633633
{
634634
environment_vars.GOOGLE_API_CERTIFICATE_CONFIG: "fake_config_path.json",
635635
},
636-
), mock.patch("builtins.open", mock.mock_open(read_data=fake_config_content)):
637-
# Ensure GOOGLE_API_USE_CLIENT_CERTIFICATE is not present in the environment
636+
), mock.patch(
637+
"builtins.open", mock.mock_open(read_data=fake_config_content)
638+
), mock.patch(
639+
"os.path.exists", return_value=True
640+
):
641+
# Ensure mTLS explicit flags are not present in the environment
638642
os.environ.pop(environment_vars.GOOGLE_API_USE_CLIENT_CERTIFICATE, None)
643+
os.environ.pop(
644+
environment_vars.CLOUDSDK_CONTEXT_AWARE_USE_CLIENT_CERTIFICATE, None
645+
)
639646
ssl_credentials = google.auth.transport.grpc.SslCredentials()
640647

641648
assert ssl_credentials.ssl_credentials is not None

0 commit comments

Comments
 (0)