def setUp(self): # First, create an instance of the Testbed class. self.testbed = testbed.Testbed() # Then activate the testbed, which prepares the service stubs for use. self.testbed.activate() # Next, declare which service stubs you want to use. self.testbed.init_datastore_v3_stub() self.testbed.init_memcache_stub() self.storage = BlogAppengineDataStore()
class BlogDataStoreFactory(): ''' classdocs ''' storage_implementations = { 'memory': BlogMemoryDataStore(), 'appengine': BlogAppengineDataStore() } def __init__(self, storage_impl='appengine'): ''' Constructor ''' self.storage = self.storage_implementations[storage_impl] def set_storage(self, blog_storage): self.storage = blog_storage def get_storage(self): return self.storage