예제 #1
0
    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()
예제 #2
0
    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()
예제 #3
0
    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()
예제 #4
0
파일: db_test_mixin.py 프로젝트: 4ndygu/grr
 def setUp(self):
     super(DatabaseTestMixin, self).setUp()
     db_obj, self.cleanup = self.CreateDatabase()
     self.db = db.DatabaseValidationWrapper(db_obj)