Add a test for update
This commit is contained in:
parent
6f9e9f21dd
commit
9225fd5fbd
34
radicale/tests/static/event1-prime.ics
Normal file
34
radicale/tests/static/event1-prime.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:20130902T150158Z
|
||||||
|
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:20140901T180000
|
||||||
|
DTEND;TZID=Europe/Paris:20140901T210000
|
||||||
|
END:VEVENT
|
||||||
|
END:VCALENDAR
|
@ -82,6 +82,42 @@ class BaseRequests:
|
|||||||
assert "Todo" in answer
|
assert "Todo" in answer
|
||||||
assert "UID:todo" in answer
|
assert "UID:todo" in answer
|
||||||
|
|
||||||
|
def test_update(self):
|
||||||
|
"""Delete an event."""
|
||||||
|
self.request("MKCOL", "/calendar.ics/")
|
||||||
|
self.request(
|
||||||
|
"PUT", "/calendar.ics/", "BEGIN:VCALENDAR\r\nEND:VCALENDAR")
|
||||||
|
event = get_file_content("event1.ics")
|
||||||
|
path = "/calendar.ics/event1.ics"
|
||||||
|
status, headers, answer = self.request("PUT", path, event)
|
||||||
|
assert status == 201
|
||||||
|
status, headers, answer = self.request("GET", path)
|
||||||
|
assert "ETag" in headers.keys()
|
||||||
|
assert status == 200
|
||||||
|
assert "VEVENT" in answer
|
||||||
|
assert "Event" in answer
|
||||||
|
assert "UID:event" in answer
|
||||||
|
assert "DTSTART;TZID=Europe/Paris:20130901T180000" in answer
|
||||||
|
assert "DTEND;TZID=Europe/Paris:20130901T190000" in answer
|
||||||
|
|
||||||
|
# Then we send another PUT request
|
||||||
|
event = get_file_content("event1-prime.ics")
|
||||||
|
status, headers, answer = self.request("PUT", path, event)
|
||||||
|
assert status == 201
|
||||||
|
status, headers, answer = self.request("GET", "/calendar.ics/")
|
||||||
|
assert answer.count("BEGIN:VEVENT") == 1
|
||||||
|
|
||||||
|
status, headers, answer = self.request("GET", path)
|
||||||
|
assert "ETag" in headers.keys()
|
||||||
|
assert status == 200
|
||||||
|
assert "VEVENT" in answer
|
||||||
|
assert "Event" in answer
|
||||||
|
assert "UID:event" in answer
|
||||||
|
assert "DTSTART;TZID=Europe/Paris:20130901T180000" not in answer
|
||||||
|
assert "DTEND;TZID=Europe/Paris:20130901T190000" not in answer
|
||||||
|
assert "DTSTART;TZID=Europe/Paris:20140901T180000" in answer
|
||||||
|
assert "DTEND;TZID=Europe/Paris:20140901T210000" in answer
|
||||||
|
|
||||||
def test_delete(self):
|
def test_delete(self):
|
||||||
"""Delete an event."""
|
"""Delete an event."""
|
||||||
self.request("MKCOL", "/calendar.ics/")
|
self.request("MKCOL", "/calendar.ics/")
|
||||||
|
Loading…
Reference in New Issue
Block a user