diff --git a/spanner/google/cloud/spanner/client.py b/spanner/google/cloud/spanner/client.py index 61fa05a0f961..b260e7959aa2 100644 --- a/spanner/google/cloud/spanner/client.py +++ b/spanner/google/cloud/spanner/client.py @@ -154,6 +154,7 @@ def instance_admin_api(self): """Helper for session-related API calls.""" if self._instance_admin_api is None: self._instance_admin_api = InstanceAdminClient( + credentials=self.credentials, lib_name='gccl', lib_version=__version__, ) @@ -164,6 +165,7 @@ def database_admin_api(self): """Helper for session-related API calls.""" if self._database_admin_api is None: self._database_admin_api = DatabaseAdminClient( + credentials=self.credentials, lib_name='gccl', lib_version=__version__, ) diff --git a/spanner/tests/unit/test_client.py b/spanner/tests/unit/test_client.py index 0b0bafd4a967..98e916d8927d 100644 --- a/spanner/tests/unit/test_client.py +++ b/spanner/tests/unit/test_client.py @@ -164,6 +164,7 @@ def __init__(self, *args, **kwargs): again = client.instance_admin_api self.assertTrue(again is api) self.assertEqual(api.kwargs['lib_name'], 'gccl') + self.assertIs(api.kwargs['credentials'], client.credentials) def test_database_admin_api(self): from google.cloud._testing import _Monkey @@ -184,6 +185,7 @@ def __init__(self, *args, **kwargs): again = client.database_admin_api self.assertTrue(again is api) self.assertEqual(api.kwargs['lib_name'], 'gccl') + self.assertIs(api.kwargs['credentials'], client.credentials) def test_copy(self): credentials = _Credentials('value')