예제 #1
0
def test_diff_element_dict_with_diffs_no_attrs():
    element = DiffElement("interface", "eth0", {
        "device_name": "device1",
        "name": "eth0"
    })
    element.add_attrs(source={})
    assert element.dict() == {"+": {}}
    element.add_attrs(dest={})
    assert element.dict() == {"+": {}, "-": {}}
예제 #2
0
def test_diff_element_dict_with_diffs():
    element = DiffElement("interface", "eth0", {
        "device_name": "device1",
        "name": "eth0"
    })
    element.add_attrs(source={
        "interface_type": "ethernet",
        "description": "my interface"
    })
    assert element.dict() == {
        "+": {
            "description": "my interface",
            "interface_type": "ethernet"
        }
    }
    element.add_attrs(dest={"description": "your interface"})
    assert element.dict() == {
        "-": {
            "description": "your interface"
        },
        "+": {
            "description": "my interface"
        }
    }
예제 #3
0
def test_diff_element_dict_with_no_diffs():
    element = DiffElement("interface", "eth0", {"device_name": "device1", "name": "eth0"})
    assert element.dict() == {}