Esempio n. 1
0
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)
Esempio n. 2
0
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"
Esempio n. 3
0
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)
Esempio n. 4
0
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"
Esempio n. 5
0
    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")
Esempio n. 6
0
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)
Esempio n. 7
0
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"
Esempio n. 8
0
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)
Esempio n. 9
0
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"