MCPcopy
hub / github.com/pimutils/vdirsyncer / test_basic

Function test_basic

tests/unit/test_metasync.py:23–45  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

21
22
23def test_basic(monkeypatch):
24 a = MemoryStorage()
25 b = MemoryStorage()
26 status = {}
27
28 a.set_meta('foo', 'bar')
29 metasync(a, b, status, keys=['foo'])
30 assert a.get_meta('foo') == b.get_meta('foo') == 'bar'
31
32 a.set_meta('foo', 'baz')
33 metasync(a, b, status, keys=['foo'])
34 assert a.get_meta('foo') == b.get_meta('foo') == 'baz'
35
36 monkeypatch.setattr(a, 'set_meta', blow_up)
37 monkeypatch.setattr(b, 'set_meta', blow_up)
38 metasync(a, b, status, keys=['foo'])
39 assert a.get_meta('foo') == b.get_meta('foo') == 'baz'
40 monkeypatch.undo()
41 monkeypatch.undo()
42
43 b.set_meta('foo', None)
44 metasync(a, b, status, keys=['foo'])
45 assert not a.get_meta('foo') and not b.get_meta('foo')
46
47
48@pytest.fixture

Callers

nothing calls this directly

Calls 4

set_metaMethod · 0.95
get_metaMethod · 0.95
MemoryStorageClass · 0.90
metasyncFunction · 0.90

Tested by

no test coverage detected