Пример #1
0
def test_revert_point_no_default():
    interface = Interface()
    interface.configure({}, registry_config)
    initial_value = interface.get_point("FloatNoDefault")
    
    scrape_values = interface.scrape_all()
    
    assert scrape_values["FloatNoDefault"] == initial_value
    
    test_value = initial_value + 1.0
    
    interface.set_point("FloatNoDefault", test_value)
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == test_value
    
    interface.revert_point("FloatNoDefault")
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == initial_value
    
    #Do it twice to make sure it restores state after revert
    interface.set_point("FloatNoDefault", test_value)
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == test_value
    
    interface.revert_point("FloatNoDefault")
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == initial_value
Пример #2
0
def test_revert_all_no_default():
    interface = Interface()
    interface.configure({}, registry_config)
    initial_value = interface.get_point("FloatNoDefault")

    scrape_values = interface.scrape_all()

    assert scrape_values["FloatNoDefault"] == initial_value

    test_value = initial_value + 1.0

    interface.set_point("FloatNoDefault", test_value)
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == test_value

    interface.revert_all()
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == initial_value

    #Do it twice to make sure it restores state after revert
    interface.set_point("FloatNoDefault", test_value)
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == test_value

    interface.revert_all()
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == initial_value
Пример #3
0
def test_revert_device():
    interface = Interface()
    interface.configure({}, registry_config)
    value = interface.get_point("Float")
    assert value == 50.0
    
    interface.set_point("Float", 25.0)
    value = interface.get_point("Float")
    assert value == 25.0
    
    interface.revert_all()
    value = interface.get_point("Float")
    assert value == 50.0
Пример #4
0
def test_revert_device():
    interface = Interface()
    interface.configure({}, registry_config)
    value = interface.get_point("Float")
    assert value == 50.0

    interface.set_point("Float", 25.0)
    value = interface.get_point("Float")
    assert value == 25.0

    interface.revert_all()
    value = interface.get_point("Float")
    assert value == 50.0
Пример #5
0
def test_revert_no_default_changing_value():
    interface = Interface()
    interface.configure({}, registry_config)
    initial_value = interface.get_point("FloatNoDefault")
    
    #Initialize the revert value.
    interface.scrape_all()
        
    new_value = initial_value + 1.0
    
    #Manually update the register values to give us something different to revert to.
    register = interface.get_register_by_name("FloatNoDefault")
    register.value = new_value
    
    #Update the revert value.
    interface.scrape_all()
    
    test_value = new_value + 1.0
    
    interface.set_point("FloatNoDefault", test_value)
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == test_value
    
    interface.revert_point("FloatNoDefault")
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == new_value
    
    assert temp_value != initial_value
    
    #Do it twice to make sure it restores state after revert
    interface.set_point("FloatNoDefault", test_value)
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == test_value
    
    interface.revert_point("FloatNoDefault")
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == new_value
Пример #6
0
def test_revert_no_default_changing_value():
    interface = Interface()
    interface.configure({}, registry_config)
    initial_value = interface.get_point("FloatNoDefault")

    #Initialize the revert value.
    interface.scrape_all()

    new_value = initial_value + 1.0

    #Manually update the register values to give us something different to revert to.
    register = interface.get_register_by_name("FloatNoDefault")
    register.value = new_value

    #Update the revert value.
    interface.scrape_all()

    test_value = new_value + 1.0

    interface.set_point("FloatNoDefault", test_value)
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == test_value

    interface.revert_point("FloatNoDefault")
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == new_value

    assert temp_value != initial_value

    #Do it twice to make sure it restores state after revert
    interface.set_point("FloatNoDefault", test_value)
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == test_value

    interface.revert_point("FloatNoDefault")
    temp_value = interface.get_point("FloatNoDefault")
    assert temp_value == new_value