def test_device_update(self): mock = MagicMock() mock.side_effect = [ device_list_battery_ok_xml, device_list_battery_low_xml, ] fritz = Fritzhome('10.0.0.1', 'user', 'pass') fritz._request = mock element = fritz.get_device_element('11959 0171328') device = FritzhomeDevice(fritz=fritz, node=element) assert_false(device.battery_low) device.update() assert_true(device.battery_low)
def get_switch_test_device(): mock = MagicMock() mock.side_effect = [device_list_xml, '1'] fritz = Fritzhome('10.0.0.1', 'user', 'pass') fritz._request = mock element = fritz.get_device_element('08761 0000434') device = FritzhomeDevice(fritz=fritz, node=element) return device
def get_switch_test_device(): mock = MagicMock() mock.side_effect = [response("device_list"), "1"] fritz = Fritzhome("10.0.0.1", "user", "pass") fritz._request = mock element = fritz.get_device_element("08761 0000434") device = FritzhomeDevice(fritz=fritz, node=element) return device
def test_hkr_without_temperature_values(self): self.mock.side_effect = [ Helper.response("thermostat/device_hkr_no_temp_values"), ] element = self.fritz.get_device_element("11960 0071472") device = FritzhomeDevice(node=element) eq_(device.ain, "11960 0071472") eq_(device.offset, None) eq_(device.temperature, None)
def test_hkr_without_temperature_values(self): self.mock.side_effect = [ device_hkr_no_temp_values_xml, ] element = self.fritz.get_device_element('11960 0071472') device = FritzhomeDevice(node=element) eq_(device.ain, '11960 0071472') eq_(device.offset, None) eq_(device.temperature, None)
def test_device_hkr_fw_03_54(self): mock = MagicMock() mock.side_effect = [ device_hkr_fw_03_54_xml, ] fritz = Fritzhome('10.0.0.1', 'user', 'pass') fritz._request = mock element = fritz.get_device_element('23456') device = FritzhomeDevice(node=element) eq_(device.ain, '23456') assert_true(device.present)
def test_device_init_no_devicelock_element(self): mock = MagicMock() mock.side_effect = [ device_no_devicelock_element_xml, ] fritz = Fritzhome('10.0.0.1', 'user', 'pass') fritz._request = mock element = fritz.get_device_element('08761 0373130') device = FritzhomeDevice(node=element) eq_(device.ain, '08761 0373130') assert_true(device.present)
def test_device_init_present_false(self): mock = MagicMock() mock.side_effect = [ device_not_present_xml, ] fritz = Fritzhome('10.0.0.1', 'user', 'pass') fritz._request = mock element = fritz.get_device_element('11960 0089208') device = FritzhomeDevice(node=element) eq_(device.ain, '11960 0089208') assert_false(device.present)
def test_hkr_without_temperature_values(self): mock = MagicMock() mock.side_effect = [ device_hkr_no_temp_values_xml, ] fritz = Fritzhome('10.0.0.1', 'user', 'pass') fritz._request = mock element = fritz.get_device_element('11960 0071472') device = FritzhomeDevice(node=element) eq_(device.ain, '11960 0071472') eq_(device.offset, None) eq_(device.temperature, None)
def test_device_alert_no_alertstate(self): mock = MagicMock() mock.side_effect = [ device_alert_no_alertstate_xml, ] fritz = Fritzhome('10.0.0.1', 'user', 'pass') fritz._request = mock element = fritz.get_device_element('05333 0077045-3') device = FritzhomeDevice(node=element) eq_(device.ain, '05333 0077045-3') assert_true(device.present) eq_(device.alert_state, None)
def test_device_hkr_fw_03_50(self): mock = MagicMock() mock.side_effect = [ device_hkr_fw_03_50_xml, ] fritz = Fritzhome('10.0.0.1', 'user', 'pass') fritz._request = mock element = fritz.get_device_element('12345') device = FritzhomeDevice(node=element) eq_(device.ain, '12345') assert_true(device.present) eq_(device.device_lock, None) eq_(device.lock, None) eq_(device.error_code, None) eq_(device.battery_low, None)
def test_device_init(self): mock = MagicMock() mock.side_effect = [ device_list_xml, ] fritz = Fritzhome('10.0.0.1', 'user', 'pass') fritz._request = mock element = fritz.get_device_element('08761 0000434') device = FritzhomeDevice(node=element) eq_(device.ain, '08761 0000434') eq_(device.fw_version, '03.33') assert_true(device.present) assert_true(device.has_switch) assert_true(device.has_temperature_sensor) assert_true(device.has_powermeter)