From 91d6580e2903ab55798d66bc53541faa86ca76fe Mon Sep 17 00:00:00 2001 From: HemangChothani <50404902+HemangChothani@users.noreply.github.com> Date: Thu, 13 Aug 2020 22:23:12 +0530 Subject: [PATCH] feat(firestore): add client_options to base class (#148) * feat(firestore): add client_options to base class * chore: bump g-c-c to 1.4.1 Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Co-authored-by: Tres Seaver Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- google/cloud/firestore_v1/client.py | 5 ++++- setup.py | 2 +- tests/unit/v1/test_client.py | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/google/cloud/firestore_v1/client.py b/google/cloud/firestore_v1/client.py index da09b9ff4..6d0bea49c 100644 --- a/google/cloud/firestore_v1/client.py +++ b/google/cloud/firestore_v1/client.py @@ -107,7 +107,10 @@ def __init__( # will have no impact since the _http() @property only lazily # creates a working HTTP object. super(Client, self).__init__( - project=project, credentials=credentials, _http=None + project=project, + credentials=credentials, + client_options=client_options, + _http=None, ) self._client_info = client_info if client_options: diff --git a/setup.py b/setup.py index 47ab799e1..a220edd78 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ release_status = "Development Status :: 5 - Production/Stable" dependencies = [ "google-api-core[grpc] >= 1.14.0, < 2.0.0dev", - "google-cloud-core >= 1.0.3, < 2.0dev", + "google-cloud-core >= 1.4.1, < 2.0dev", "pytz", ] extras = {} diff --git a/tests/unit/v1/test_client.py b/tests/unit/v1/test_client.py index 7ec062422..74fab1484 100644 --- a/tests/unit/v1/test_client.py +++ b/tests/unit/v1/test_client.py @@ -61,10 +61,12 @@ def test_constructor_with_emulator_host(self): getenv.assert_called_once_with(_FIRESTORE_EMULATOR_HOST) def test_constructor_explicit(self): + from google.api_core.client_options import ClientOptions + credentials = _make_credentials() database = "now-db" client_info = mock.Mock() - client_options = mock.Mock() + client_options = ClientOptions("endpoint") client = self._make_one( project=self.PROJECT, credentials=credentials,