Ejemplo n.º 1
0
 def setUp(self):
     test_util.InitAppHostingApi()
     self._tree = datastore_tree.DatastoreTree()
     self._tree.Clear()
     self._tree.SetFile('/foo', '123')
     self._tree.SetFile('/bar', '456')
     self.time_created = datetime.datetime.utcnow()
Ejemplo n.º 2
0
 def setUp(self):
     test_util.InitAppHostingApi()
     self._tree = datastore_tree.DatastoreTree()
     self._application = shell.MakeShellApp(self._tree, 'TEST')
     # these are updated after StartResponse is called
     self._status = None
     self._headers = None
     self._output = ''
Ejemplo n.º 3
0
    def setUp(self, tree=None):
        test_util.InitAppHostingApi()
        self.SetUpApplication(tree)
        # these are updated after StartResponse is called
        self._status = None
        self._headers = None
        self._output = ''

        # consistent JSON output for tests
        common.config.JSON_ENCODER = json.JSONEncoder()
        common.config.JSON_ENCODER.indent = None
        common.config.JSON_ENCODER.sort_keys = True

        common.config.ALLOWED_USER_CONTENT_HOSTS = None
Ejemplo n.º 4
0
def setUp():
  global _MODULE_SETUP  # pylint: disable-msg=W0603
  if _MODULE_SETUP:
    return
  _MODULE_SETUP = True

  test_util.InitAppHostingApi()

  global _ROOT_ITEM_KEY  # pylint: disable-msg=W0603
  _ROOT_ITEM_KEY = Item(key_name='root_entity')  # pylint: disable-msg=C6409

  # add some data
  for x in range(5):
    for y in range(5):
      for z in range(5):
        name = '%d%d%d' % (x, y, z)
        Item(key_name=name, parent=_ROOT_ITEM_KEY, x=x, y=y, z=z).put()
Ejemplo n.º 5
0
 def setUp(self):
   test_util.InitAppHostingApi()
   # save os.environ state so we car restore it in tearDown
   self._environ = os.environ.copy()
   os.environ.pop('HTTP_X_APPENGINE_CURRENT_NAMESPACE', None)
   # used by app_identity.get_default_version_hostname()
   os.environ['DEFAULT_VERSION_HOSTNAME'] = 'your-app-id.appspot.com'
   # we set it here to prevent contaimination, may be overridden in tests
   os.environ['HTTP_HOST'] = 'your-app-id.appspot.com'
   # TODO: add tests for app.yaml 'secure: always'
   os.environ['wsgi.url_scheme'] = 'http'
   os.environ['PATH_INFO'] = ''
   os.environ['QUERY_STRING'] = ''
   mimic._dev_appserver_state = {}
   # files that will be part of the tree
   self._files = {}
   # these are filled in from mimic's response during CallMimic()
   self._status = None
   self._headers = {}
   self._body = ''
   self._users_mod = FakeUsersMod()
   os.environ['HTTP_COOKIE'] = 'SID=ghi; SSID=def; HSID=abc;'
Ejemplo n.º 6
0
 def setUp(self):
     test_util.InitAppHostingApi()