100% coverage for metasync

This commit is contained in:
Markus Unterwaditzer 2016-02-25 02:18:43 +01:00
parent d1d47256ab
commit 5300e6816b

View file

@ -5,6 +5,8 @@ import pytest
from vdirsyncer.metasync import MetaSyncConflict, metasync
from vdirsyncer.storage.memory import MemoryStorage
from . import blow_up
def test_irrelevant_status():
a = MemoryStorage()
@ -15,7 +17,7 @@ def test_irrelevant_status():
assert not status
def test_basic():
def test_basic(monkeypatch):
a = MemoryStorage()
b = MemoryStorage()
status = {}
@ -28,6 +30,13 @@ def test_basic():
metasync(a, b, status, keys=['foo'])
assert a.get_meta('foo') == b.get_meta('foo') == 'baz'
monkeypatch.setattr(a, 'set_meta', blow_up)
monkeypatch.setattr(b, 'set_meta', blow_up)
metasync(a, b, status, keys=['foo'])
assert a.get_meta('foo') == b.get_meta('foo') == 'baz'
monkeypatch.undo()
monkeypatch.undo()
b.set_meta('foo', None)
metasync(a, b, status, keys=['foo'])
assert a.get_meta('foo') is b.get_meta('foo') is None