@@ -77,13 +77,20 @@ def test__get_default_mtls_endpoint():
7777 assert {{ service.client_name }}._get_default_mtls_endpoint(non_googleapi) == non_googleapi
7878
7979
80- def test_{{ service.client_name|snake_case }}_from_service_account_info():
80+ @pytest.mark.parametrize("client_class", [
81+ {{ service.client_name }},
82+ {% - if 'grpc' in opts .transport %}
83+ {{ service.async_client_name }},
84+ {% - endif %}
85+ ])
86+ def test_{{ service.client_name|snake_case }}_from_service_account_info(client_class):
8187 creds = credentials.AnonymousCredentials()
8288 with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory:
8389 factory.return_value = creds
8490 info = {"valid": True}
85- client = {{ service.client_name }} .from_service_account_info(info)
91+ client = client_class .from_service_account_info(info)
8692 assert client.transport._credentials == creds
93+ assert isinstance(client, client_class)
8794
8895 {% if service .host %} assert client.transport._host == '{{ service.host }}{% if ":" not in service .host %} :443{% endif %} '{% endif %}
8996
@@ -100,9 +107,11 @@ def test_{{ service.client_name|snake_case }}_from_service_account_file(client_c
100107 factory.return_value = creds
101108 client = client_class.from_service_account_file("dummy/file/path.json")
102109 assert client.transport._credentials == creds
110+ assert isinstance(client, client_class)
103111
104112 client = client_class.from_service_account_json("dummy/file/path.json")
105113 assert client.transport._credentials == creds
114+ assert isinstance(client, client_class)
106115
107116 {% if service .host %} assert client.transport._host == '{{ service.host }}{% if ":" not in service .host %} :443{% endif %} '{% endif %}
108117
0 commit comments