def setUp(self): super(ContextTests, self).setUp() self.set_up_eventloop() MyAutoBatcher.reset_log() self.ctx = context.Context( conn=model.make_connection(default_model=model.Expando), auto_batcher_class=MyAutoBatcher)
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 __init__(self, conn=None, auto_batcher_class=AutoBatcher, config=None): if conn is None: conn = model.make_connection(config) else: assert config is None # It wouldn't be used. self._conn = conn self._auto_batcher_class = auto_batcher_class self._get_batcher = auto_batcher_class(self._get_tasklet) self._put_batcher = auto_batcher_class(self._put_tasklet) self._delete_batcher = auto_batcher_class(self._delete_tasklet) self._cache = {}
def __init__(self, conn=None, auto_batcher_class=AutoBatcher): if conn is None: conn = model.make_connection() self._conn = conn self._auto_batcher_class = auto_batcher_class self._get_batcher = auto_batcher_class(self._get_tasklet) self._put_batcher = auto_batcher_class(self._put_tasklet) self._delete_batcher = auto_batcher_class(self._delete_tasklet) self._cache = {} self._cache_policy = None self._memcache_policy = None
def __init__(self, conn=None, auto_batcher_class=AutoBatcher): if conn is None: conn = model.make_connection() self._conn = conn self._auto_batcher_class = auto_batcher_class self._get_batcher = auto_batcher_class(self._get_tasklet) self._put_batcher = auto_batcher_class(self._put_tasklet) self._delete_batcher = auto_batcher_class(self._delete_tasklet) self._cache = {} self._cache_policy = lambda key: True self._memcache_policy = lambda key: True self._memcache_prefix = 'NDB:' # TODO: Use this.
def setUp(self): """Set up test framework. Configures basic environment variables, stubs and creates a default connection. """ os.environ['APPLICATION_ID'] = self.APP_ID self.set_up_stubs() self.conn = model.make_connection() self.ResetKindMap()
def setUp(self): """Set up test framework. Configures basic environment variables, stubs and creates a default connection. """ os.environ["APPLICATION_ID"] = self.APP_ID # Set the defeault AUTH_DOMAIN, otherwise datastore_file_stub.py # can't compare User objects. os.environ["AUTH_DOMAIN"] = "example.com" self.set_up_stubs() self.conn = model.make_connection() self.ResetKindMap() self.SetupContextCache()
def testContext_MultiRpc(self): # This test really tests the proper handling of MultiRpc by # queue_rpc() in eventloop.py. It's easier to test from here, and # gives more assurance that it works. config = datastore_rpc.Configuration(max_get_keys=3, max_put_entities=3) self.ctx._conn = model.make_connection(config, default_model=model.Expando) @tasklets.tasklet def foo(): ents = [model.Expando() for i in range(10)] futs = [self.ctx.put(ent) for ent in ents] keys = yield futs futs = [self.ctx.get(key) for key in keys] ents2 = yield futs self.assertEqual(ents2, ents) raise tasklets.Return(keys) keys = foo().get_result() self.assertEqual(len(keys), 10)
def setUp(self): """Set up test framework. Configures basic environment variables, stubs and creates a default connection. """ os.environ['APPLICATION_ID'] = self.APP_ID # Set the defeault AUTH_DOMAIN, otherwise datastore_file_stub.py # can't compare User objects. os.environ['AUTH_DOMAIN'] = 'example.com' self.set_up_stubs() self.conn = model.make_connection() self.ResetKindMap() self.SetupContextCache()
def set_up_datastore(self): apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap() stub = datastore_file_stub.DatastoreFileStub('_', None) apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', stub) return model.make_connection()
def setUp(self): model.Model.ResetKindMap() self.conn = model.make_connection()