mirror of
https://github.com/Kozea/Radicale.git
synced 2025-09-12 20:30:57 +00:00
require UIDs in CalDAV/CardDAV / check for duplicated UIDs / try to use UIDs as filenames
This commit is contained in:
parent
7964d288a5
commit
c7e65fbb7f
4 changed files with 241 additions and 82 deletions
34
radicale/tests/static/event1_modified.ics
Normal file
34
radicale/tests/static/event1_modified.ics
Normal file
|
@ -0,0 +1,34 @@
|
|||
BEGIN:VCALENDAR
|
||||
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
|
||||
VERSION:2.0
|
||||
BEGIN:VTIMEZONE
|
||||
TZID:Europe/Paris
|
||||
X-LIC-LOCATION:Europe/Paris
|
||||
BEGIN:DAYLIGHT
|
||||
TZOFFSETFROM:+0100
|
||||
TZOFFSETTO:+0200
|
||||
TZNAME:CEST
|
||||
DTSTART:19700329T020000
|
||||
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
|
||||
END:DAYLIGHT
|
||||
BEGIN:STANDARD
|
||||
TZOFFSETFROM:+0200
|
||||
TZOFFSETTO:+0100
|
||||
TZNAME:CET
|
||||
DTSTART:19701025T030000
|
||||
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
||||
END:STANDARD
|
||||
END:VTIMEZONE
|
||||
BEGIN:VEVENT
|
||||
CREATED:20130902T150157Z
|
||||
LAST-MODIFIED:20130902T150158Z
|
||||
DTSTAMP:20130902T150159Z
|
||||
UID:event1
|
||||
SUMMARY:Event
|
||||
ORGANIZER:mailto:unclesam@example.com
|
||||
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;CN=Jane Doe:MAILTO:janedoe@example.com
|
||||
ATTENDEE;ROLE=REQ-PARTICIPANT;DELEGATED-FROM="MAILTO:bob@host.com";PARTSTAT=ACCEPTED;CN=John Doe:MAILTO:johndoe@example.com
|
||||
DTSTART;TZID=Europe/Paris:20130901T180000
|
||||
DTEND;TZID=Europe/Paris:20130901T190000
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
|
@ -1508,6 +1508,62 @@ class TestMultiFileSystem(BaseFileSystemTest, BaseRequestsMixIn):
|
|||
assert answer1 == answer2
|
||||
assert os.path.exists(os.path.join(cache_folder, "event1.ics"))
|
||||
|
||||
@pytest.mark.skipif(os.name not in ("nt", "posix"),
|
||||
reason="Only supported on 'nt' and 'posix'")
|
||||
def test_put_whole_calendar_uids_used_as_file_names(self):
|
||||
"""Test if UIDs are used as file names."""
|
||||
BaseRequestsMixIn.test_put_whole_calendar(self)
|
||||
for uid in ("todo", "event"):
|
||||
status, _, answer = self.request(
|
||||
"GET", "/calendar.ics/%s.ics" % uid)
|
||||
assert status == 200
|
||||
assert "\r\nUID:%s\r\n" % uid in answer
|
||||
|
||||
@pytest.mark.skipif(os.name not in ("nt", "posix"),
|
||||
reason="Only supported on 'nt' and 'posix'")
|
||||
def test_put_whole_calendar_random_uids_used_as_file_names(self):
|
||||
"""Test if UIDs are used as file names."""
|
||||
BaseRequestsMixIn.test_put_whole_calendar_without_uids(self)
|
||||
status, _, answer = self.request("GET", "/calendar.ics")
|
||||
assert status == 200
|
||||
uids = []
|
||||
for line in answer.split("\r\n"):
|
||||
if line.startswith("UID:"):
|
||||
uids.append(line[len("UID:"):])
|
||||
for uid in uids:
|
||||
status, _, answer = self.request(
|
||||
"GET", "/calendar.ics/%s.ics" % uid)
|
||||
assert status == 200
|
||||
assert "\r\nUID:%s\r\n" % uid in answer
|
||||
|
||||
@pytest.mark.skipif(os.name not in ("nt", "posix"),
|
||||
reason="Only supported on 'nt' and 'posix'")
|
||||
def test_put_whole_addressbook_uids_used_as_file_names(self):
|
||||
"""Test if UIDs are used as file names."""
|
||||
BaseRequestsMixIn.test_put_whole_addressbook(self)
|
||||
for uid in ("contact1", "contact2"):
|
||||
status, _, answer = self.request(
|
||||
"GET", "/contacts.vcf/%s.vcf" % uid)
|
||||
assert status == 200
|
||||
assert "\r\nUID:%s\r\n" % uid in answer
|
||||
|
||||
@pytest.mark.skipif(os.name not in ("nt", "posix"),
|
||||
reason="Only supported on 'nt' and 'posix'")
|
||||
def test_put_whole_addressbook_random_uids_used_as_file_names(self):
|
||||
"""Test if UIDs are used as file names."""
|
||||
BaseRequestsMixIn.test_put_whole_addressbook_without_uids(self)
|
||||
status, _, answer = self.request("GET", "/contacts.vcf")
|
||||
assert status == 200
|
||||
uids = []
|
||||
for line in answer.split("\r\n"):
|
||||
if line.startswith("UID:"):
|
||||
uids.append(line[len("UID:"):])
|
||||
for uid in uids:
|
||||
status, _, answer = self.request(
|
||||
"GET", "/contacts.vcf/%s.vcf" % uid)
|
||||
assert status == 200
|
||||
assert "\r\nUID:%s\r\n" % uid in answer
|
||||
|
||||
|
||||
class TestCustomStorageSystem(BaseFileSystemTest):
|
||||
"""Test custom backend loading."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue