def setUp(self): super(ArtifactMigrationTest, self).setUp() self._db_patcher = mock.patch.object( data_store, "REL_DB", db.DatabaseValidationWrapper(mem.InMemoryDB())) self._db_patcher.start() self._artifact_patcher = mock.patch.object( artifact_registry, "REGISTRY", artifact_registry.ArtifactRegistry()) self._artifact_patcher.start()
def setUp(self): # Set up database before calling super.setUp(), in case any other mixin # depends on db during its setup. db_obj, cleanup = self.CreateDatabase() self.db = db.DatabaseValidationWrapper(db_obj) if cleanup: self.addCleanup(cleanup) # In case a test registers a message handler, unregister it. self.addCleanup(self.db.UnregisterMessageHandler) super(DatabaseTestMixin, self).setUp()
def setUp(self): # Set up database before calling super.setUp(), in case any other mixin # depends on db during its setup. db_obj, cleanup = self.CreateDatabase() patcher = mock.patch.object(data_store, "REL_DB", db.DatabaseValidationWrapper(db_obj)) patcher.start() self.addCleanup(patcher.stop) if cleanup: self.addCleanup(cleanup) # In case a test registers a message handler, unregister it. self.addCleanup(data_store.REL_DB.UnregisterMessageHandler) super(GlobalDatabaseTestMixin, self).setUp()
def setUp(self): super(DatabaseTestMixin, self).setUp() db_obj, self.cleanup = self.CreateDatabase() self.db = db.DatabaseValidationWrapper(db_obj)