Skip to content

Commit 2b44588

Browse files
committed
fix tests
1 parent 1c6d398 commit 2b44588

File tree

12 files changed

+25
-49
lines changed

12 files changed

+25
-49
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,16 +1486,15 @@ def test_{{ service.name|snake_case }}_transport_channel_mtls_with_client_cert_s
14861486
grpc_create_channel.return_value = mock_grpc_channel
14871487

14881488
cred = ga_credentials.AnonymousCredentials()
1489-
with pytest.warns(DeprecationWarning) as record:
1490-
with mock.patch.object(google.auth, 'default|mtls') as adc:
1489+
with pytest.warns(DeprecationWarning):
1490+
with mock.patch.object(google.auth, 'default') as adc:
14911491
adc.return_value = (cred, None)
14921492
transport = transport_class(
14931493
host="squid.clam.whelk",
14941494
api_mtls_endpoint="mtls.squid.clam.whelk",
14951495
client_cert_source=client_cert_source_callback,
14961496
)
14971497
adc.assert_called_once()
1498-
# assert len(record) == 2
14991498

15001499
grpc_ssl_channel_cred.assert_called_once_with(
15011500
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -1533,14 +1532,13 @@ def test_{{ service.name|snake_case }}_transport_channel_mtls_with_adc(
15331532
grpc_create_channel.return_value = mock_grpc_channel
15341533
mock_cred = mock.Mock()
15351534

1536-
with pytest.warns(DeprecationWarning) as record:
1535+
with pytest.warns(DeprecationWarning):
15371536
transport = transport_class(
15381537
host="squid.clam.whelk",
15391538
credentials=mock_cred,
15401539
api_mtls_endpoint="mtls.squid.clam.whelk",
15411540
client_cert_source=None,
15421541
)
1543-
# assert len(record) == 1
15441542

15451543
grpc_create_channel.assert_called_once_with(
15461544
"mtls.squid.clam.whelk:443",

tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17726,7 +17726,7 @@ def test_asset_service_transport_channel_mtls_with_client_cert_source(
1772617726
grpc_create_channel.return_value = mock_grpc_channel
1772717727

1772817728
cred = ga_credentials.AnonymousCredentials()
17729-
with pytest.warns(DeprecationWarning, match="client_cert") as record:
17729+
with pytest.warns(DeprecationWarning):
1773017730
with mock.patch.object(google.auth, 'default') as adc:
1773117731
adc.return_value = (cred, None)
1773217732
transport = transport_class(
@@ -17735,7 +17735,6 @@ def test_asset_service_transport_channel_mtls_with_client_cert_source(
1773517735
client_cert_source=client_cert_source_callback,
1773617736
)
1773717737
adc.assert_called_once()
17738-
assert len(record) == 2
1773917738

1774017739
grpc_ssl_channel_cred.assert_called_once_with(
1774117740
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -17773,14 +17772,13 @@ def test_asset_service_transport_channel_mtls_with_adc(
1777317772
grpc_create_channel.return_value = mock_grpc_channel
1777417773
mock_cred = mock.Mock()
1777517774

17776-
with pytest.warns(DeprecationWarning, match="mtls") as record:
17775+
with pytest.warns(DeprecationWarning):
1777717776
transport = transport_class(
1777817777
host="squid.clam.whelk",
1777917778
credentials=mock_cred,
1778017779
api_mtls_endpoint="mtls.squid.clam.whelk",
1778117780
client_cert_source=None,
1778217781
)
17783-
assert len(record) == 1
1778417782

1778517783
grpc_create_channel.assert_called_once_with(
1778617784
"mtls.squid.clam.whelk:443",

tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3986,7 +3986,7 @@ def test_iam_credentials_transport_channel_mtls_with_client_cert_source(
39863986
grpc_create_channel.return_value = mock_grpc_channel
39873987

39883988
cred = ga_credentials.AnonymousCredentials()
3989-
with pytest.warns(DeprecationWarning, match="client_cert") as record:
3989+
with pytest.warns(DeprecationWarning):
39903990
with mock.patch.object(google.auth, 'default') as adc:
39913991
adc.return_value = (cred, None)
39923992
transport = transport_class(
@@ -3995,7 +3995,6 @@ def test_iam_credentials_transport_channel_mtls_with_client_cert_source(
39953995
client_cert_source=client_cert_source_callback,
39963996
)
39973997
adc.assert_called_once()
3998-
assert len(record) == 2
39993998

40003999
grpc_ssl_channel_cred.assert_called_once_with(
40014000
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -4033,14 +4032,13 @@ def test_iam_credentials_transport_channel_mtls_with_adc(
40334032
grpc_create_channel.return_value = mock_grpc_channel
40344033
mock_cred = mock.Mock()
40354034

4036-
with pytest.warns(DeprecationWarning, match="mtls") as record:
4035+
with pytest.warns(DeprecationWarning):
40374036
transport = transport_class(
40384037
host="squid.clam.whelk",
40394038
credentials=mock_cred,
40404039
api_mtls_endpoint="mtls.squid.clam.whelk",
40414040
client_cert_source=None,
40424041
)
4043-
assert len(record) == 1
40444042

40454043
grpc_create_channel.assert_called_once_with(
40464044
"mtls.squid.clam.whelk:443",

tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15392,7 +15392,7 @@ def test_eventarc_transport_channel_mtls_with_client_cert_source(
1539215392
grpc_create_channel.return_value = mock_grpc_channel
1539315393

1539415394
cred = ga_credentials.AnonymousCredentials()
15395-
with pytest.warns(DeprecationWarning, match="client_cert") as record:
15395+
with pytest.warns(DeprecationWarning):
1539615396
with mock.patch.object(google.auth, 'default') as adc:
1539715397
adc.return_value = (cred, None)
1539815398
transport = transport_class(
@@ -15401,7 +15401,6 @@ def test_eventarc_transport_channel_mtls_with_client_cert_source(
1540115401
client_cert_source=client_cert_source_callback,
1540215402
)
1540315403
adc.assert_called_once()
15404-
assert len(record) == 2
1540515404

1540615405
grpc_ssl_channel_cred.assert_called_once_with(
1540715406
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -15439,14 +15438,13 @@ def test_eventarc_transport_channel_mtls_with_adc(
1543915438
grpc_create_channel.return_value = mock_grpc_channel
1544015439
mock_cred = mock.Mock()
1544115440

15442-
with pytest.warns(DeprecationWarning, match="mtls") as record:
15441+
with pytest.warns(DeprecationWarning):
1544315442
transport = transport_class(
1544415443
host="squid.clam.whelk",
1544515444
credentials=mock_cred,
1544615445
api_mtls_endpoint="mtls.squid.clam.whelk",
1544715446
client_cert_source=None,
1544815447
)
15449-
assert len(record) == 1
1545015448

1545115449
grpc_create_channel.assert_called_once_with(
1545215450
"mtls.squid.clam.whelk:443",

tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12911,7 +12911,7 @@ def test_config_service_v2_transport_channel_mtls_with_client_cert_source(
1291112911
grpc_create_channel.return_value = mock_grpc_channel
1291212912

1291312913
cred = ga_credentials.AnonymousCredentials()
12914-
with pytest.warns(DeprecationWarning, match="client_cert") as record:
12914+
with pytest.warns(DeprecationWarning):
1291512915
with mock.patch.object(google.auth, 'default') as adc:
1291612916
adc.return_value = (cred, None)
1291712917
transport = transport_class(
@@ -12920,7 +12920,6 @@ def test_config_service_v2_transport_channel_mtls_with_client_cert_source(
1292012920
client_cert_source=client_cert_source_callback,
1292112921
)
1292212922
adc.assert_called_once()
12923-
assert len(record) == 2
1292412923

1292512924
grpc_ssl_channel_cred.assert_called_once_with(
1292612925
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -12958,14 +12957,13 @@ def test_config_service_v2_transport_channel_mtls_with_adc(
1295812957
grpc_create_channel.return_value = mock_grpc_channel
1295912958
mock_cred = mock.Mock()
1296012959

12961-
with pytest.warns(DeprecationWarning, match="mtls") as record:
12960+
with pytest.warns(DeprecationWarning):
1296212961
transport = transport_class(
1296312962
host="squid.clam.whelk",
1296412963
credentials=mock_cred,
1296512964
api_mtls_endpoint="mtls.squid.clam.whelk",
1296612965
client_cert_source=None,
1296712966
)
12968-
assert len(record) == 1
1296912967

1297012968
grpc_create_channel.assert_called_once_with(
1297112969
"mtls.squid.clam.whelk:443",

tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,7 +3459,7 @@ def test_logging_service_v2_transport_channel_mtls_with_client_cert_source(
34593459
grpc_create_channel.return_value = mock_grpc_channel
34603460

34613461
cred = ga_credentials.AnonymousCredentials()
3462-
with pytest.warns(DeprecationWarning, match="client_cert") as record:
3462+
with pytest.warns(DeprecationWarning):
34633463
with mock.patch.object(google.auth, 'default') as adc:
34643464
adc.return_value = (cred, None)
34653465
transport = transport_class(
@@ -3468,7 +3468,6 @@ def test_logging_service_v2_transport_channel_mtls_with_client_cert_source(
34683468
client_cert_source=client_cert_source_callback,
34693469
)
34703470
adc.assert_called_once()
3471-
assert len(record) == 2
34723471

34733472
grpc_ssl_channel_cred.assert_called_once_with(
34743473
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -3506,14 +3505,13 @@ def test_logging_service_v2_transport_channel_mtls_with_adc(
35063505
grpc_create_channel.return_value = mock_grpc_channel
35073506
mock_cred = mock.Mock()
35083507

3509-
with pytest.warns(DeprecationWarning, match="mtls") as record:
3508+
with pytest.warns(DeprecationWarning):
35103509
transport = transport_class(
35113510
host="squid.clam.whelk",
35123511
credentials=mock_cred,
35133512
api_mtls_endpoint="mtls.squid.clam.whelk",
35143513
client_cert_source=None,
35153514
)
3516-
assert len(record) == 1
35173515

35183516
grpc_create_channel.assert_called_once_with(
35193517
"mtls.squid.clam.whelk:443",

tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3263,7 +3263,7 @@ def test_metrics_service_v2_transport_channel_mtls_with_client_cert_source(
32633263
grpc_create_channel.return_value = mock_grpc_channel
32643264

32653265
cred = ga_credentials.AnonymousCredentials()
3266-
with pytest.warns(DeprecationWarning, match="client_cert") as record:
3266+
with pytest.warns(DeprecationWarning):
32673267
with mock.patch.object(google.auth, 'default') as adc:
32683268
adc.return_value = (cred, None)
32693269
transport = transport_class(
@@ -3272,7 +3272,6 @@ def test_metrics_service_v2_transport_channel_mtls_with_client_cert_source(
32723272
client_cert_source=client_cert_source_callback,
32733273
)
32743274
adc.assert_called_once()
3275-
assert len(record) == 2
32763275

32773276
grpc_ssl_channel_cred.assert_called_once_with(
32783277
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -3310,14 +3309,13 @@ def test_metrics_service_v2_transport_channel_mtls_with_adc(
33103309
grpc_create_channel.return_value = mock_grpc_channel
33113310
mock_cred = mock.Mock()
33123311

3313-
with pytest.warns(DeprecationWarning, match="mtls") as record:
3312+
with pytest.warns(DeprecationWarning):
33143313
transport = transport_class(
33153314
host="squid.clam.whelk",
33163315
credentials=mock_cred,
33173316
api_mtls_endpoint="mtls.squid.clam.whelk",
33183317
client_cert_source=None,
33193318
)
3320-
assert len(record) == 1
33213319

33223320
grpc_create_channel.assert_called_once_with(
33233321
"mtls.squid.clam.whelk:443",

tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_config_service_v2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12911,7 +12911,7 @@ def test_config_service_v2_transport_channel_mtls_with_client_cert_source(
1291112911
grpc_create_channel.return_value = mock_grpc_channel
1291212912

1291312913
cred = ga_credentials.AnonymousCredentials()
12914-
with pytest.warns(DeprecationWarning, match="client_cert") as record:
12914+
with pytest.warns(DeprecationWarning):
1291512915
with mock.patch.object(google.auth, 'default') as adc:
1291612916
adc.return_value = (cred, None)
1291712917
transport = transport_class(
@@ -12920,7 +12920,6 @@ def test_config_service_v2_transport_channel_mtls_with_client_cert_source(
1292012920
client_cert_source=client_cert_source_callback,
1292112921
)
1292212922
adc.assert_called_once()
12923-
assert len(record) == 2
1292412923

1292512924
grpc_ssl_channel_cred.assert_called_once_with(
1292612925
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -12958,14 +12957,13 @@ def test_config_service_v2_transport_channel_mtls_with_adc(
1295812957
grpc_create_channel.return_value = mock_grpc_channel
1295912958
mock_cred = mock.Mock()
1296012959

12961-
with pytest.warns(DeprecationWarning, match="mtls") as record:
12960+
with pytest.warns(DeprecationWarning):
1296212961
transport = transport_class(
1296312962
host="squid.clam.whelk",
1296412963
credentials=mock_cred,
1296512964
api_mtls_endpoint="mtls.squid.clam.whelk",
1296612965
client_cert_source=None,
1296712966
)
12968-
assert len(record) == 1
1296912967

1297012968
grpc_create_channel.assert_called_once_with(
1297112969
"mtls.squid.clam.whelk:443",

tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,7 +3459,7 @@ def test_logging_service_v2_transport_channel_mtls_with_client_cert_source(
34593459
grpc_create_channel.return_value = mock_grpc_channel
34603460

34613461
cred = ga_credentials.AnonymousCredentials()
3462-
with pytest.warns(DeprecationWarning, match="client_cert") as record:
3462+
with pytest.warns(DeprecationWarning):
34633463
with mock.patch.object(google.auth, 'default') as adc:
34643464
adc.return_value = (cred, None)
34653465
transport = transport_class(
@@ -3468,7 +3468,6 @@ def test_logging_service_v2_transport_channel_mtls_with_client_cert_source(
34683468
client_cert_source=client_cert_source_callback,
34693469
)
34703470
adc.assert_called_once()
3471-
assert len(record) == 2
34723471

34733472
grpc_ssl_channel_cred.assert_called_once_with(
34743473
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -3506,14 +3505,13 @@ def test_logging_service_v2_transport_channel_mtls_with_adc(
35063505
grpc_create_channel.return_value = mock_grpc_channel
35073506
mock_cred = mock.Mock()
35083507

3509-
with pytest.warns(DeprecationWarning, match="mtls") as record:
3508+
with pytest.warns(DeprecationWarning):
35103509
transport = transport_class(
35113510
host="squid.clam.whelk",
35123511
credentials=mock_cred,
35133512
api_mtls_endpoint="mtls.squid.clam.whelk",
35143513
client_cert_source=None,
35153514
)
3516-
assert len(record) == 1
35173515

35183516
grpc_create_channel.assert_called_once_with(
35193517
"mtls.squid.clam.whelk:443",

tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3263,7 +3263,7 @@ def test_metrics_service_v2_transport_channel_mtls_with_client_cert_source(
32633263
grpc_create_channel.return_value = mock_grpc_channel
32643264

32653265
cred = ga_credentials.AnonymousCredentials()
3266-
with pytest.warns(DeprecationWarning, match="client_cert") as record:
3266+
with pytest.warns(DeprecationWarning):
32673267
with mock.patch.object(google.auth, 'default') as adc:
32683268
adc.return_value = (cred, None)
32693269
transport = transport_class(
@@ -3272,7 +3272,6 @@ def test_metrics_service_v2_transport_channel_mtls_with_client_cert_source(
32723272
client_cert_source=client_cert_source_callback,
32733273
)
32743274
adc.assert_called_once()
3275-
assert len(record) == 2
32763275

32773276
grpc_ssl_channel_cred.assert_called_once_with(
32783277
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -3310,14 +3309,13 @@ def test_metrics_service_v2_transport_channel_mtls_with_adc(
33103309
grpc_create_channel.return_value = mock_grpc_channel
33113310
mock_cred = mock.Mock()
33123311

3313-
with pytest.warns(DeprecationWarning, match="mtls") as record:
3312+
with pytest.warns(DeprecationWarning):
33143313
transport = transport_class(
33153314
host="squid.clam.whelk",
33163315
credentials=mock_cred,
33173316
api_mtls_endpoint="mtls.squid.clam.whelk",
33183317
client_cert_source=None,
33193318
)
3320-
assert len(record) == 1
33213319

33223320
grpc_create_channel.assert_called_once_with(
33233321
"mtls.squid.clam.whelk:443",

0 commit comments

Comments
 (0)