mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Ensure updated items have the same UID (if any)
FastMail insists on this.
This commit is contained in:
parent
9ede54ed9b
commit
e933f6db44
3 changed files with 14 additions and 14 deletions
|
|
@ -41,7 +41,7 @@ TEL;TYPE=VOICE:412 605 0499
|
||||||
TEL;TYPE=FAX:412 605 0705
|
TEL;TYPE=FAX:412 605 0705
|
||||||
URL:http://www.example.com
|
URL:http://www.example.com
|
||||||
X-SOMETHING:{r}
|
X-SOMETHING:{r}
|
||||||
UID:{r}
|
UID:{uid}
|
||||||
END:VCARD'''
|
END:VCARD'''
|
||||||
|
|
||||||
TASK_TEMPLATE = u'''BEGIN:VCALENDAR
|
TASK_TEMPLATE = u'''BEGIN:VCALENDAR
|
||||||
|
|
@ -54,7 +54,7 @@ LAST-MODIFIED;VALUE=DATE-TIME:20140122T151338Z
|
||||||
SEQUENCE:2
|
SEQUENCE:2
|
||||||
SUMMARY:Book: Kowlani - Tödlicher Staub
|
SUMMARY:Book: Kowlani - Tödlicher Staub
|
||||||
X-SOMETHING:{r}
|
X-SOMETHING:{r}
|
||||||
UID:{r}
|
UID:{uid}
|
||||||
END:VTODO
|
END:VTODO
|
||||||
END:VCALENDAR'''
|
END:VCALENDAR'''
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ DTSTART:19970714T170000Z
|
||||||
DTEND:19970715T035959Z
|
DTEND:19970715T035959Z
|
||||||
SUMMARY:Bastille Day Party
|
SUMMARY:Bastille Day Party
|
||||||
X-SOMETHING:{r}
|
X-SOMETHING:{r}
|
||||||
UID:{r}
|
UID:{uid}
|
||||||
END:VEVENT'''
|
END:VEVENT'''
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ END:VCALENDAR'''
|
||||||
|
|
||||||
|
|
||||||
SIMPLE_TEMPLATE = u'''BEGIN:FOO
|
SIMPLE_TEMPLATE = u'''BEGIN:FOO
|
||||||
UID:{r}
|
UID:{uid}
|
||||||
X-SOMETHING:{r}
|
X-SOMETHING:{r}
|
||||||
HAHA:YES
|
HAHA:YES
|
||||||
END:FOO'''
|
END:FOO'''
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ from .. import EVENT_TEMPLATE, TASK_TEMPLATE, VCARD_TEMPLATE, \
|
||||||
assert_item_equals
|
assert_item_equals
|
||||||
|
|
||||||
|
|
||||||
def format_item(item_template):
|
def format_item(item_template, uid=None):
|
||||||
# assert that special chars are handled correctly.
|
# assert that special chars are handled correctly.
|
||||||
r = '{}@vdirsyncer'.format(random.random())
|
r = '{}@vdirsyncer'.format(random.random())
|
||||||
return Item(item_template.format(r=r))
|
return Item(item_template.format(r=r, uid=uid or r))
|
||||||
|
|
||||||
|
|
||||||
class StorageTests(object):
|
class StorageTests(object):
|
||||||
|
|
@ -45,7 +45,7 @@ class StorageTests(object):
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def get_item(self, item_template):
|
def get_item(self, item_template):
|
||||||
return lambda: format_item(item_template)
|
return lambda **kw: format_item(item_template, **kw)
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def requires_collections(self):
|
def requires_collections(self):
|
||||||
|
|
@ -91,7 +91,7 @@ class StorageTests(object):
|
||||||
href, etag = s.upload(item)
|
href, etag = s.upload(item)
|
||||||
assert_item_equals(s.get(href)[0], item)
|
assert_item_equals(s.get(href)[0], item)
|
||||||
|
|
||||||
new_item = get_item()
|
new_item = get_item(uid=item.uid)
|
||||||
new_etag = s.update(href, new_item, etag)
|
new_etag = s.update(href, new_item, etag)
|
||||||
# See https://github.com/untitaker/vdirsyncer/issues/48
|
# See https://github.com/untitaker/vdirsyncer/issues/48
|
||||||
assert isinstance(new_etag, (bytes, text_type))
|
assert isinstance(new_etag, (bytes, text_type))
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ from .. import BARE_EVENT_TEMPLATE, EVENT_TEMPLATE, VCARD_TEMPLATE, \
|
||||||
normalize_item
|
normalize_item
|
||||||
|
|
||||||
_simple_split = [
|
_simple_split = [
|
||||||
VCARD_TEMPLATE.format(r=123),
|
VCARD_TEMPLATE.format(r=123, uid=123),
|
||||||
VCARD_TEMPLATE.format(r=345),
|
VCARD_TEMPLATE.format(r=345, uid=345),
|
||||||
VCARD_TEMPLATE.format(r=678)
|
VCARD_TEMPLATE.format(r=678, uid=678)
|
||||||
]
|
]
|
||||||
|
|
||||||
_simple_joined = u'\r\n'.join(
|
_simple_joined = u'\r\n'.join(
|
||||||
|
|
@ -115,8 +115,8 @@ def test_join_collection_vevents():
|
||||||
|
|
||||||
def test_split_collection_timezones():
|
def test_split_collection_timezones():
|
||||||
items = [
|
items = [
|
||||||
BARE_EVENT_TEMPLATE.format(r=123),
|
BARE_EVENT_TEMPLATE.format(r=123, uid=123),
|
||||||
BARE_EVENT_TEMPLATE.format(r=345)
|
BARE_EVENT_TEMPLATE.format(r=345, uid=345)
|
||||||
]
|
]
|
||||||
|
|
||||||
timezone = (
|
timezone = (
|
||||||
|
|
@ -151,7 +151,7 @@ def test_split_collection_timezones():
|
||||||
|
|
||||||
|
|
||||||
def test_hash_item():
|
def test_hash_item():
|
||||||
a = EVENT_TEMPLATE.format(r=1)
|
a = EVENT_TEMPLATE.format(r=1, uid=1)
|
||||||
b = u'\n'.join(line for line in a.splitlines()
|
b = u'\n'.join(line for line in a.splitlines()
|
||||||
if u'PRODID' not in line and u'VERSION' not in line)
|
if u'PRODID' not in line and u'VERSION' not in line)
|
||||||
assert vobject.hash_item(a) == vobject.hash_item(b)
|
assert vobject.hash_item(a) == vobject.hash_item(b)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue