Skip to content

Commit 28e1bd6

Browse files
committed
wip
1 parent 47b7500 commit 28e1bd6

13 files changed

Lines changed: 351 additions & 175 deletions

File tree

packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ async def test_{{ method_name }}_async(request_type, transport: str = 'grpc_asyn
329329
assert next(args[0]) == request
330330
{% else %}
331331
request = {{ method.input.ident }}()
332-
{%- for auto_populated_field in auto_populated_fields %}
332+
{% for auto_populated_field in auto_populated_fields %}
333333
request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}"
334-
{%- endfor %}
334+
{% endfor %}
335335
assert args[0] == request
336336
{% endif %}
337337

packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,8 @@ async def test_export_assets_async(request_type, transport: str = 'grpc_asyncio'
11291129
# Establish that the underlying gRPC stub method was called.
11301130
assert len(call.mock_calls)
11311131
_, args, _ = call.mock_calls[0]
1132-
request = asset_service.ExportAssetsRequest() assert args[0] == request
1132+
request = asset_service.ExportAssetsRequest()
1133+
assert args[0] == request
11331134

11341135
# Establish that the response is the type that we expect.
11351136
assert isinstance(response, future.Future)
@@ -1357,7 +1358,8 @@ async def test_list_assets_async(request_type, transport: str = 'grpc_asyncio'):
13571358
# Establish that the underlying gRPC stub method was called.
13581359
assert len(call.mock_calls)
13591360
_, args, _ = call.mock_calls[0]
1360-
request = asset_service.ListAssetsRequest() assert args[0] == request
1361+
request = asset_service.ListAssetsRequest()
1362+
assert args[0] == request
13611363

13621364
# Establish that the response is the type that we expect.
13631365
assert isinstance(response, pagers.ListAssetsAsyncPager)
@@ -1857,7 +1859,8 @@ async def test_batch_get_assets_history_async(request_type, transport: str = 'gr
18571859
# Establish that the underlying gRPC stub method was called.
18581860
assert len(call.mock_calls)
18591861
_, args, _ = call.mock_calls[0]
1860-
request = asset_service.BatchGetAssetsHistoryRequest() assert args[0] == request
1862+
request = asset_service.BatchGetAssetsHistoryRequest()
1863+
assert args[0] == request
18611864

18621865
# Establish that the response is the type that we expect.
18631866
assert isinstance(response, asset_service.BatchGetAssetsHistoryResponse)
@@ -2097,7 +2100,8 @@ async def test_create_feed_async(request_type, transport: str = 'grpc_asyncio'):
20972100
# Establish that the underlying gRPC stub method was called.
20982101
assert len(call.mock_calls)
20992102
_, args, _ = call.mock_calls[0]
2100-
request = asset_service.CreateFeedRequest() assert args[0] == request
2103+
request = asset_service.CreateFeedRequest()
2104+
assert args[0] == request
21012105

21022106
# Establish that the response is the type that we expect.
21032107
assert isinstance(response, asset_service.Feed)
@@ -2422,7 +2426,8 @@ async def test_get_feed_async(request_type, transport: str = 'grpc_asyncio'):
24222426
# Establish that the underlying gRPC stub method was called.
24232427
assert len(call.mock_calls)
24242428
_, args, _ = call.mock_calls[0]
2425-
request = asset_service.GetFeedRequest() assert args[0] == request
2429+
request = asset_service.GetFeedRequest()
2430+
assert args[0] == request
24262431

24272432
# Establish that the response is the type that we expect.
24282433
assert isinstance(response, asset_service.Feed)
@@ -2732,7 +2737,8 @@ async def test_list_feeds_async(request_type, transport: str = 'grpc_asyncio'):
27322737
# Establish that the underlying gRPC stub method was called.
27332738
assert len(call.mock_calls)
27342739
_, args, _ = call.mock_calls[0]
2735-
request = asset_service.ListFeedsRequest() assert args[0] == request
2740+
request = asset_service.ListFeedsRequest()
2741+
assert args[0] == request
27362742

27372743
# Establish that the response is the type that we expect.
27382744
assert isinstance(response, asset_service.ListFeedsResponse)
@@ -3050,7 +3056,8 @@ async def test_update_feed_async(request_type, transport: str = 'grpc_asyncio'):
30503056
# Establish that the underlying gRPC stub method was called.
30513057
assert len(call.mock_calls)
30523058
_, args, _ = call.mock_calls[0]
3053-
request = asset_service.UpdateFeedRequest() assert args[0] == request
3059+
request = asset_service.UpdateFeedRequest()
3060+
assert args[0] == request
30543061

30553062
# Establish that the response is the type that we expect.
30563063
assert isinstance(response, asset_service.Feed)
@@ -3358,7 +3365,8 @@ async def test_delete_feed_async(request_type, transport: str = 'grpc_asyncio'):
33583365
# Establish that the underlying gRPC stub method was called.
33593366
assert len(call.mock_calls)
33603367
_, args, _ = call.mock_calls[0]
3361-
request = asset_service.DeleteFeedRequest() assert args[0] == request
3368+
request = asset_service.DeleteFeedRequest()
3369+
assert args[0] == request
33623370

33633371
# Establish that the response is the type that we expect.
33643372
assert response is None
@@ -3672,7 +3680,8 @@ async def test_search_all_resources_async(request_type, transport: str = 'grpc_a
36723680
# Establish that the underlying gRPC stub method was called.
36733681
assert len(call.mock_calls)
36743682
_, args, _ = call.mock_calls[0]
3675-
request = asset_service.SearchAllResourcesRequest() assert args[0] == request
3683+
request = asset_service.SearchAllResourcesRequest()
3684+
assert args[0] == request
36763685

36773686
# Establish that the response is the type that we expect.
36783687
assert isinstance(response, pagers.SearchAllResourcesAsyncPager)
@@ -4201,7 +4210,8 @@ async def test_search_all_iam_policies_async(request_type, transport: str = 'grp
42014210
# Establish that the underlying gRPC stub method was called.
42024211
assert len(call.mock_calls)
42034212
_, args, _ = call.mock_calls[0]
4204-
request = asset_service.SearchAllIamPoliciesRequest() assert args[0] == request
4213+
request = asset_service.SearchAllIamPoliciesRequest()
4214+
assert args[0] == request
42054215

42064216
# Establish that the response is the type that we expect.
42074217
assert isinstance(response, pagers.SearchAllIamPoliciesAsyncPager)
@@ -4714,7 +4724,8 @@ async def test_analyze_iam_policy_async(request_type, transport: str = 'grpc_asy
47144724
# Establish that the underlying gRPC stub method was called.
47154725
assert len(call.mock_calls)
47164726
_, args, _ = call.mock_calls[0]
4717-
request = asset_service.AnalyzeIamPolicyRequest() assert args[0] == request
4727+
request = asset_service.AnalyzeIamPolicyRequest()
4728+
assert args[0] == request
47184729

47194730
# Establish that the response is the type that we expect.
47204731
assert isinstance(response, asset_service.AnalyzeIamPolicyResponse)
@@ -4948,7 +4959,8 @@ async def test_analyze_iam_policy_longrunning_async(request_type, transport: str
49484959
# Establish that the underlying gRPC stub method was called.
49494960
assert len(call.mock_calls)
49504961
_, args, _ = call.mock_calls[0]
4951-
request = asset_service.AnalyzeIamPolicyLongrunningRequest() assert args[0] == request
4962+
request = asset_service.AnalyzeIamPolicyLongrunningRequest()
4963+
assert args[0] == request
49524964

49534965
# Establish that the response is the type that we expect.
49544966
assert isinstance(response, future.Future)
@@ -5173,7 +5185,8 @@ async def test_analyze_move_async(request_type, transport: str = 'grpc_asyncio')
51735185
# Establish that the underlying gRPC stub method was called.
51745186
assert len(call.mock_calls)
51755187
_, args, _ = call.mock_calls[0]
5176-
request = asset_service.AnalyzeMoveRequest() assert args[0] == request
5188+
request = asset_service.AnalyzeMoveRequest()
5189+
assert args[0] == request
51775190

51785191
# Establish that the response is the type that we expect.
51795192
assert isinstance(response, asset_service.AnalyzeMoveResponse)
@@ -5408,7 +5421,8 @@ async def test_query_assets_async(request_type, transport: str = 'grpc_asyncio')
54085421
# Establish that the underlying gRPC stub method was called.
54095422
assert len(call.mock_calls)
54105423
_, args, _ = call.mock_calls[0]
5411-
request = asset_service.QueryAssetsRequest() assert args[0] == request
5424+
request = asset_service.QueryAssetsRequest()
5425+
assert args[0] == request
54125426

54135427
# Establish that the response is the type that we expect.
54145428
assert isinstance(response, asset_service.QueryAssetsResponse)
@@ -5647,7 +5661,8 @@ async def test_create_saved_query_async(request_type, transport: str = 'grpc_asy
56475661
# Establish that the underlying gRPC stub method was called.
56485662
assert len(call.mock_calls)
56495663
_, args, _ = call.mock_calls[0]
5650-
request = asset_service.CreateSavedQueryRequest() assert args[0] == request
5664+
request = asset_service.CreateSavedQueryRequest()
5665+
assert args[0] == request
56515666

56525667
# Establish that the response is the type that we expect.
56535668
assert isinstance(response, asset_service.SavedQuery)
@@ -5988,7 +6003,8 @@ async def test_get_saved_query_async(request_type, transport: str = 'grpc_asynci
59886003
# Establish that the underlying gRPC stub method was called.
59896004
assert len(call.mock_calls)
59906005
_, args, _ = call.mock_calls[0]
5991-
request = asset_service.GetSavedQueryRequest() assert args[0] == request
6006+
request = asset_service.GetSavedQueryRequest()
6007+
assert args[0] == request
59926008

59936009
# Establish that the response is the type that we expect.
59946010
assert isinstance(response, asset_service.SavedQuery)
@@ -6304,7 +6320,8 @@ async def test_list_saved_queries_async(request_type, transport: str = 'grpc_asy
63046320
# Establish that the underlying gRPC stub method was called.
63056321
assert len(call.mock_calls)
63066322
_, args, _ = call.mock_calls[0]
6307-
request = asset_service.ListSavedQueriesRequest() assert args[0] == request
6323+
request = asset_service.ListSavedQueriesRequest()
6324+
assert args[0] == request
63086325

63096326
# Establish that the response is the type that we expect.
63106327
assert isinstance(response, pagers.ListSavedQueriesAsyncPager)
@@ -6814,7 +6831,8 @@ async def test_update_saved_query_async(request_type, transport: str = 'grpc_asy
68146831
# Establish that the underlying gRPC stub method was called.
68156832
assert len(call.mock_calls)
68166833
_, args, _ = call.mock_calls[0]
6817-
request = asset_service.UpdateSavedQueryRequest() assert args[0] == request
6834+
request = asset_service.UpdateSavedQueryRequest()
6835+
assert args[0] == request
68186836

68196837
# Establish that the response is the type that we expect.
68206838
assert isinstance(response, asset_service.SavedQuery)
@@ -7131,7 +7149,8 @@ async def test_delete_saved_query_async(request_type, transport: str = 'grpc_asy
71317149
# Establish that the underlying gRPC stub method was called.
71327150
assert len(call.mock_calls)
71337151
_, args, _ = call.mock_calls[0]
7134-
request = asset_service.DeleteSavedQueryRequest() assert args[0] == request
7152+
request = asset_service.DeleteSavedQueryRequest()
7153+
assert args[0] == request
71357154

71367155
# Establish that the response is the type that we expect.
71377156
assert response is None
@@ -7436,7 +7455,8 @@ async def test_batch_get_effective_iam_policies_async(request_type, transport: s
74367455
# Establish that the underlying gRPC stub method was called.
74377456
assert len(call.mock_calls)
74387457
_, args, _ = call.mock_calls[0]
7439-
request = asset_service.BatchGetEffectiveIamPoliciesRequest() assert args[0] == request
7458+
request = asset_service.BatchGetEffectiveIamPoliciesRequest()
7459+
assert args[0] == request
74407460

74417461
# Establish that the response is the type that we expect.
74427462
assert isinstance(response, asset_service.BatchGetEffectiveIamPoliciesResponse)
@@ -7668,7 +7688,8 @@ async def test_analyze_org_policies_async(request_type, transport: str = 'grpc_a
76687688
# Establish that the underlying gRPC stub method was called.
76697689
assert len(call.mock_calls)
76707690
_, args, _ = call.mock_calls[0]
7671-
request = asset_service.AnalyzeOrgPoliciesRequest() assert args[0] == request
7691+
request = asset_service.AnalyzeOrgPoliciesRequest()
7692+
assert args[0] == request
76727693

76737694
# Establish that the response is the type that we expect.
76747695
assert isinstance(response, pagers.AnalyzeOrgPoliciesAsyncPager)
@@ -8197,7 +8218,8 @@ async def test_analyze_org_policy_governed_containers_async(request_type, transp
81978218
# Establish that the underlying gRPC stub method was called.
81988219
assert len(call.mock_calls)
81998220
_, args, _ = call.mock_calls[0]
8200-
request = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() assert args[0] == request
8221+
request = asset_service.AnalyzeOrgPolicyGovernedContainersRequest()
8222+
assert args[0] == request
82018223

82028224
# Establish that the response is the type that we expect.
82038225
assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedContainersAsyncPager)
@@ -8726,7 +8748,8 @@ async def test_analyze_org_policy_governed_assets_async(request_type, transport:
87268748
# Establish that the underlying gRPC stub method was called.
87278749
assert len(call.mock_calls)
87288750
_, args, _ = call.mock_calls[0]
8729-
request = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() assert args[0] == request
8751+
request = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest()
8752+
assert args[0] == request
87308753

87318754
# Establish that the response is the type that we expect.
87328755
assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedAssetsAsyncPager)

packages/gapic-generator/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,8 @@ async def test_generate_access_token_async(request_type, transport: str = 'grpc_
11121112
# Establish that the underlying gRPC stub method was called.
11131113
assert len(call.mock_calls)
11141114
_, args, _ = call.mock_calls[0]
1115-
request = common.GenerateAccessTokenRequest() assert args[0] == request
1115+
request = common.GenerateAccessTokenRequest()
1116+
assert args[0] == request
11161117

11171118
# Establish that the response is the type that we expect.
11181119
assert isinstance(response, common.GenerateAccessTokenResponse)
@@ -1449,7 +1450,8 @@ async def test_generate_id_token_async(request_type, transport: str = 'grpc_asyn
14491450
# Establish that the underlying gRPC stub method was called.
14501451
assert len(call.mock_calls)
14511452
_, args, _ = call.mock_calls[0]
1452-
request = common.GenerateIdTokenRequest() assert args[0] == request
1453+
request = common.GenerateIdTokenRequest()
1454+
assert args[0] == request
14531455

14541456
# Establish that the response is the type that we expect.
14551457
assert isinstance(response, common.GenerateIdTokenResponse)
@@ -1791,7 +1793,8 @@ async def test_sign_blob_async(request_type, transport: str = 'grpc_asyncio'):
17911793
# Establish that the underlying gRPC stub method was called.
17921794
assert len(call.mock_calls)
17931795
_, args, _ = call.mock_calls[0]
1794-
request = common.SignBlobRequest() assert args[0] == request
1796+
request = common.SignBlobRequest()
1797+
assert args[0] == request
17951798

17961799
# Establish that the response is the type that we expect.
17971800
assert isinstance(response, common.SignBlobResponse)
@@ -2126,7 +2129,8 @@ async def test_sign_jwt_async(request_type, transport: str = 'grpc_asyncio'):
21262129
# Establish that the underlying gRPC stub method was called.
21272130
assert len(call.mock_calls)
21282131
_, args, _ = call.mock_calls[0]
2129-
request = common.SignJwtRequest() assert args[0] == request
2132+
request = common.SignJwtRequest()
2133+
assert args[0] == request
21302134

21312135
# Establish that the response is the type that we expect.
21322136
assert isinstance(response, common.SignJwtResponse)

0 commit comments

Comments
 (0)