Sfoglia il codice sorgente

Test code for category search issue (ref https://github.com/Kozea/Radicale/issues/1280 and https://github.com/Kozea/Radicale/issues/1125)

Tobias Brox 3 anni fa
parent
commit
7d4a0fe70e
2 ha cambiato i file con 17 aggiunte e 0 eliminazioni
  1. 1 0
      radicale/tests/static/event1.ics
  2. 16 0
      radicale/tests/test_base.py

+ 1 - 0
radicale/tests/static/event1.ics

@@ -25,6 +25,7 @@ LAST-MODIFIED:20130902T150158Z
 DTSTAMP:20130902T150158Z
 DTSTAMP:20130902T150158Z
 UID:event1
 UID:event1
 SUMMARY:Event
 SUMMARY:Event
+CATEGORIES:some_category1,another_category2
 ORGANIZER:mailto:unclesam@example.com
 ORGANIZER:mailto:unclesam@example.com
 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;CN=Jane Doe:MAILTO:janedoe@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
 ATTENDEE;ROLE=REQ-PARTICIPANT;DELEGATED-FROM="MAILTO:bob@host.com";PARTSTAT=ACCEPTED;CN=John Doe:MAILTO:johndoe@example.com

+ 16 - 0
radicale/tests/test_base.py

@@ -916,6 +916,22 @@ permissions: RrWw""")
             <C:text-match>event</C:text-match>
             <C:text-match>event</C:text-match>
         </C:prop-filter>
         </C:prop-filter>
     </C:comp-filter>
     </C:comp-filter>
+</C:comp-filter>"""])
+        assert "/calendar.ics/event1.ics" in self._test_filter(["""\
+<C:comp-filter name="VCALENDAR">
+    <C:comp-filter name="VEVENT">
+        <C:prop-filter name="CATEGORIES">
+            <C:text-match>some_category1</C:text-match>
+        </C:prop-filter>
+    </C:comp-filter>
+</C:comp-filter>"""])
+        assert "/calendar.ics/event1.ics" in self._test_filter(["""\
+<C:comp-filter name="VCALENDAR">
+    <C:comp-filter name="VEVENT">
+        <C:prop-filter name="CATEGORIES">
+            <C:text-match collation="i;octet">some_category1</C:text-match>
+        </C:prop-filter>
+    </C:comp-filter>
 </C:comp-filter>"""])
 </C:comp-filter>"""])
         assert "/calendar.ics/event1.ics" not in self._test_filter(["""\
         assert "/calendar.ics/event1.ics" not in self._test_filter(["""\
 <C:comp-filter name="VCALENDAR">
 <C:comp-filter name="VCALENDAR">