예제 #1
0
def test_openbutton_inside_when_unlocked():
    states = dlockoslo.States(lock=dlockoslo.Unlocked(since=1))
    assert states.lock.state == 'Unlocked'
    inputs = dict(openbutton_inside=True, )
    states = dlockoslo.next_state(states, dlockoslo.Inputs(**inputs))
    # should just open, leave lock alone
    assert states.lock.state == 'Unlocked'
    assert states.opener.state == 'TemporarilyActive'
예제 #2
0
def test_openbutton_outside_when_unlocked():
    states = dlockoslo.States(lock=dlockoslo.Unlocked(since=1))
    assert states.lock.state == 'Unlocked'
    inputs = dict(openbutton_outside=True, )
    states = dlockoslo.next_state(states, dlockoslo.Inputs(**inputs))
    # should _not unlock or open_ (user must open door using app first)
    assert states.lock.state == 'Unlocked'
    assert states.opener.state == 'TemporarilyActive'
예제 #3
0
def test_mqtt_unlock_duration_when_unlocked():
    states = dlockoslo.States(lock=dlockoslo.Unlocked(since=1))
    inputs = dict(mqtt_request=('unlock', True), )
    states = dlockoslo.next_state(states, dlockoslo.Inputs(**inputs))
    # should not change state
    assert states.lock.state == 'Unlocked'
예제 #4
0
def test_mqtt_lock():
    states = dlockoslo.States(lock=dlockoslo.Unlocked(since=1))
    inputs = dict(mqtt_request=('lock', True), )
    states = dlockoslo.next_state(states, dlockoslo.Inputs(**inputs))
    assert states.lock.state == 'Locked'