@@ -128,6 +128,7 @@ def _make_one(
128128 namespace = None ,
129129 credentials = None ,
130130 client_info = None ,
131+ client_options = None ,
131132 _http = None ,
132133 _use_grpc = None ,
133134 ):
@@ -136,6 +137,7 @@ def _make_one(
136137 namespace = namespace ,
137138 credentials = credentials ,
138139 client_info = client_info ,
140+ client_options = client_options ,
139141 _http = _http ,
140142 _use_grpc = _use_grpc ,
141143 )
@@ -172,6 +174,7 @@ def test_constructor_w_implicit_inputs(self):
172174 self .assertIs (client ._credentials , creds )
173175 self .assertIs (client ._client_info , _CLIENT_INFO )
174176 self .assertIsNone (client ._http_internal )
177+ self .assertIsNone (client ._client_options )
175178 self .assertEqual (client .base_url , _DATASTORE_BASE_URL )
176179
177180 self .assertIsNone (client .current_batch )
@@ -181,18 +184,20 @@ def test_constructor_w_implicit_inputs(self):
181184 _determine_default_project .assert_called_once_with (None )
182185
183186 def test_constructor_w_explicit_inputs (self ):
184- from google .cloud . datastore . client import _DATASTORE_BASE_URL
187+ from google .api_core . client_options import ClientOptions
185188
186189 other = "other"
187190 namespace = "namespace"
188191 creds = _make_credentials ()
189192 client_info = mock .Mock ()
193+ client_options = ClientOptions ("endpoint" )
190194 http = object ()
191195 client = self ._make_one (
192196 project = other ,
193197 namespace = namespace ,
194198 credentials = creds ,
195199 client_info = client_info ,
200+ client_options = client_options ,
196201 _http = http ,
197202 )
198203 self .assertEqual (client .project , other )
@@ -201,8 +206,8 @@ def test_constructor_w_explicit_inputs(self):
201206 self .assertIs (client ._client_info , client_info )
202207 self .assertIs (client ._http_internal , http )
203208 self .assertIsNone (client .current_batch )
209+ self .assertIs (client ._base_url , "endpoint" )
204210 self .assertEqual (list (client ._batch_stack ), [])
205- self .assertEqual (client .base_url , _DATASTORE_BASE_URL )
206211
207212 def test_constructor_use_grpc_default (self ):
208213 import google .cloud .datastore .client as MUT
@@ -243,12 +248,39 @@ def test_constructor_gcd_host(self):
243248 self .assertEqual (client .base_url , "http://" + host )
244249
245250 def test_base_url_property (self ):
251+ from google .cloud .datastore .client import _DATASTORE_BASE_URL
252+ from google .api_core .client_options import ClientOptions
253+
246254 alternate_url = "https://alias.example.com/"
247255 project = "PROJECT"
248256 creds = _make_credentials ()
249257 http = object ()
258+ client_options = ClientOptions ()
250259
251- client = self ._make_one (project = project , credentials = creds , _http = http )
260+ client = self ._make_one (
261+ project = project ,
262+ credentials = creds ,
263+ _http = http ,
264+ client_options = client_options ,
265+ )
266+ self .assertEqual (client .base_url , _DATASTORE_BASE_URL )
267+ client .base_url = alternate_url
268+ self .assertEqual (client .base_url , alternate_url )
269+
270+ def test_base_url_property_w_client_options (self ):
271+ alternate_url = "https://alias.example.com/"
272+ project = "PROJECT"
273+ creds = _make_credentials ()
274+ http = object ()
275+ client_options = {"api_endpoint" : "endpoint" }
276+
277+ client = self ._make_one (
278+ project = project ,
279+ credentials = creds ,
280+ _http = http ,
281+ client_options = client_options ,
282+ )
283+ self .assertEqual (client .base_url , "endpoint" )
252284 client .base_url = alternate_url
253285 self .assertEqual (client .base_url , alternate_url )
254286
0 commit comments