Example #1
0
    def InitDatastore(self):
        """Initializes the data store."""
        self.token = access_control.ACLToken(username="******",
                                             reason="Running tests")
        config_lib.CONFIG.Set("Mongo.db_name",
                              "grr_test_%s" % self.__class__.__name__)
        data_store.DB = mongo_data_store.MongoDataStore()
        data_store.DB.security_manager = test_lib.MockSecurityManager()

        self.DestroyDatastore()
Example #2
0
    def InitTable(self):
        """Initializes the data store."""
        self.token = access_control.ACLToken(username="******",
                                             reason="Running tests")
        config_lib.CONFIG.Set("Mongo.db_name",
                              "grr_test_%s" % self.__class__.__name__)
        data_store.DB = mongo_data_store.MongoDataStore()
        data_store.DB.security_manager = test_lib.MockSecurityManager()

        # Drop the collection.
        data_store.DB.db_handle.drop_collection(
            data_store.DB.latest_collection)
        data_store.DB.db_handle.drop_collection(
            data_store.DB.versioned_collection)