def setUp(self): self.set_up_eventloop() self.set_up_stubs() MyAutoBatcher.reset_log() self.ctx = context.Context( conn=model.make_connection(default_model=model.Expando), auto_batcher_class=MyAutoBatcher)
def setUp(self): super(QueryTests, self).setUp() tasklets.set_context(context.Context()) # Create class inside tests because kinds are cleared every test. global Foo class Foo(model.Model): name = model.StringProperty() rate = model.IntegerProperty() tags = model.StringProperty(repeated=True) self.create_entities()
def testKindError(self): ctx = context.Context() # If the cache is enabled, attempts to retrieve the object we just put will # be satisfied from the cache, so the adapter we're testing will never get # called. ctx.set_cache_policy(lambda key: False) @tasklets.tasklet def foo(): # Foo class is declared in query_test, so let's get a unusual class name. key1 = model.Key(flat=('ThisModelClassDoesntExist', 1)) ent1 = model.Expando(key=key1, foo=42, bar='hello') key = yield ctx.put(ent1) a = yield ctx.get(key1) self.assertRaises(model.KindError, foo().check_success)
def setUp(self): os.environ['APPLICATION_ID'] = '_' self.set_up_stubs() tasklets.set_context(context.Context()) self.create_entities()