Skip to content

Commit 4a914db

Browse files
committed
Update system tests to use client in place of '_implicit_envioron.'
1 parent f2c151a commit 4a914db

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

system_tests/datastore.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
import unittest2
1818

1919
from gcloud import datastore
20-
from gcloud.datastore import _implicit_environ
20+
from gcloud.datastore import client
2121
# This assumes the command is being run via tox hence the
2222
# repository root is the current directory.
2323
from system_tests import populate_datastore
2424

2525

26-
_implicit_environ._DATASET_ENV_VAR_NAME = 'GCLOUD_TESTS_DATASET_ID'
26+
client._DATASET_ENV_VAR_NAME = 'GCLOUD_TESTS_DATASET_ID'
2727
client = datastore.Client()
2828

2929

@@ -56,7 +56,7 @@ def test_allocate_ids(self):
5656

5757
class TestDatastoreSave(TestDatastore):
5858

59-
PARENT = datastore.Key('Blog', 'PizzaMan')
59+
PARENT = client.key('Blog', 'PizzaMan')
6060

6161
def _get_post(self, id_or_name=None, post_content=None):
6262
post_content = post_content or {
@@ -71,7 +71,7 @@ def _get_post(self, id_or_name=None, post_content=None):
7171
# Create an entity with the given content.
7272
# NOTE: Using a parent to ensure consistency for query
7373
# in `test_empty_kind`.
74-
key = datastore.Key('Post', parent=self.PARENT)
74+
key = client.key('Post', parent=self.PARENT)
7575
entity = datastore.Entity(key=key)
7676
entity.update(post_content)
7777

@@ -140,8 +140,8 @@ def test_empty_kind(self):
140140
class TestDatastoreSaveKeys(TestDatastore):
141141

142142
def test_save_key_self_reference(self):
143-
parent_key = datastore.Key('Residence', 'NewYork')
144-
key = datastore.Key('Person', 'name', parent=parent_key)
143+
parent_key = client.key('Residence', 'NewYork')
144+
key = client.key('Person', 'name', parent=parent_key)
145145
entity = datastore.Entity(key=key)
146146
entity['fullName'] = u'Full name'
147147
entity['linkedTo'] = key # Self reference.
@@ -164,7 +164,7 @@ class TestDatastoreQuery(TestDatastore):
164164
def setUpClass(cls):
165165
super(TestDatastoreQuery, cls).setUpClass()
166166
cls.CHARACTERS = populate_datastore.CHARACTERS
167-
cls.ANCESTOR_KEY = datastore.Key(*populate_datastore.ANCESTOR)
167+
cls.ANCESTOR_KEY = client.key(*populate_datastore.ANCESTOR)
168168

169169
def _base_query(self):
170170
return client.query(kind='Character', ancestor=self.ANCESTOR_KEY)
@@ -212,7 +212,7 @@ def test_ancestor_query(self):
212212
self.assertEqual(len(entities), expected_matches)
213213

214214
def test_query___key___filter(self):
215-
rickard_key = datastore.Key(*populate_datastore.RICKARD)
215+
rickard_key = client.key(*populate_datastore.RICKARD)
216216

217217
query = self._base_query()
218218
query.add_filter('__key__', '=', rickard_key)
@@ -327,7 +327,7 @@ def test_query_group_by(self):
327327
class TestDatastoreTransaction(TestDatastore):
328328

329329
def test_transaction(self):
330-
entity = datastore.Entity(key=datastore.Key('Company', 'Google'))
330+
entity = datastore.Entity(key=client.key('Company', 'Google'))
331331
entity['url'] = u'www.google.com'
332332

333333
with client.transaction() as xact:

system_tests/populate_datastore.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
from six.moves import zip
1818

1919
from gcloud import datastore
20-
from gcloud.datastore import _implicit_environ
20+
from gcloud.datastore import client
2121

2222

23-
_implicit_environ._DATASET_ENV_VAR_NAME = 'GCLOUD_TESTS_DATASET_ID'
23+
client._DATASET_ENV_VAR_NAME = 'GCLOUD_TESTS_DATASET_ID'
2424
CLIENT = datastore.Client()
2525

2626

0 commit comments

Comments
 (0)