mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-09 11:26:00 +00:00
Add testcase for moved hrefs.
This commit is contained in:
parent
c2949a62b5
commit
12098bcc9d
1 changed files with 24 additions and 1 deletions
|
|
@ -15,7 +15,7 @@ from vdirsyncer.storage.memory import MemoryStorage
|
|||
from vdirsyncer.sync import BothReadOnly, IdentConflict, StorageEmpty, \
|
||||
SyncConflict, sync
|
||||
|
||||
from . import assert_item_equals, normalize_item
|
||||
from . import assert_item_equals, blow_up, normalize_item
|
||||
|
||||
|
||||
def empty_storage(x):
|
||||
|
|
@ -282,3 +282,26 @@ def test_ident_conflict(sync_inbetween):
|
|||
|
||||
with pytest.raises(IdentConflict):
|
||||
sync(a, b, status)
|
||||
|
||||
|
||||
def test_moved_href():
|
||||
'''
|
||||
Concrete application: ppl_ stores contact aliases in filenames, which means
|
||||
item's hrefs get changed. Vdirsyncer doesn't synchronize this data, but
|
||||
also shouldn't do things like deleting and re-uploading to the server.
|
||||
|
||||
.. _ppl: http://ppladdressbook.org/
|
||||
'''
|
||||
a = MemoryStorage()
|
||||
b = MemoryStorage()
|
||||
status = {}
|
||||
href, etag = a.upload(Item(u'UID:haha'))
|
||||
sync(a, b, status)
|
||||
|
||||
b.items['lol'] = b.items.pop('haha')
|
||||
a.delete = a.update = a.upload = blow_up
|
||||
|
||||
sync(a, b, status)
|
||||
assert len(status) == 1
|
||||
assert len(list(a.list())) == len(list(b.list())) == 1
|
||||
assert status['haha'][2] == 'haha'
|
||||
|
|
|
|||
Loading…
Reference in a new issue