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

Function test_upload_and_update

tests/unit/sync/test_sync.py:148–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146
147
148def test_upload_and_update():
149 a = MemoryStorage(fileext='.a')
150 b = MemoryStorage(fileext='.b')
151 status = {}
152
153 item = Item('UID:1') # new item 1 in a
154 a.upload(item)
155 sync(a, b, status)
156 assert items(b) == items(a) == {item.raw}
157
158 item = Item('UID:1\nASDF:YES') # update of item 1 in b
159 b.update('1.b', item, b.get('1.b')[1])
160 sync(a, b, status)
161 assert items(b) == items(a) == {item.raw}
162
163 item2 = Item('UID:2') # new item 2 in b
164 b.upload(item2)
165 sync(a, b, status)
166 assert items(b) == items(a) == {item.raw, item2.raw}
167
168 item2 = Item('UID:2\nASDF:YES') # update of item 2 in a
169 a.update('2.a', item2, a.get('2.a')[1])
170 sync(a, b, status)
171 assert items(b) == items(a) == {item.raw, item2.raw}
172
173
174def test_deletion():

Callers

nothing calls this directly

Calls 7

uploadMethod · 0.95
updateMethod · 0.95
getMethod · 0.95
MemoryStorageClass · 0.90
ItemClass · 0.90
itemsFunction · 0.85
syncFunction · 0.70

Tested by

no test coverage detected