Exemple #1
0
    def test_storage_path(self):
        config = FileStorageConfiguration()
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileDenormalStore(engine)

        self.assertEquals('/tmp/lookups/denormal.txt',
                          store._get_storage_path())
        self.assertIsInstance(store.get_storage(), FileStoreConfiguration)
    def test_load_from_file(self):
        config = FileStorageConfiguration()
        config._denormal_storage = FileStoreConfiguration(
            file=os.path.dirname(__file__) + os.sep + "data" + os.sep +
            "lookups" + os.sep + "text" + os.sep + "denormal.txt",
            format="text",
            encoding="utf-8",
            delete_on_start=False)
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileDenormalStore(engine)

        denormal_collection = DenormalCollection()

        store.load(denormal_collection)

        self.assertEqual(denormal_collection.denormalise("dot com"), '.com ')
        self.assertEqual(
            denormal_collection.denormalise_string(None, "keith dot com"),
            "keith.com")
Exemple #3
0
 def denormal_store(self):
     return FileDenormalStore(self)
 def test_initialise(self):
     config = FileStorageConfiguration()
     engine = FileStorageEngine(config)
     engine.initialise()
     store = FileDenormalStore(engine)
     self.assertEqual(store.storage_engine, engine)