Ejemplo n.º 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() == {"+": {}, "-": {}}
Ejemplo n.º 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"
        }
    }
Ejemplo n.º 3
0
def test_diff_element_dict_with_no_diffs():
    element = DiffElement("interface", "eth0", {"device_name": "device1", "name": "eth0"})
    assert element.dict() == {}