def test_get_lookup_not_present(self): config = SQLStorageConfiguration() engine = SQLStorageEngine(config) engine.initialise() store = SQLPersonStore(engine) store.empty() collection = store.get_lookup() self.assertEquals({}, collection)
def test_upload_from_file_add_document_false(self): config = SQLStorageConfiguration() engine = SQLStorageEngine(config) engine.initialise() store = SQLPersonStore(engine) store.empty() count, success = store.upload_from_file("lookups.txtx") self.assertEqual(0, count) self.assertEqual(0, success)
def test_load_no_collection(self): config = SQLStorageConfiguration() engine = SQLStorageEngine(config) engine.initialise() store = SQLPersonStore(engine) collection = TestCollection() store.load(collection) self.assertEquals(0, len(collection.pairs.keys()))
def test_upload_csv_file(self): config = SQLStorageConfiguration() engine = SQLStorageEngine(config) engine.initialise() store = SQLPersonStore(engine) self.assert_upload_csv_file(store)
def test_lookup_storage(self): config = SQLStorageConfiguration() engine = SQLStorageEngine(config) engine.initialise() store = SQLPersonStore(engine) self.assert_lookup_storage(store)
def test_process_line_verbose(self): config = SQLStorageConfiguration() engine = SQLStorageEngine(config) engine.initialise() store = SQLPersonStore(engine) store.empty() store.process_line("test", ["field1", "field2"], verbose=True) store.process_line("test", ["field1", "field2"], verbose=False)
def test_get_lookup_present(self): config = SQLStorageConfiguration() engine = SQLStorageEngine(config) engine.initialise() store = SQLPersonStore(engine) store.empty() store.add_to_lookup("key1", "value1", overwrite_existing=True) collection = store.get_lookup() self.assertIsNotNone(collection )
def _get_store(storetype, engine): if storetype == 'categories': return SQLCategoryStore(engine) if storetype == 'maps': return SQLMapsStore(engine) if storetype == 'sets': return SQLSetsStore(engine) if storetype == 'rdfs': return SQLRDFsStore(engine) if storetype == 'preprocessors': return SQLPreProcessorsStore(engine) if storetype == 'postprocessors': return SQLPostProcessorsStore(engine) if storetype == 'postquestionprocessors': return SQLPostQuestionProcessorsStore(engine) if storetype == 'templatenodes': return SQLTemplateNodesStore(engine) if storetype == 'patternnodes': return SQLPatternNodesStore(engine) if storetype == 'properties': return SQLPropertyStore(engine) if storetype == 'defaults': return SQLDefaultVariableStore(engine) if storetype == 'regexes': return SQLRegexStore(engine) if storetype == 'denormals': return SQLDenormalStore(engine) if storetype == 'normals': return SQLNormalStore(engine) if storetype == 'genders': return SQLGenderStore(engine) if storetype == 'persons': return SQLPersonStore(engine) if storetype == 'person2s': return SQLPerson2Store(engine) if storetype == 'spelling': return SQLSpellingStore(engine) if storetype == 'licenses': return SQLLicenseKeysStore(engine) if storetype == 'usergroups': return SQLUserGroupStore(engine) if storetype == 'triggers': return SQLTriggersStore(engine) if storetype == 'oobs': return SQLOOBsStore(engine) if storetype == 'services': return SQLServicesStore(engine) raise Exception("Unknown entity storetype [%s]" % storetype)
def test_load_all(self): config = SQLStorageConfiguration() engine = SQLStorageEngine(config) engine.initialise() store = SQLPersonStore(engine) store.add_to_lookup("key1", "value1", overwrite_existing=True) collection = TestCollection() store.load_all(collection) self.assertEquals(1, len(collection.pairs.keys())) self.assertTrue(collection.has_key("key1")) self.assertEqual([re.compile('(^key1|key1|key1$)', re.IGNORECASE), 'VALUE1'], collection.value("key1"))
def person_store(self): return SQLPersonStore(self)
def test_initialise(self): config = SQLStorageConfiguration() engine = SQLStorageEngine(config) engine.initialise() store = SQLPersonStore(engine) self.assertEqual(store.storage_engine, engine)