Skip to content

Commit

Permalink
feat: add client_options to base client class (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
HemangChothani committed Aug 13, 2020
1 parent e640e66 commit f3bedc1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion google/cloud/firestore_v1/base_client.py
Expand Up @@ -109,7 +109,10 @@ def __init__(
# will have no impact since the _http() @property only lazily
# creates a working HTTP object.
super(BaseClient, 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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -26,7 +26,7 @@
release_status = "Development Status :: 5 - Production/Stable"
dependencies = [
"google-api-core[grpc] >= 1.21.0, < 2.0.0dev",
"google-cloud-core >= 1.0.3, < 2.0dev",
"google-cloud-core >= 1.4.1, < 2.0dev",
"pytz",
"libcst >= 0.2.5",
"proto-plus >= 1.3.0",
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/v1/test_async_client.py
Expand Up @@ -63,10 +63,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,
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/v1/test_client.py
Expand Up @@ -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,
Expand Down

0 comments on commit f3bedc1

Please sign in to comment.