@@ -158,13 +158,13 @@ def set_event_loop():
158158
159159def test__read_environment_variables():
160160 assert {{ service.client_name }}._read_environment_variables() == (False, "auto", None)
161-
161+
162162 with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}):
163163 assert {{ service.client_name }}._read_environment_variables() == (True, "auto", None)
164-
164+
165165 with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}):
166166 assert {{ service.client_name }}._read_environment_variables() == (False, "auto", None)
167-
167+
168168 with mock.patch.dict(
169169 os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
170170 ):
@@ -184,10 +184,10 @@ def test__read_environment_variables():
184184
185185 with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
186186 assert {{ service.client_name }}._read_environment_variables() == (False, "never", None)
187-
187+
188188 with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
189189 assert {{ service.client_name }}._read_environment_variables() == (False, "always", None)
190-
190+
191191 with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}):
192192 assert {{ service.client_name }}._read_environment_variables() == (False, "auto", None)
193193
@@ -277,7 +277,7 @@ def test_use_client_cert_effective():
277277 assert {{ service.client_name }}._use_client_cert_effective() is False
278278
279279 # Test case 12: Test when `should_use_client_cert` is available and the
280- # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is unset. Also,
280+ # `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is unset. Also,
281281 # the GOOGLE_API_CONFIG environment variable is unset.
282282 if hasattr(google.auth.transport.mtls, "should_use_client_cert"):
283283 with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": ""}):
@@ -287,7 +287,7 @@ def test_use_client_cert_effective():
287287def test__get_client_cert_source():
288288 mock_provided_cert_source = mock.Mock()
289289 mock_default_cert_source = mock.Mock()
290-
290+
291291 assert {{ service.client_name }}._get_client_cert_source(None, False) is None
292292 assert {{ service.client_name }}._get_client_cert_source(mock_provided_cert_source, False) is None
293293 assert {{ service.client_name }}._get_client_cert_source(mock_provided_cert_source, True) == mock_provided_cert_source
@@ -819,7 +819,7 @@ def test_{{ service.client_name|snake_case }}_get_mtls_endpoint_and_cert_source(
819819 )
820820 assert api_endpoint == mock_api_endpoint
821821 assert cert_source is None
822-
822+
823823 # Test cases for mTLS enablement when GOOGLE_API_USE_CLIENT_CERTIFICATE is unset.
824824 test_cases = [
825825 (
@@ -852,7 +852,7 @@ def test_{{ service.client_name|snake_case }}_get_mtls_endpoint_and_cert_source(
852852 config_filename = "mock_certificate_config.json"
853853 config_file_content = json.dumps(config_data)
854854 m = mock.mock_open(read_data=config_file_content)
855- with mock.patch("builtins.open", m), mock.patch("os.path.exists", side_effect=lambda path: os.path.basename(path) == config_filename) :
855+ with mock.patch("builtins.open", m):
856856 with mock.patch.dict(
857857 os.environ, {"GOOGLE_API_CERTIFICATE_CONFIG": config_filename}
858858 ):
@@ -881,10 +881,10 @@ def test_{{ service.client_name|snake_case }}_get_mtls_endpoint_and_cert_source(
881881 },
882882 },
883883 mock_client_cert_source,
884- ),
884+ ),
885885 (
886886 # With workloads not present in config, mTLS is disabled.
887- {
887+ {
888888 "version": 1,
889889 "cert_configs": {},
890890 },
@@ -899,7 +899,7 @@ def test_{{ service.client_name|snake_case }}_get_mtls_endpoint_and_cert_source(
899899 config_filename = "mock_certificate_config.json"
900900 config_file_content = json.dumps(config_data)
901901 m = mock.mock_open(read_data=config_file_content)
902- with mock.patch("builtins.open", m), mock.patch("os.path.exists", side_effect=lambda path: os.path.basename(path) == config_filename) :
902+ with mock.patch("builtins.open", m):
903903 with mock.patch.dict(
904904 os.environ, {"GOOGLE_API_CERTIFICATE_CONFIG": config_filename}
905905 ):
@@ -946,7 +946,7 @@ def test_{{ service.client_name|snake_case }}_get_mtls_endpoint_and_cert_source(
946946 with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
947947 with pytest.raises(MutualTLSChannelError) as excinfo:
948948 client_class.get_mtls_endpoint_and_cert_source()
949-
949+
950950 assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
951951
952952@pytest.mark.parametrize("client_class", [
@@ -1011,7 +1011,7 @@ def test_{{ service.client_name|snake_case }}_client_api_endpoint(client_class):
10111011 with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
10121012 client = client_class(client_options=options, credentials=ga_credentials.AnonymousCredentials())
10131013 assert client.api_endpoint == default_endpoint
1014-
1014+
10151015
10161016@pytest.mark.parametrize("client_class,transport_class,transport_name", [
10171017 {% if 'grpc' in opts .transport %}
0 commit comments