This repository was archived by the owner on Mar 26, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
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 Original file line number Diff line number Diff line change @@ -1041,19 +1041,9 @@ def test_transport_adc(transport_class):
10411041 transport_class()
10421042 adc.assert_called_once()
10431043
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) }}
10571047
10581048{% if 'grpc' in opts .transport %}
10591049def test_transport_grpc_default():
Original file line number Diff line number Diff line change @@ -1876,3 +1876,33 @@ def test_{{ method_name }}_empty_call():
18761876 {% endwith %} {# method_settings #}
18771877 assert args[0] == {{ method.input.ident }}()
18781878{% 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):
1641516415 )
1641616416 assert transport.kind == transport_name
1641716417
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+
1641816429def test_transport_grpc_default():
1641916430 # A client should use the gRPC transport by default.
1642016431 client = AssetServiceClient(
Original file line number Diff line number Diff line change @@ -3500,6 +3500,17 @@ def test_transport_kind(transport_name):
35003500 )
35013501 assert transport .kind == transport_name
35023502
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+
35033514def test_transport_grpc_default ():
35043515 # A client should use the gRPC transport by default.
35053516 client = IAMCredentialsClient (
Original file line number Diff line number Diff line change @@ -13847,6 +13847,17 @@ def test_transport_kind(transport_name):
1384713847 )
1384813848 assert transport.kind == transport_name
1384913849
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+
1385013861def test_transport_grpc_default():
1385113862 # A client should use the gRPC transport by default.
1385213863 client = EventarcClient(
Original file line number Diff line number Diff line change @@ -12344,6 +12344,17 @@ def test_transport_kind(transport_name):
1234412344 )
1234512345 assert transport.kind == transport_name
1234612346
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+
1234712358def test_transport_grpc_default():
1234812359 # A client should use the gRPC transport by default.
1234912360 client = ConfigServiceV2Client(
Original file line number Diff line number Diff line change @@ -3108,6 +3108,17 @@ def test_transport_kind(transport_name):
31083108 )
31093109 assert transport .kind == transport_name
31103110
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+
31113122def test_transport_grpc_default ():
31123123 # A client should use the gRPC transport by default.
31133124 client = LoggingServiceV2Client (
Original file line number Diff line number Diff line change @@ -2915,6 +2915,17 @@ def test_transport_kind(transport_name):
29152915 )
29162916 assert transport .kind == transport_name
29172917
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+
29182929def test_transport_grpc_default ():
29192930 # A client should use the gRPC transport by default.
29202931 client = MetricsServiceV2Client (
Original file line number Diff line number Diff line change @@ -8413,6 +8413,17 @@ def test_transport_kind(transport_name):
84138413 )
84148414 assert transport .kind == transport_name
84158415
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+
84168427def test_transport_grpc_default ():
84178428 # A client should use the gRPC transport by default.
84188429 client = CloudRedisClient (
You can’t perform that action at this time.
0 commit comments