Skip to content

Commit

Permalink
Testing app_engine_id() in _implicit_environ.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Feb 20, 2015
1 parent 8110425 commit db38263
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions gcloud/datastore/test__implicit_environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,31 @@ def test_value_set(self):
self.assertEqual(dataset_id, MOCK_DATASET_ID)


class Test_app_engine_id(unittest2.TestCase):

def _callFUT(self):
from gcloud.datastore import _implicit_environ
return _implicit_environ.app_engine_id()

def test_no_value(self):
from gcloud._testing import _Monkey
from gcloud.datastore import _implicit_environ

with _Monkey(_implicit_environ, app_identity=None):
dataset_id = self._callFUT()
self.assertEqual(dataset_id, None)

def test_value_set(self):
from gcloud._testing import _Monkey
from gcloud.datastore import _implicit_environ

APP_ENGINE_ID = object()
APP_IDENTITY = _AppIdentity(APP_ENGINE_ID)
with _Monkey(_implicit_environ, app_identity=APP_IDENTITY):
dataset_id = self._callFUT()
self.assertEqual(dataset_id, APP_ENGINE_ID)


class Test__determine_default_dataset_id(unittest2.TestCase):

def _callFUT(self, dataset_id=None):
Expand Down

0 comments on commit db38263

Please sign in to comment.