Exemple #1
0
class TestInsteonIdiom(unittest.TestCase):
    def setUp(self):
        self.idiom = InsteonIdiom('test_service')
        self.fake_real_id = "bbbbbb"

    def test_create_onoffasset(self):
        asset = self.idiom.create_asset('Home Appliance', self.fake_real_id, 'ApplianceLinc V2')
        ret = perform_action(asset, 'turn_on')

        self.assertEquals('test_service', ret.to)
Exemple #2
0
class TestStorage(unittest.TestCase):
    def setUp(self):
        self.store = ModelStorage('none dir')
        self.model = Model()
        self.idiom = InsteonIdiom('test')
        self.model.add_asset(self.idiom.create_asset('test', 'aaaaaa', 'ApplianceLinc V2'))

    def test_none(self):
        self.assertIsInstance(self.store.read_model({'test' : self.idiom}, 'none'), Model)

    def test_store(self):
        self.store.write_model(self.model, 'hmm')
        test = self.store.read_model({'test' : self.idiom}, 'hmm')
        self.assertEquals(test.get_asset(test.get_all_asset_uuids()[0]).get_service(), 'test')
        files = self.store.get_files()
        self.assertEquals(['hmm'], files)

    def test_remove(self):
        self.store.remove_files()
        self.assertFalse(os.path.exists('none dir'))

    def tearDown(self):
        if os.path.exists('none dir'):
            self.store.remove_files()
Exemple #3
0
 def setUp(self):
     self.idiom = InsteonIdiom('test_service')
     self.fake_real_id = "bbbbbb"
Exemple #4
0
 def setUp(self):
     self.store = ModelStorage('none dir')
     self.model = Model()
     self.idiom = InsteonIdiom('test')
     self.model.add_asset(self.idiom.create_asset('test', 'aaaaaa', 'ApplianceLinc V2'))