def test_property(property, type, value, partition, label): change = Change(property=property, new_value=value, old_value=None, type=type, key=label) evt = ChangeEvent(change_object=change, property_map=Panel_EVO192.property_map) assert evt assert len(evt.message) > 0 print(evt.message)
def test_partition_arm_message(): change = Change(property="arm", new_value=True, type="partition", key="Fridge") evt = ChangeEvent(change_object=change, property_map=Panel.property_map) assert evt assert evt.message == "Partition Fridge is armed"
def test_property_map_bad(): change = Change(property='does_not_exist', new_value=True, old_value=None, type='system', key='alarm_in_memory') with pytest.raises(AssertionError): ChangeEvent(change_object=change, property_map=Panel_EVO192.property_map)
def test_property_map_value(): change = Change(property='arm', new_value=True, old_value=None, type='partition', key='Fridge') evt = ChangeEvent(change_object=change, property_map=Panel_EVO192.property_map) assert evt assert evt.message == "Partition Fridge is armed"
def _on_property_change(self, change: Change): if change.initial: return try: event = ChangeEvent(change_object=change, property_map=self.panel.property_map, label_provider=self.get_label) if cfg.LOGGING_DUMP_EVENTS: logger.debug("ChangeEvent: {}".format(event)) ps.sendEvent(event) except AssertionError: logger.debug("Could not create event from change")
def test_property_map_bad(): change = Change(property="dcd", new_value=3.33, type="system", key="power") with pytest.raises(AssertionError): ChangeEvent(change_object=change, property_map=Panel.property_map)
def test_property_map_value(): change = Change(property="dc", new_value=3.33, type="system", key="power") evt = ChangeEvent(change_object=change, property_map=Panel.property_map) assert evt assert evt.message == "DC voltage is 3.33V"
def test_property_map_bad(): change = Change(property='dcd', new_value=3.33, type='system', key='power') with pytest.raises(AssertionError): ChangeEvent(change_object=change, property_map=Panel.property_map)
def test_property_map_value(): change = Change(property='dc', new_value=3.33, type='system', key='power') evt = ChangeEvent(change_object=change, property_map=Panel.property_map) assert evt assert evt.message == "DC voltage is 3.33V"