示例#1
0
 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'
示例#2
0
 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
示例#3
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
示例#4
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
示例#5
0
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
示例#6
0
 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