def test_diff_element_summary_with_no_diffs(): element = DiffElement("interface", "eth0", { "device_name": "device1", "name": "eth0" }) assert element.summary() == { "create": 0, "update": 0, "delete": 0, "no-change": 1 }
def test_diff_element_summary_with_diffs(): element = DiffElement("interface", "eth0", { "device_name": "device1", "name": "eth0" }) element.add_attrs(source={ "interface_type": "ethernet", "description": "my interface" }) assert element.summary() == { "create": 1, "update": 0, "delete": 0, "no-change": 0 } element.add_attrs(dest={"description": "your interface"}) assert element.summary() == { "create": 0, "update": 1, "delete": 0, "no-change": 0 }