def test_merge(config): """Test the basic logic of the merge() function.""" base = Contact(name='Original Name', email_address='*****@*****.**') remote = Contact(name='New Name', email_address='*****@*****.**') dest = Contact(name='Original Name', email_address='*****@*****.**') merge(base, remote, dest) assert dest.name == 'New Name' assert dest.email_address == '*****@*****.**'
def test_merge_conflict(config): """Test that merge() raises an error on conflict.""" base = Contact(name='Original Name', email_address='*****@*****.**') remote = Contact(name='New Name', email_address='*****@*****.**') dest = Contact(name='Some Other Name', email_address='*****@*****.**') with pytest.raises(MergeError): merge(base, remote, dest) # Check no update in case of conflict assert dest.name == 'Some Other Name' assert dest.email_address == '*****@*****.**'