Beispiel #1
0
def test_can_save_physical_confirmation_false_preference():
    pm = PersonManager()
    p = Person(Name='calvin')
    p.require_physical_confirmation = False
    pm.update_window_set(p)
    p = pm.get_person('calvin')
    assert not p.require_physical_confirmation
Beispiel #2
0
def test_person_req_phys_conf_sets_req_phys_conf_for_loc_verify(p_mock):
    pm = PersonManager()
    p = Person(Name='calvin')
    p.require_physical_confirmation = True
    pm.update_window_set(p)
    lv = LocationVerification(LocationName='room', PersonName='calvin')
    assert lv.person.require_physical_confirmation
Beispiel #3
0
def test_verify_switch_with_press_returns_true():
    rpi_mock.GPIO.setmode.return_value = None
    rpi_mock.GPIO.setup.return_value = None
    rpi_mock.GPIO.input.return_value = False
    pm = PersonManager()
    p = Person(Name='calvin')
    p.require_physical_confirmation = True
    pm.update_window_set(p)
    l = LocationAvailability(LocationName='kitchen')
    id = 12
    l.with_switch(HardwareId=id, Color='Red', Name='Test', Style='Circle')
    lm = LocationManager()
    lm.update_input_capabilities(l)
    lv = LocationVerification(LocationName='kitchen', PersonName='calvin')

    done, count, timeout = lv.verify_person_at_location()
    print done, count, timeout
    assert done and count == 1 and timeout < 3
Beispiel #4
0
def test_location_verify_sets_person(p_mock):
    p = Person(Name='calvin')
    p.require_physical_confirmation = True
    p_mock.return_value = p
    lv = LocationVerification(LocationName='room', PersonName='calvin')
    assert p.name == lv.person_name