@@ -130,6 +130,24 @@ def test_delete_operation_from_dict():
130130 )
131131 call.assert_called()
132132
133+
134+ def test_delete_operation_flattened():
135+ client = {{ service.client_name }}(
136+ credentials=ga_credentials.AnonymousCredentials(),
137+ )
138+
139+ # Mock the actual call within the gRPC stub, and fake the request.
140+ with mock.patch.object(type(client.transport.delete_operation), "__call__") as call:
141+ # Designate an appropriate return value for the call.
142+ call.return_value = None
143+
144+ client.delete_operation()
145+
146+ # Establish that the underlying gRPC stub method was called.
147+ assert len(call.mock_calls) == 1
148+ _, args, _ = call.mock_calls[0]
149+ assert args[0] == operations_pb2.DeleteOperationRequest()
150+
133151{% endif %} {# DeleteOperation #}
134152
135153{% if "CancelOperation" in api .mixin_api_methods %}
@@ -196,6 +214,24 @@ def test_cancel_operation_from_dict():
196214 }
197215 )
198216 call.assert_called()
217+
218+
219+ def test_cancel_operation_flattened():
220+ client = {{ service.client_name }}(
221+ credentials=ga_credentials.AnonymousCredentials(),
222+ )
223+
224+ # Mock the actual call within the gRPC stub, and fake the request.
225+ with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call:
226+ # Designate an appropriate return value for the call.
227+ call.return_value = None
228+
229+ client.cancel_operation()
230+
231+ # Establish that the underlying gRPC stub method was called.
232+ assert len(call.mock_calls) == 1
233+ _, args, _ = call.mock_calls[0]
234+ assert args[0] == operations_pb2.CancelOperationRequest()
199235{% endif %} {# CancelOperation #}
200236
201237{% if "WaitOperation" in api .mixin_api_methods %}
@@ -264,6 +300,24 @@ def test_wait_operation_from_dict():
264300 )
265301 call.assert_called()
266302
303+
304+ def test_wait_operation_flattened():
305+ client = {{ service.client_name }}(
306+ credentials=ga_credentials.AnonymousCredentials(),
307+ )
308+
309+ # Mock the actual call within the gRPC stub, and fake the request.
310+ with mock.patch.object(type(client.transport.wait_operation), "__call__") as call:
311+ # Designate an appropriate return value for the call.
312+ call.return_value = operations_pb2.Operation()
313+
314+ client.wait_operation()
315+
316+ # Establish that the underlying gRPC stub method was called.
317+ assert len(call.mock_calls) == 1
318+ _, args, _ = call.mock_calls[0]
319+ assert args[0] == operations_pb2.WaitOperationRequest()
320+
267321{% endif %} {# WaitOperation #}
268322
269323{% if "GetOperation" in api .mixin_api_methods %}
@@ -333,6 +387,24 @@ def test_get_operation_from_dict():
333387
334388 call.assert_called()
335389
390+
391+ def test_get_operation_flattened():
392+ client = {{ service.client_name }}(
393+ credentials=ga_credentials.AnonymousCredentials(),
394+ )
395+
396+ # Mock the actual call within the gRPC stub, and fake the request.
397+ with mock.patch.object(type(client.transport.get_operation), "__call__") as call:
398+ # Designate an appropriate return value for the call.
399+ call.return_value = operations_pb2.Operation()
400+
401+ client.get_operation()
402+
403+ # Establish that the underlying gRPC stub method was called.
404+ assert len(call.mock_calls) == 1
405+ _, args, _ = call.mock_calls[0]
406+ assert args[0] == operations_pb2.GetOperationRequest()
407+
336408{% endif %} {# GetOperation #}
337409
338410{% if "ListOperations" in api .mixin_api_methods %}
@@ -401,6 +473,24 @@ def test_list_operations_from_dict():
401473
402474 call.assert_called()
403475
476+
477+ def test_list_operations_flattened():
478+ client = {{ service.client_name }}(
479+ credentials=ga_credentials.AnonymousCredentials(),
480+ )
481+
482+ # Mock the actual call within the gRPC stub, and fake the request.
483+ with mock.patch.object(type(client.transport.list_operations), "__call__") as call:
484+ # Designate an appropriate return value for the call.
485+ call.return_value = operations_pb2.ListOperationsResponse()
486+
487+ client.list_operations()
488+
489+ # Establish that the underlying gRPC stub method was called.
490+ assert len(call.mock_calls) == 1
491+ _, args, _ = call.mock_calls[0]
492+ assert args[0] == operations_pb2.ListOperationsRequest()
493+
404494{% endif %} {# ListOperations #}
405495
406496{% endif %} {# LRO #}
@@ -471,6 +561,24 @@ def test_list_locations_from_dict():
471561 )
472562 call.assert_called()
473563
564+
565+ def test_list_locations_flattened():
566+ client = {{ service.client_name }}(
567+ credentials=ga_credentials.AnonymousCredentials(),
568+ )
569+
570+ # Mock the actual call within the gRPC stub, and fake the request.
571+ with mock.patch.object(type(client.transport.list_locations), "__call__") as call:
572+ # Designate an appropriate return value for the call.
573+ call.return_value = locations_pb2.ListLocationsResponse()
574+
575+ client.list_locations()
576+
577+ # Establish that the underlying gRPC stub method was called.
578+ assert len(call.mock_calls) == 1
579+ _, args, _ = call.mock_calls[0]
580+ assert args[0] == locations_pb2.ListLocationsRequest()
581+
474582{% endif %} {# ListLocations #}
475583
476584{# GetLocation #}
@@ -537,6 +645,24 @@ def test_get_location_from_dict():
537645 )
538646 call.assert_called()
539647
648+
649+ def test_get_location_flattened():
650+ client = {{ service.client_name }}(
651+ credentials=ga_credentials.AnonymousCredentials(),
652+ )
653+
654+ # Mock the actual call within the gRPC stub, and fake the request.
655+ with mock.patch.object(type(client.transport.get_location), "__call__") as call:
656+ # Designate an appropriate return value for the call.
657+ call.return_value = locations_pb2.Location()
658+
659+ client.get_location()
660+
661+ # Establish that the underlying gRPC stub method was called.
662+ assert len(call.mock_calls) == 1
663+ _, args, _ = call.mock_calls[0]
664+ assert args[0] == locations_pb2.GetLocationRequest()
665+
540666{% endif %} {# GetLocation #}
541667
542668{% endif %} {# location_mixin #}
@@ -614,6 +740,24 @@ def test_set_iam_policy_from_dict():
614740 call.assert_called()
615741
616742
743+ def test_set_iam_policy_flattened():
744+ client = {{ service.client_name }}(
745+ credentials=ga_credentials.AnonymousCredentials(),
746+ )
747+
748+ # Mock the actual call within the gRPC stub, and fake the request.
749+ with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call:
750+ # Designate an appropriate return value for the call.
751+ call.return_value = policy_pb2.Policy()
752+
753+ client.set_iam_policy()
754+
755+ # Establish that the underlying gRPC stub method was called.
756+ assert len(call.mock_calls) == 1
757+ _, args, _ = call.mock_calls[0]
758+ assert args[0] == iam_policy_pb2.SetIamPolicyRequest()
759+
760+
617761def test_get_iam_policy(transport: str = "grpc"):
618762 client = {{ service.client_name }}(
619763 credentials=ga_credentials.AnonymousCredentials(), transport=transport,
@@ -687,6 +831,24 @@ def test_get_iam_policy_from_dict():
687831 call.assert_called()
688832
689833
834+ def test_get_iam_policy_flattened():
835+ client = {{ service.client_name }}(
836+ credentials=ga_credentials.AnonymousCredentials(),
837+ )
838+
839+ # Mock the actual call within the gRPC stub, and fake the request.
840+ with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call:
841+ # Designate an appropriate return value for the call.
842+ call.return_value = policy_pb2.Policy()
843+
844+ client.get_iam_policy()
845+
846+ # Establish that the underlying gRPC stub method was called.
847+ assert len(call.mock_calls) == 1
848+ _, args, _ = call.mock_calls[0]
849+ assert args[0] == iam_policy_pb2.GetIamPolicyRequest()
850+
851+
690852def test_test_iam_permissions(transport: str = "grpc"):
691853 client = {{ service.client_name }}(
692854 credentials=ga_credentials.AnonymousCredentials(), transport=transport,
@@ -766,6 +928,24 @@ def test_test_iam_permissions_from_dict():
766928 )
767929 call.assert_called()
768930
931+
932+ def test_test_iam_permissions_flattened():
933+ client = {{ service.client_name }}(
934+ credentials=ga_credentials.AnonymousCredentials(),
935+ )
936+
937+ # Mock the actual call within the gRPC stub, and fake the request.
938+ with mock.patch.object(type(client.transport.test_iam_permissions), "__call__") as call:
939+ # Designate an appropriate return value for the call.
940+ call.return_value = iam_policy_pb2.TestIamPermissionsResponse()
941+
942+ client.test_iam_permissions()
943+
944+ # Establish that the underlying gRPC stub method was called.
945+ assert len(call.mock_calls) == 1
946+ _, args, _ = call.mock_calls[0]
947+ assert args[0] == iam_policy_pb2.TestIamPermissionsRequest()
948+
769949{% endif %}
770950
771951{% if (not opts .add_iam_methods and api .has_iam_mixin ) and 'grpc' in opts .transport %}
@@ -839,6 +1019,24 @@ def test_set_iam_policy_from_dict():
8391019 }
8401020 )
8411021 call.assert_called()
1022+
1023+
1024+ def test_set_iam_policy_flattened():
1025+ client = {{ service.client_name }}(
1026+ credentials=ga_credentials.AnonymousCredentials(),
1027+ )
1028+
1029+ # Mock the actual call within the gRPC stub, and fake the request.
1030+ with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call:
1031+ # Designate an appropriate return value for the call.
1032+ call.return_value = policy_pb2.Policy()
1033+
1034+ client.set_iam_policy()
1035+
1036+ # Establish that the underlying gRPC stub method was called.
1037+ assert len(call.mock_calls) == 1
1038+ _, args, _ = call.mock_calls[0]
1039+ assert args[0] == iam_policy_pb2.SetIamPolicyRequest()
8421040{% endif %}
8431041
8441042{% if "GetIamPolicy" in api .mixin_api_methods %}
@@ -913,6 +1111,24 @@ def test_get_iam_policy_from_dict():
9131111 }
9141112 )
9151113 call.assert_called()
1114+
1115+
1116+ def test_get_iam_policy_flattened():
1117+ client = {{ service.client_name }}(
1118+ credentials=ga_credentials.AnonymousCredentials(),
1119+ )
1120+
1121+ # Mock the actual call within the gRPC stub, and fake the request.
1122+ with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call:
1123+ # Designate an appropriate return value for the call.
1124+ call.return_value = policy_pb2.Policy()
1125+
1126+ client.get_iam_policy()
1127+
1128+ # Establish that the underlying gRPC stub method was called.
1129+ assert len(call.mock_calls) == 1
1130+ _, args, _ = call.mock_calls[0]
1131+ assert args[0] == iam_policy_pb2.GetIamPolicyRequest()
9161132{% endif %}
9171133
9181134{% if "TestIamPermissions" in api .mixin_api_methods %}
@@ -994,6 +1210,24 @@ def test_test_iam_permissions_from_dict():
9941210 }
9951211 )
9961212 call.assert_called()
1213+
1214+
1215+ def test_test_iam_permissions_flattened():
1216+ client = {{ service.client_name }}(
1217+ credentials=ga_credentials.AnonymousCredentials(),
1218+ )
1219+
1220+ # Mock the actual call within the gRPC stub, and fake the request.
1221+ with mock.patch.object(type(client.transport.test_iam_permissions), "__call__") as call:
1222+ # Designate an appropriate return value for the call.
1223+ call.return_value = iam_policy_pb2.TestIamPermissionsResponse()
1224+
1225+ client.test_iam_permissions()
1226+
1227+ # Establish that the underlying gRPC stub method was called.
1228+ assert len(call.mock_calls) == 1
1229+ _, args, _ = call.mock_calls[0]
1230+ assert args[0] == iam_policy_pb2.TestIamPermissionsRequest()
9971231{% endif %}
9981232
9991233{% endif %}
0 commit comments