@@ -47,10 +47,9 @@ def _verifyProtobufCall(self, called_with, URI, conn):
4747 conn .USER_AGENT )
4848
4949 def test_default_url (self ):
50- from gcloud .connection import API_BASE_URL
51-
50+ klass = self ._getTargetClass ()
5251 conn = self ._makeOne ()
53- self .assertEqual (conn .api_base_url , API_BASE_URL )
52+ self .assertEqual (conn .api_base_url , klass . API_BASE_URL )
5453
5554 def test_custom_url_from_env (self ):
5655 import os
@@ -143,11 +142,9 @@ def test__request_w_200(self):
143142 conn = self ._makeOne ()
144143 URI = '/' .join ([
145144 conn .api_base_url ,
146- 'datastore' ,
147145 conn .API_VERSION ,
148- 'datasets' ,
149- PROJECT ,
150- METHOD ,
146+ 'projects' ,
147+ PROJECT + ':' + METHOD ,
151148 ])
152149 http = conn ._http = Http ({'status' : '200' }, 'CONTENT' )
153150 self .assertEqual (conn ._request (PROJECT , METHOD , DATA ), 'CONTENT' )
@@ -189,11 +186,9 @@ def FromString(cls, pb):
189186 conn = self ._makeOne ()
190187 URI = '/' .join ([
191188 conn .api_base_url ,
192- 'datastore' ,
193189 conn .API_VERSION ,
194- 'datasets' ,
195- PROJECT ,
196- METHOD ,
190+ 'projects' ,
191+ PROJECT + ':' + METHOD ,
197192 ])
198193 http = conn ._http = Http ({'status' : '200' }, 'CONTENT' )
199194 response = conn ._rpc (PROJECT , METHOD , ReqPB (), RspPB )
@@ -208,11 +203,9 @@ def test_build_api_url_w_default_base_version(self):
208203 conn = self ._makeOne ()
209204 URI = '/' .join ([
210205 conn .api_base_url ,
211- 'datastore' ,
212206 conn .API_VERSION ,
213- 'datasets' ,
214- PROJECT ,
215- METHOD ,
207+ 'projects' ,
208+ PROJECT + ':' + METHOD ,
216209 ])
217210 self .assertEqual (conn .build_api_url (PROJECT , METHOD ), URI )
218211
@@ -224,11 +217,9 @@ def test_build_api_url_w_explicit_base_version(self):
224217 conn = self ._makeOne ()
225218 URI = '/' .join ([
226219 BASE ,
227- 'datastore' ,
228220 VER ,
229- 'datasets' ,
230- PROJECT ,
231- METHOD ,
221+ 'projects' ,
222+ PROJECT + ':' + METHOD ,
232223 ])
233224 self .assertEqual (conn .build_api_url (PROJECT , METHOD , BASE , VER ),
234225 URI )
@@ -242,11 +233,9 @@ def test_lookup_single_key_empty_response(self):
242233 conn = self ._makeOne ()
243234 URI = '/' .join ([
244235 conn .api_base_url ,
245- 'datastore' ,
246236 conn .API_VERSION ,
247- 'datasets' ,
248- PROJECT ,
249- 'lookup' ,
237+ 'projects' ,
238+ PROJECT + ':lookup' ,
250239 ])
251240 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
252241 found , missing , deferred = conn .lookup (PROJECT , [key_pb ])
@@ -271,11 +260,9 @@ def test_lookup_single_key_empty_response_w_eventual(self):
271260 conn = self ._makeOne ()
272261 URI = '/' .join ([
273262 conn .api_base_url ,
274- 'datastore' ,
275263 conn .API_VERSION ,
276- 'datasets' ,
277- PROJECT ,
278- 'lookup' ,
264+ 'projects' ,
265+ PROJECT + ':lookup' ,
279266 ])
280267 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
281268 found , missing , deferred = conn .lookup (PROJECT , [key_pb ],
@@ -313,11 +300,9 @@ def test_lookup_single_key_empty_response_w_transaction(self):
313300 conn = self ._makeOne ()
314301 URI = '/' .join ([
315302 conn .api_base_url ,
316- 'datastore' ,
317303 conn .API_VERSION ,
318- 'datasets' ,
319- PROJECT ,
320- 'lookup' ,
304+ 'projects' ,
305+ PROJECT + ':lookup' ,
321306 ])
322307 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
323308 found , missing , deferred = conn .lookup (PROJECT , [key_pb ],
@@ -348,11 +333,9 @@ def test_lookup_single_key_nonempty_response(self):
348333 conn = self ._makeOne ()
349334 URI = '/' .join ([
350335 conn .api_base_url ,
351- 'datastore' ,
352336 conn .API_VERSION ,
353- 'datasets' ,
354- PROJECT ,
355- 'lookup' ,
337+ 'projects' ,
338+ PROJECT + ':lookup' ,
356339 ])
357340 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
358341 (found ,), missing , deferred = conn .lookup (PROJECT , [key_pb ])
@@ -379,11 +362,9 @@ def test_lookup_multiple_keys_empty_response(self):
379362 conn = self ._makeOne ()
380363 URI = '/' .join ([
381364 conn .api_base_url ,
382- 'datastore' ,
383365 conn .API_VERSION ,
384- 'datasets' ,
385- PROJECT ,
386- 'lookup' ,
366+ 'projects' ,
367+ PROJECT + ':lookup' ,
387368 ])
388369 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
389370 found , missing , deferred = conn .lookup (PROJECT , [key_pb1 , key_pb2 ])
@@ -414,11 +395,9 @@ def test_lookup_multiple_keys_w_missing(self):
414395 conn = self ._makeOne ()
415396 URI = '/' .join ([
416397 conn .api_base_url ,
417- 'datastore' ,
418398 conn .API_VERSION ,
419- 'datasets' ,
420- PROJECT ,
421- 'lookup' ,
399+ 'projects' ,
400+ PROJECT + ':lookup' ,
422401 ])
423402 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
424403 result , missing , deferred = conn .lookup (PROJECT , [key_pb1 , key_pb2 ])
@@ -448,11 +427,9 @@ def test_lookup_multiple_keys_w_deferred(self):
448427 conn = self ._makeOne ()
449428 URI = '/' .join ([
450429 conn .api_base_url ,
451- 'datastore' ,
452430 conn .API_VERSION ,
453- 'datasets' ,
454- PROJECT ,
455- 'lookup' ,
431+ 'projects' ,
432+ PROJECT + ':lookup' ,
456433 ])
457434 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
458435 result , missing , deferred = conn .lookup (PROJECT , [key_pb1 , key_pb2 ])
@@ -490,11 +467,9 @@ def test_run_query_w_eventual_no_transaction(self):
490467 conn = self ._makeOne ()
491468 URI = '/' .join ([
492469 conn .api_base_url ,
493- 'datastore' ,
494470 conn .API_VERSION ,
495- 'datasets' ,
496- PROJECT ,
497- 'runQuery' ,
471+ 'projects' ,
472+ PROJECT + ':runQuery' ,
498473 ])
499474 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
500475 pbs , end , more , skipped = conn .run_query (PROJECT , q_pb ,
@@ -531,11 +506,9 @@ def test_run_query_wo_eventual_w_transaction(self):
531506 conn = self ._makeOne ()
532507 URI = '/' .join ([
533508 conn .api_base_url ,
534- 'datastore' ,
535509 conn .API_VERSION ,
536- 'datasets' ,
537- PROJECT ,
538- 'runQuery' ,
510+ 'projects' ,
511+ PROJECT + ':runQuery' ,
539512 ])
540513 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
541514 pbs , end , more , skipped = conn .run_query (
@@ -589,11 +562,9 @@ def test_run_query_wo_namespace_empty_result(self):
589562 conn = self ._makeOne ()
590563 URI = '/' .join ([
591564 conn .api_base_url ,
592- 'datastore' ,
593565 conn .API_VERSION ,
594- 'datasets' ,
595- PROJECT ,
596- 'runQuery' ,
566+ 'projects' ,
567+ PROJECT + ':runQuery' ,
597568 ])
598569 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
599570 pbs , end , more , skipped = conn .run_query (PROJECT , q_pb )
@@ -624,11 +595,9 @@ def test_run_query_w_namespace_nonempty_result(self):
624595 conn = self ._makeOne ()
625596 URI = '/' .join ([
626597 conn .api_base_url ,
627- 'datastore' ,
628598 conn .API_VERSION ,
629- 'datasets' ,
630- PROJECT ,
631- 'runQuery' ,
599+ 'projects' ,
600+ PROJECT + ':runQuery' ,
632601 ])
633602 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
634603 pbs = conn .run_query (PROJECT , q_pb , 'NS' )[0 ]
@@ -651,11 +620,9 @@ def test_begin_transaction(self):
651620 conn = self ._makeOne ()
652621 URI = '/' .join ([
653622 conn .api_base_url ,
654- 'datastore' ,
655623 conn .API_VERSION ,
656- 'datasets' ,
657- PROJECT ,
658- 'beginTransaction' ,
624+ 'projects' ,
625+ PROJECT + ':beginTransaction' ,
659626 ])
660627 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
661628 self .assertEqual (conn .begin_transaction (PROJECT ), TRANSACTION )
@@ -684,11 +651,9 @@ def test_commit_wo_transaction(self):
684651 conn = self ._makeOne ()
685652 URI = '/' .join ([
686653 conn .api_base_url ,
687- 'datastore' ,
688654 conn .API_VERSION ,
689- 'datasets' ,
690- PROJECT ,
691- 'commit' ,
655+ 'projects' ,
656+ PROJECT + ':commit' ,
692657 ])
693658 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
694659
@@ -732,11 +697,9 @@ def test_commit_w_transaction(self):
732697 conn = self ._makeOne ()
733698 URI = '/' .join ([
734699 conn .api_base_url ,
735- 'datastore' ,
736700 conn .API_VERSION ,
737- 'datasets' ,
738- PROJECT ,
739- 'commit' ,
701+ 'projects' ,
702+ PROJECT + ':commit' ,
740703 ])
741704 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
742705
@@ -771,11 +734,9 @@ def test_rollback_ok(self):
771734 conn = self ._makeOne ()
772735 URI = '/' .join ([
773736 conn .api_base_url ,
774- 'datastore' ,
775737 conn .API_VERSION ,
776- 'datasets' ,
777- PROJECT ,
778- 'rollback' ,
738+ 'projects' ,
739+ PROJECT + ':rollback' ,
779740 ])
780741 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
781742 self .assertEqual (conn .rollback (PROJECT , TRANSACTION ), None )
@@ -794,11 +755,9 @@ def test_allocate_ids_empty(self):
794755 conn = self ._makeOne ()
795756 URI = '/' .join ([
796757 conn .api_base_url ,
797- 'datastore' ,
798758 conn .API_VERSION ,
799- 'datasets' ,
800- PROJECT ,
801- 'allocateIds' ,
759+ 'projects' ,
760+ PROJECT + ':allocateIds' ,
802761 ])
803762 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
804763 self .assertEqual (conn .allocate_ids (PROJECT , []), [])
@@ -827,11 +786,9 @@ def test_allocate_ids_non_empty(self):
827786 conn = self ._makeOne ()
828787 URI = '/' .join ([
829788 conn .api_base_url ,
830- 'datastore' ,
831789 conn .API_VERSION ,
832- 'datasets' ,
833- PROJECT ,
834- 'allocateIds' ,
790+ 'projects' ,
791+ PROJECT + ':allocateIds' ,
835792 ])
836793 http = conn ._http = Http ({'status' : '200' }, rsp_pb .SerializeToString ())
837794 self .assertEqual (conn .allocate_ids (PROJECT , before_key_pbs ),
0 commit comments