Ejemplo n.º 1
0
def test_merge(config, contact_sync):
    """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='*****@*****.**')
    contact_sync.merge(base, remote, dest)
    assert dest.name == 'New Name'
    assert dest.email_address == '*****@*****.**'
Ejemplo n.º 2
0
def test_merge_conflict(config, contact_sync):
    """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):
        contact_sync.merge(base, remote, dest)

    # Check no update in case of conflict
    assert dest.name == 'Some Other Name'
    assert dest.email_address == '*****@*****.**'