Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 53d6321

Browse files
committed
Test tweaks
1 parent dd1a244 commit 53d6321

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ def test_{{ service.name|snake_case }}_transport_channel_mtls_with_client_cert_s
14851485
grpc_create_channel.return_value = mock_grpc_channel
14861486

14871487
cred = ga_credentials.AnonymousCredentials()
1488-
with pytest.warns(DeprecationWarning):
1488+
with pytest.warns(DeprecationWarning) as record:
14891489
with mock.patch.object(google.auth, 'default') as adc:
14901490
adc.return_value = (cred, None)
14911491
transport = transport_class(
@@ -1494,6 +1494,7 @@ def test_{{ service.name|snake_case }}_transport_channel_mtls_with_client_cert_s
14941494
client_cert_source=client_cert_source_callback,
14951495
)
14961496
adc.assert_called_once()
1497+
assert len(record) == 2
14971498

14981499
grpc_ssl_channel_cred.assert_called_once_with(
14991500
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -1531,13 +1532,14 @@ def test_{{ service.name|snake_case }}_transport_channel_mtls_with_adc(
15311532
grpc_create_channel.return_value = mock_grpc_channel
15321533
mock_cred = mock.Mock()
15331534

1534-
with pytest.warns(DeprecationWarning):
1535+
with pytest.warns(DeprecationWarning) as record:
15351536
transport = transport_class(
15361537
host="squid.clam.whelk",
15371538
credentials=mock_cred,
15381539
api_mtls_endpoint="mtls.squid.clam.whelk",
15391540
client_cert_source=None,
15401541
)
1542+
assert len(record) == 1
15411543

15421544
grpc_create_channel.assert_called_once_with(
15431545
"mtls.squid.clam.whelk:443",

0 commit comments

Comments
 (0)