How to use the pyvera.SubscriptionRegistry function in pyvera

To help you get started, we’ve selected a few pyvera examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pavoni / pyvera / tests / test_init.py View on Github external
def test__event_device_for_vera_lock_status() -> None:
    """Test function."""
    registry = SubscriptionRegistry()
    registry.set_controller(MagicMock(spec=VeraController))
    mock_lock = MagicMock(spec=VeraLock)
    mock_lock.name = MagicMock(return_value="MyTestDeadbolt")

    # Deadbolt changing but not done
    device_json: dict = {"state": STATE_JOB_IN_PROGRESS}
    registry._event_device(mock_lock, device_json, [])
    mock_lock.update.assert_not_called()

    # Deadbolt progress with reset state but not done
    device_json = {
        "state": STATE_NO_JOB,
        "comment": "MyTestDeadbolt: Sending the Z-Wave command after 0 retries",
    }
    registry._event_device(mock_lock, device_json, [])
    mock_lock.update.assert_not_called()
github pavoni / pyvera / tests / test_subscribe.py View on Github external
def test__event_device_for_vera_lock_status():
    """Test function."""
    registry = pyvera.SubscriptionRegistry()
    mock_lock = mock.create_autospec(pyvera.VeraLock)
    mock_lock.name = mock.MagicMock(return_value="MyTestDeadbolt")

    # Deadbolt changing but not done
    device_json = json.loads(
        "{"
        # subscribe.STATE_JOB_IN_PROGRESS
        '  "state": "1"'
        "}"
    )
    registry._event_device(mock_lock, device_json, [])
    mock_lock.update.assert_not_called()

    # Deadbolt progress with reset state but not done
    device_json = json.loads(
        "{"