File tree Expand file tree Collapse file tree 9 files changed +110
-13
lines changed
gapic/templates/tests/unit/gapic/%name_%version/%sub
tests/integration/goldens
asset/tests/unit/gapic/asset_v1
credentials/tests/unit/gapic/credentials_v1
eventarc/tests/unit/gapic/eventarc_v1
logging/tests/unit/gapic/logging_v2
redis/tests/unit/gapic/redis_v1 Expand file tree Collapse file tree 9 files changed +110
-13
lines changed Original file line number Diff line number Diff line change @@ -1041,19 +1041,9 @@ def test_transport_adc(transport_class):
1041
1041
transport_class()
1042
1042
adc.assert_called_once()
1043
1043
1044
- @pytest.mark.parametrize("transport_name", [
1045
- {% if "grpc" in opts .transport %}
1046
- "grpc",
1047
- {% endif %}
1048
- {% if "rest" in opts .transport %}
1049
- "rest",
1050
- {% endif %}
1051
- ])
1052
- def test_transport_kind(transport_name):
1053
- transport = {{ service.client_name }}.get_transport_class(transport_name)(
1054
- credentials=ga_credentials.AnonymousCredentials(),
1055
- )
1056
- assert transport.kind == transport_name
1044
+ {{ test_macros.transport_kind_test(service, opts) }}
1045
+
1046
+ {{ test_macros.transport_kind_test(service, opts, is_async=True) }}
1057
1047
1058
1048
{% if 'grpc' in opts .transport %}
1059
1049
def test_transport_grpc_default():
Original file line number Diff line number Diff line change @@ -1876,3 +1876,33 @@ def test_{{ method_name }}_empty_call():
1876
1876
{% endwith %} {# method_settings #}
1877
1877
assert args[0] == {{ method.input.ident }}()
1878
1878
{% endmacro %}
1879
+
1880
+
1881
+ {% macro transport_kind_test (service , opts , is_async =False ) %}
1882
+ @pytest.mark.parametrize("transport_name", [
1883
+ {% if is_async %}
1884
+ {% if "grpc" in opts .transport %}
1885
+ "grpc_asyncio",
1886
+ {% endif %}
1887
+ {% else %} {# if not is_async #}
1888
+ {% if "grpc" in opts .transport %}
1889
+ "grpc",
1890
+ {% endif %}
1891
+ {% if "rest" in opts .transport %}
1892
+ "rest",
1893
+ {% endif %}
1894
+ {% endif %} {# is_async #}
1895
+ ])
1896
+ {% if is_async %}
1897
+ async def test_transport_kind_async(transport_name):
1898
+ transport = {{ service.async_client_name }}.get_transport_class(transport_name)(
1899
+ credentials=async_anonymous_credentials(),
1900
+ )
1901
+ {% else %}
1902
+ def test_transport_kind(transport_name):
1903
+ transport = {{ service.client_name }}.get_transport_class(transport_name)(
1904
+ credentials=ga_credentials.AnonymousCredentials(),
1905
+ )
1906
+ {% endif %}
1907
+ assert transport.kind == transport_name
1908
+ {% endmacro %}
Original file line number Diff line number Diff line change @@ -16415,6 +16415,17 @@ def test_transport_kind(transport_name):
16415
16415
)
16416
16416
assert transport.kind == transport_name
16417
16417
16418
+
16419
+ @pytest.mark.parametrize("transport_name", [
16420
+ "grpc_asyncio",
16421
+ ])
16422
+ async def test_transport_kind_async(transport_name):
16423
+ transport = AssetServiceAsyncClient.get_transport_class(transport_name)(
16424
+ credentials=async_anonymous_credentials(),
16425
+ )
16426
+ assert transport.kind == transport_name
16427
+
16428
+
16418
16429
def test_transport_grpc_default():
16419
16430
# A client should use the gRPC transport by default.
16420
16431
client = AssetServiceClient(
Original file line number Diff line number Diff line change @@ -3500,6 +3500,17 @@ def test_transport_kind(transport_name):
3500
3500
)
3501
3501
assert transport .kind == transport_name
3502
3502
3503
+
3504
+ @pytest .mark .parametrize ("transport_name" , [
3505
+ "grpc_asyncio" ,
3506
+ ])
3507
+ async def test_transport_kind_async (transport_name ):
3508
+ transport = IAMCredentialsAsyncClient .get_transport_class (transport_name )(
3509
+ credentials = async_anonymous_credentials (),
3510
+ )
3511
+ assert transport .kind == transport_name
3512
+
3513
+
3503
3514
def test_transport_grpc_default ():
3504
3515
# A client should use the gRPC transport by default.
3505
3516
client = IAMCredentialsClient (
Original file line number Diff line number Diff line change @@ -13847,6 +13847,17 @@ def test_transport_kind(transport_name):
13847
13847
)
13848
13848
assert transport.kind == transport_name
13849
13849
13850
+
13851
+ @pytest.mark.parametrize("transport_name", [
13852
+ "grpc_asyncio",
13853
+ ])
13854
+ async def test_transport_kind_async(transport_name):
13855
+ transport = EventarcAsyncClient.get_transport_class(transport_name)(
13856
+ credentials=async_anonymous_credentials(),
13857
+ )
13858
+ assert transport.kind == transport_name
13859
+
13860
+
13850
13861
def test_transport_grpc_default():
13851
13862
# A client should use the gRPC transport by default.
13852
13863
client = EventarcClient(
Original file line number Diff line number Diff line change @@ -12344,6 +12344,17 @@ def test_transport_kind(transport_name):
12344
12344
)
12345
12345
assert transport.kind == transport_name
12346
12346
12347
+
12348
+ @pytest.mark.parametrize("transport_name", [
12349
+ "grpc_asyncio",
12350
+ ])
12351
+ async def test_transport_kind_async(transport_name):
12352
+ transport = ConfigServiceV2AsyncClient.get_transport_class(transport_name)(
12353
+ credentials=async_anonymous_credentials(),
12354
+ )
12355
+ assert transport.kind == transport_name
12356
+
12357
+
12347
12358
def test_transport_grpc_default():
12348
12359
# A client should use the gRPC transport by default.
12349
12360
client = ConfigServiceV2Client(
Original file line number Diff line number Diff line change @@ -3108,6 +3108,17 @@ def test_transport_kind(transport_name):
3108
3108
)
3109
3109
assert transport .kind == transport_name
3110
3110
3111
+
3112
+ @pytest .mark .parametrize ("transport_name" , [
3113
+ "grpc_asyncio" ,
3114
+ ])
3115
+ async def test_transport_kind_async (transport_name ):
3116
+ transport = LoggingServiceV2AsyncClient .get_transport_class (transport_name )(
3117
+ credentials = async_anonymous_credentials (),
3118
+ )
3119
+ assert transport .kind == transport_name
3120
+
3121
+
3111
3122
def test_transport_grpc_default ():
3112
3123
# A client should use the gRPC transport by default.
3113
3124
client = LoggingServiceV2Client (
Original file line number Diff line number Diff line change @@ -2915,6 +2915,17 @@ def test_transport_kind(transport_name):
2915
2915
)
2916
2916
assert transport .kind == transport_name
2917
2917
2918
+
2919
+ @pytest .mark .parametrize ("transport_name" , [
2920
+ "grpc_asyncio" ,
2921
+ ])
2922
+ async def test_transport_kind_async (transport_name ):
2923
+ transport = MetricsServiceV2AsyncClient .get_transport_class (transport_name )(
2924
+ credentials = async_anonymous_credentials (),
2925
+ )
2926
+ assert transport .kind == transport_name
2927
+
2928
+
2918
2929
def test_transport_grpc_default ():
2919
2930
# A client should use the gRPC transport by default.
2920
2931
client = MetricsServiceV2Client (
Original file line number Diff line number Diff line change @@ -8413,6 +8413,17 @@ def test_transport_kind(transport_name):
8413
8413
)
8414
8414
assert transport .kind == transport_name
8415
8415
8416
+
8417
+ @pytest .mark .parametrize ("transport_name" , [
8418
+ "grpc_asyncio" ,
8419
+ ])
8420
+ async def test_transport_kind_async (transport_name ):
8421
+ transport = CloudRedisAsyncClient .get_transport_class (transport_name )(
8422
+ credentials = async_anonymous_credentials (),
8423
+ )
8424
+ assert transport .kind == transport_name
8425
+
8426
+
8416
8427
def test_transport_grpc_default ():
8417
8428
# A client should use the gRPC transport by default.
8418
8429
client = CloudRedisClient (
You can’t perform that action at this time.
0 commit comments