Ejemplo n.º 1
0
    def test_storage_path(self):
        config = FileStorageConfiguration()
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileDefaultVariablesStore(engine)

        self.assertEquals('/tmp/properties/defaults.txt',
                          store._get_storage_path())
        self.assertIsInstance(store.get_storage(), FileStoreConfiguration)
Ejemplo n.º 2
0
    def test_load_variables(self):
        config = FileStorageConfiguration()
        config._defaults_storage = FileStoreConfiguration(file=os.path.dirname(__file__) + os.sep + "data" + os.sep + "lookups" + os.sep + "text" + os.sep + "defaults.txt",
                                                          format="text", encoding="utf-8", delete_on_start=False)
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileDefaultVariablesStore(engine)

        collection = PropertiesCollection()
        store.load(collection)

        self.assertTrue(collection.has_property("var1"))
        self.assertTrue("val1", collection.property("var1"))
        self.assertTrue(collection.has_property("var2"))
        self.assertTrue("val2", collection.property("val2"))
Ejemplo n.º 3
0
 def defaults_store(self):
     return FileDefaultVariablesStore(self)
Ejemplo n.º 4
0
 def test_initialise(self):
     config = FileStorageConfiguration()
     engine = FileStorageEngine(config)
     engine.initialise()
     store = FileDefaultVariablesStore(engine)
     self.assertEqual(store.storage_engine, engine)