Example #1
0
    def setUp(self):
        self.app_id = 'myapp'
        os.environ['APPLICATION_ID'] = self.app_id
        # Use a consistent replication strategy so the puts done in the test code
        # are seen immediately by the queries under test.
        consistent_policy = datastore_stub_util.MasterSlaveConsistencyPolicy()
        api_server.test_setup_stubs(app_id=self.app_id,
                                    datastore_consistency=consistent_policy)

        self.entity1 = datastore.Entity('Kind1', id=123, _app=self.app_id)
        self.entity1['intprop'] = 1
        self.entity1['listprop'] = [7, 8, 9]
        datastore.Put(self.entity1)

        self.entity2 = datastore.Entity('Kind1', id=124, _app=self.app_id)
        self.entity2['stringprop'] = 'value2'
        self.entity2['listprop'] = [4, 5, 6]
        datastore.Put(self.entity2)

        self.entity3 = datastore.Entity('Kind1', id=125, _app=self.app_id)
        self.entity3['intprop'] = 3
        self.entity3['stringprop'] = 'value3'
        self.entity3['listprop'] = [1, 2, 3]
        datastore.Put(self.entity3)

        self.entity4 = datastore.Entity('Kind1', id=126, _app=self.app_id)
        self.entity4['intprop'] = 4
        self.entity4['stringprop'] = 'value4'
        self.entity4['listprop'] = [10, 11, 12]
        datastore.Put(self.entity4)
 def setUp(self):
     self.app_id = 'myapp'
     os.environ['APPLICATION_ID'] = self.app_id
     # Use a consistent replication strategy so the puts done in the test code
     # are seen immediately by the queries under test.
     consistent_policy = datastore_stub_util.MasterSlaveConsistencyPolicy()
     api_server.test_setup_stubs(
         app_id=self.app_id,
         application_root=None,  # Needed to allow index updates.
         datastore_consistency=consistent_policy)
Example #3
0
    def setUp(self):
        self.app_id = 'myapp'
        os.environ['APPLICATION_ID'] = self.app_id

        # Use a consistent replication strategy so that the test can use queries
        # to verify that an entity was written.
        consistent_policy = datastore_stub_util.MasterSlaveConsistencyPolicy()
        stub_util.setup_test_stubs(app_id=self.app_id,
                                   datastore_consistency=consistent_policy)

        self.mox = mox.Mox()
        self.mox.StubOutWithMock(admin_request_handler.AdminRequestHandler,
                                 'render')
        self.mox.StubOutWithMock(admin_request_handler.AdminRequestHandler,
                                 'get')
        self.mox.StubOutWithMock(admin_request_handler.AdminRequestHandler,
                                 'post')
        self.entity1 = datastore.Entity('Kind1', id=123, _app=self.app_id)
        self.entity1['intprop'] = 1
        self.entity1['listprop'] = [7, 8, 9]
        self.entity1['dateprop'] = datastore_types._OverflowDateTime(2**60)
        datastore.Put(self.entity1)

        self.entity2 = datastore.Entity('Kind1', id=124, _app=self.app_id)
        self.entity2['stringprop'] = 'value2'
        self.entity2['listprop'] = [4, 5, 6]
        datastore.Put(self.entity2)

        self.entity3 = datastore.Entity('Kind1', id=125, _app=self.app_id)
        self.entity3['intprop'] = 3
        self.entity3['listprop'] = [1, 2, 3]
        datastore.Put(self.entity3)

        self.entity4 = datastore.Entity('Kind1', id=126, _app=self.app_id)
        self.entity4['intprop'] = 4
        self.entity4['stringprop'] = 'value4'
        self.entity4['listprop'] = [10, 11]
        datastore.Put(self.entity4)

        self.entity5 = datastore.Entity('Kind1', id=127, _app=self.app_id)
        self.entity5['intprop'] = 0
        self.entity5['boolprop'] = False
        self.entity5['stringprop'] = ''
        self.entity5['floatprop'] = 0.0
        datastore.Put(self.entity5)