コード例 #1
0
ファイル: test_units.py プロジェクト: gazally/indigo-omnilink
def test_notification_ignores_non_unit_notifications(
        plugin, indigo, device_factory_fields, omni1, omni_unit_types,
        device_connection_props):
    status_msg = jomni_mimic.ObjectStatus(Mock(),
                                          [Mock(side_effect=AssertionError)])
    create_unit_devices(plugin, indigo, device_factory_fields,
                        omni_unit_types, device_connection_props)
    omni1._notify("objectStausNotification", status_msg)
コード例 #2
0
ファイル: test_zones.py プロジェクト: gazally/indigo-omnilink
def test_notification_ignores_non_zone_notifications(plugin, indigo, omni1,
                                                     zone_devices):
    status_msg = jomni_mimic.ObjectStatus(Mock(),
                                          [jomni_mimic.ZoneStatus(1, 1, 100)])
    dev = indigo.devices["Front Door"]
    plugin.deviceStartComm(dev)

    omni1._notify("objectStausNotification", status_msg)
    helpers.run_concurrent_thread(plugin, 1)

    assert dev.states["condition"] == "Secure"
コード例 #3
0
ファイル: test_zones.py プロジェクト: gazally/indigo-omnilink
def test_zones_update_sensor_on_request_status_action(plugin, indigo,
                                                      zone_devices,
                                                      jomnilinkII, omni1):
    dev = indigo.devices["Front Door"]
    plugin.deviceStartComm(dev)

    action = Mock()
    action.deviceAction = indigo.kDeviceGeneralAction.RequestStatus
    status_msg = jomni_mimic.ObjectStatus(jomnilinkII.Message.OBJ_TYPE_ZONE,
                                          [jomni_mimic.ZoneStatus(1, 1, 100)])
    omni1.reqObjectStatus = Mock(return_value=status_msg)

    plugin.actionControlGeneral(action, dev)

    assert dev.states["condition"] == "Not Ready"
    assert not dev.states["onOffState"]
コード例 #4
0
ファイル: test_zones.py プロジェクト: gazally/indigo-omnilink
def test_notification_changes_device_state(plugin, indigo, zone_devices,
                                           jomnilinkII, omni1):
    dev = indigo.devices["Front Door"]
    plugin.deviceStartComm(dev)
    assert dev.states["condition"] == "Secure"
    assert not plugin.errorLog.called

    status_msg = jomni_mimic.ObjectStatus(jomnilinkII.Message.OBJ_TYPE_ZONE,
                                          [jomni_mimic.ZoneStatus(1, 1, 100)])

    omni1._notify("objectStausNotification", status_msg)
    helpers.run_concurrent_thread(plugin, 1)

    assert dev.states["condition"] == "Not Ready"
    assert not dev.states["onOffState"]
    assert dev.error_state is None
コード例 #5
0
ファイル: test_units.py プロジェクト: gazally/indigo-omnilink
def test_notification_changes_device_state(
        plugin, indigo, omni1, unit_devices, jomnilinkII_message):

    dev = indigo.devices["test Radio RA"]
    plugin.deviceStartComm(dev)
    assert not dev.states["onOffState"]
    assert dev.states["brightnessLevel"] == 0
    assert not plugin.errorLog.called

    status_msg = jomni_mimic.ObjectStatus(jomnilinkII_message.OBJ_TYPE_UNIT,
                                          [jomni_mimic.UnitStatus(2, 1, 100)])

    omni1._notify("objectStausNotification", status_msg)
    helpers.run_concurrent_thread(plugin, 1)

    assert dev.states["onOffState"]
    assert dev.states["brightnessLevel"] == 1
    assert dev.states["timeLeftSeconds"] == 100
    assert dev.error_state is None