Browse Source

Test PROPPATCH

Unrud 9 years ago
parent
commit
62892e3423

+ 6 - 0
radicale/tests/static/propfind1.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<D:propfind xmlns:D="DAV:">
+  <D:prop>
+    <I:calendar-color xmlns:I="http://apple.com/ns/ical/" />
+  </D:prop>
+</D:propfind>

+ 8 - 0
radicale/tests/static/proppatch1.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<D:propertyupdate xmlns:D="DAV:">
+  <D:set>
+    <D:prop>
+      <I:calendar-color xmlns:I="http://apple.com/ns/ical/">#BADA55</I:calendar-color>
+    </D:prop>
+  </D:set>
+</D:propertyupdate>

+ 17 - 0
radicale/tests/test_base.py

@@ -213,6 +213,23 @@ class BaseRequestsMixIn:
         assert "href>%s</" % calendar_path in answer
         assert "href>%s</" % event_path in answer
 
+    def test_proppatch(self):
+        """Write a property and read it back."""
+        self.request("MKCALENDAR", "/calendar.ics/")
+        proppatch = get_file_content("proppatch1.xml")
+        status, headers, answer = self.request(
+            "PROPPATCH", "/calendar.ics/", proppatch)
+        assert status == 207
+        assert "calendar-color" in answer
+        assert "200 OK</status" in answer
+        # Read property back
+        propfind = get_file_content("propfind1.xml")
+        status, headers, answer = self.request(
+            "PROPFIND", "/calendar.ics/", propfind)
+        assert status == 207
+        assert ":calendar-color>#BADA55</" in answer
+        assert "200 OK</status" in answer
+
     def test_multiple_events_with_same_uid(self):
         """Add two events with the same UID."""
         self.request("MKCOL", "/calendar.ics/")