Example #1
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()))
Example #2
0
    def test_add_to_lookup_overwrite_false(self):
        config = SQLStorageConfiguration()
        engine = SQLStorageEngine(config)
        engine.initialise()
        store = SQLPersonStore(engine)

        store.add_to_lookup("key1", "value1", overwrite_existing=False)
        store.add_to_lookup("key1", "value2", overwrite_existing=False)

        collection = TestCollection()

        store.load(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"))