示例#1
0
    def test_storage_path(self):
        config = FileStorageConfiguration()
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileOOBStore(engine)

        self.assertEquals('/tmp/oob/callmom.conf', store._get_storage_path())
        self.assertIsInstance(store.get_storage(), FileStoreConfiguration)
示例#2
0
    def test_load_file_contents_with_exception(self):
        config = FileStorageConfiguration()
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileOOBStore(engine)

        handler = OOBHandler()

        self.assertEqual(
            0,
            store._load_file_contents(
                handler,
                os.path.dirname(__file__) + os.sep + "data" + os.sep + "oobs" +
                os.sep + "callmom.conf"))
示例#3
0
    def test_load_oobs(self):
        config = FileStorageConfiguration()
        config._oobs_storage = FileStoreConfiguration(
            file=os.path.dirname(__file__) + os.sep + "data" + os.sep +
            "oobs" + os.sep + "callmom.conf",
            fileformat="text",
            encoding="utf-8",
            delete_on_start=False)
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileOOBStore(engine)

        handler = OOBHandler()

        store.load(handler)

        self.assertIsNotNone(handler.oobs['default'])
        self.assertIsNotNone(handler.oobs['alarm'])
        self.assertIsNotNone(handler.oobs['camera'])
示例#4
0
    def test_process_line(self):
        config = FileStorageConfiguration()
        engine = FileStorageEngine(config)
        engine.initialise()
        store = FileOOBStore(engine)

        handler = OOBHandler()

        self.assertFalse(store._process_line(handler, "", "test.conf"))
        self.assertFalse(store._process_line(handler, "OOB", "test.conf"))
        self.assertFalse(store._process_line(handler, "#", "test.conf"))
        self.assertFalse(
            store._process_line(handler,
                                "#oob1=programy.oobs.default.DefaultOOB",
                                "test.conf"))
示例#5
0
 def test_initialise(self):
     config = FileStorageConfiguration()
     engine = FileStorageEngine(config)
     engine.initialise()
     store = FileOOBStore(engine)
     self.assertEqual(store.storage_engine, engine)
示例#6
0
文件: engine.py 项目: lilnana00/3ddd
 def oobs_store(self):
     return FileOOBStore(self)