@@ -168,50 +168,6 @@ def set_event_loop():
168168 asyncio.set_event_loop(None)
169169
170170
171- def test__read_environment_variables():
172- assert {{ service.client_name }}._read_environment_variables() == (False, "auto", None)
173-
174- with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}):
175- assert {{ service.client_name }}._read_environment_variables() == (True, "auto", None)
176-
177- with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}):
178- assert {{ service.client_name }}._read_environment_variables() == (False, "auto", None)
179-
180- with mock.patch.dict(
181- os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
182- ):
183- if not hasattr(google.auth.transport.mtls, "should_use_client_cert"):
184- with pytest.raises(ValueError) as excinfo:
185- {{ service.client_name }}._read_environment_variables()
186- assert (
187- str(excinfo.value)
188- == "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
189- )
190- else:
191- assert {{ service.client_name }}._read_environment_variables() == (
192- False,
193- "auto",
194- None,
195- )
196-
197- with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
198- assert {{ service.client_name }}._read_environment_variables() == (False, "never", None)
199-
200- with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
201- assert {{ service.client_name }}._read_environment_variables() == (False, "always", None)
202-
203- with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}):
204- assert {{ service.client_name }}._read_environment_variables() == (False, "auto", None)
205-
206- with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
207- with pytest.raises(MutualTLSChannelError) as excinfo:
208- {{ service.client_name }}._read_environment_variables()
209- assert str(excinfo.value) == "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
210-
211- with mock.patch.dict(os.environ, {"GOOGLE_CLOUD_UNIVERSE_DOMAIN": "foo.com"}):
212- assert {{ service.client_name }}._read_environment_variables() == (False, "auto", "foo.com")
213-
214-
215171def test__get_client_cert_source():
216172 mock_provided_cert_source = mock.Mock()
217173 mock_default_cert_source = mock.Mock()
0 commit comments