示例#1
0
    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)
示例#2
0
    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)
示例#3
0
    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()))
示例#4
0
    def test_upload_csv_file(self):
        config = SQLStorageConfiguration()
        engine = SQLStorageEngine(config)
        engine.initialise()
        store = SQLPersonStore(engine)

        self.assert_upload_csv_file(store)
示例#5
0
    def test_lookup_storage(self):
        config = SQLStorageConfiguration()
        engine = SQLStorageEngine(config)
        engine.initialise()
        store = SQLPersonStore(engine)

        self.assert_lookup_storage(store)
示例#6
0
    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)
示例#7
0
    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 )
示例#8
0
    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)
示例#9
0
    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"))
示例#10
0
 def person_store(self):
     return SQLPersonStore(self)
示例#11
0
 def test_initialise(self):
     config = SQLStorageConfiguration()
     engine = SQLStorageEngine(config)
     engine.initialise()
     store = SQLPersonStore(engine)
     self.assertEqual(store.storage_engine, engine)