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