def test_with_name_case(self, test_device): protocol = test_device.protocol modem = test_device.modem #address is intentionally badly formatted device = Base.from_config([{"32 34 56": 'tEst'}], protocol, modem) assert device[0].name == 'test' assert device[0].name_user_case == 'tEst'
def test_load_config_extra_two_addr(self, test_device, caplog): protocol = test_device.protocol modem = test_device.modem device = Base.from_config([{ "11.22.33": 'test', "aa.bb.cc": 1 }], protocol, modem) assert 'Multiple insteon addresses found in config' in caplog.text assert len(device) == 0
def test_load_config_extra_no_addr(self, test_device, caplog): protocol = test_device.protocol modem = test_device.modem device = Base.from_config([{ "not_addr": 'test', "min_hops": 1 }], protocol, modem) assert 'No insteon address found in config' in caplog.text assert len(device) == 0
def test_load_config_extra_good(self, test_device, caplog): protocol = test_device.protocol modem = test_device.modem device = Base.from_config([{ "11.22.33": 'test', "min_hops": 1 }], protocol, modem) assert device assert device[0].config_extra['min_hops'] == 1
def test_device_2(tmpdir): ''' Returns a generically configured device for testing ''' protocol = H.main.MockProtocol() modem = H.main.MockModem(tmpdir) modem.db = IM.db.Modem(None, modem) modem.scenes = IM.Scenes.SceneManager(modem, None) addr = IM.Address(0x56, 0x78, 0xcd) device = Base(protocol, modem, addr) return device
def test_no_name(self, test_device): protocol = test_device.protocol modem = test_device.modem #address is intentionally badly formatted device = Base.from_config(["3 2.34:56"], protocol, modem) assert device