Skip to content

Commit

Permalink
Test PROPFIND requests with propname and allprop
Browse files Browse the repository at this point in the history
  • Loading branch information
Unrud committed Sep 17, 2017
1 parent 24b5e98 commit b0ef194
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
4 changes: 4 additions & 0 deletions radicale/tests/static/allprop.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:">
<D:allprop />
</D:propfind>
4 changes: 4 additions & 0 deletions radicale/tests/static/propname.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:">
<D:propname />
</D:propfind>
34 changes: 33 additions & 1 deletion radicale/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,34 @@ def test_propfind(self):
assert "href>%s</" % calendar_path in answer
assert "href>%s</" % event_path in answer

def test_propfind_propname(self):
status, _, _ = self.request("MKCALENDAR", "/calendar.ics/")
assert status == 201
event = get_file_content("event1.ics")
status, _, _ = self.request("PUT", "/calendar.ics/event.ics", event)
assert status == 201
propfind = get_file_content("propname.xml")
status, _, answer = self.request(
"PROPFIND", "/calendar.ics/", propfind)
assert "<sync-token />" in answer
status, _, answer = self.request(
"PROPFIND", "/calendar.ics/event.ics", propfind)
assert "<getetag />" in answer

def test_propfind_allprop(self):
status, _, _ = self.request("MKCALENDAR", "/calendar.ics/")
assert status == 201
event = get_file_content("event1.ics")
status, _, _ = self.request("PUT", "/calendar.ics/event.ics", event)
assert status == 201
propfind = get_file_content("allprop.xml")
status, _, answer = self.request(
"PROPFIND", "/calendar.ics/", propfind)
assert "<sync-token>" in answer
status, _, answer = self.request(
"PROPFIND", "/calendar.ics/event.ics", propfind)
assert "<getetag>" in answer

def test_proppatch(self):
"""Write a property and read it back."""
status, _, _ = self.request("MKCALENDAR", "/calendar.ics/")
Expand All @@ -385,8 +413,12 @@ def test_proppatch(self):
status, _, answer = self.request(
"PROPFIND", "/calendar.ics/", propfind)
assert status == 207
assert ":calendar-color>#BADA55</" in answer
assert "<ICAL:calendar-color>#BADA55</" in answer
assert "200 OK</status" in answer
propfind = get_file_content("allprop.xml")
status, _, answer = self.request(
"PROPFIND", "/calendar.ics/", propfind)
assert "<ICAL:calendar-color>" in answer

def test_put_whole_calendar_multiple_events_with_same_uid(self):
"""Add two events with the same UID."""
Expand Down

0 comments on commit b0ef194

Please sign in to comment.