mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-03 10:25:51 +00:00
100% coverage for metasync
This commit is contained in:
parent
d1d47256ab
commit
5300e6816b
1 changed files with 10 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue