adding test for Vjournal filtering
This commit is contained in:
commit
1613c4955f
@ -304,13 +304,14 @@ def _time_range_match(vobject_item, filter_, child_name):
|
|||||||
completed = completed.value
|
completed = completed.value
|
||||||
return start <= completed and end >= completed
|
return start <= completed and end >= completed
|
||||||
elif created is not None:
|
elif created is not None:
|
||||||
|
# Line 7
|
||||||
created = created.value
|
created = created.value
|
||||||
return end < created
|
return end > created
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
elif child_name == "VJOURNAL":
|
elif child_name == "VJOURNAL":
|
||||||
dtstart = getattr(child, "dstart", None)
|
dtstart = getattr(child, "dtstart", None)
|
||||||
if dtstart is not None:
|
if dtstart is not None:
|
||||||
dtstart = dtstart.value
|
dtstart = dtstart.value
|
||||||
if not isinstance(dtstart, datetime):
|
if not isinstance(dtstart, datetime):
|
||||||
|
@ -8,16 +8,23 @@ BEGIN:DAYLIGHT
|
|||||||
TZOFFSETFROM:+0100
|
TZOFFSETFROM:+0100
|
||||||
TZOFFSETTO:+0200
|
TZOFFSETTO:+0200
|
||||||
TZNAME:CEST
|
TZNAME:CEST
|
||||||
DTSTART:19700329T020000
|
DTSTART:19700101T000000
|
||||||
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
|
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
|
||||||
END:DAYLIGHT
|
END:DAYLIGHT
|
||||||
BEGIN:STANDARD
|
BEGIN:STANDARD
|
||||||
TZOFFSETFROM:+0200
|
TZOFFSETFROM:+0200
|
||||||
TZOFFSETTO:+0100
|
TZOFFSETTO:+0100
|
||||||
TZNAME:CET
|
TZNAME:CET
|
||||||
DTSTART:19701025T030000
|
DTSTART:19700101T000000
|
||||||
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
|
|
||||||
|
BEGIN:VJOURNAL
|
||||||
|
UID:journal1
|
||||||
|
DTSTAMP;TZID=Europe/Paris:19940817T000000
|
||||||
|
SUMMARY:happy new year
|
||||||
|
DESCRIPTION: Happy new year 2000 !
|
||||||
|
END:VJOURNAL
|
||||||
|
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
@ -20,4 +20,12 @@ RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
|||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
|
|
||||||
|
BEGIN:VJOURNAL
|
||||||
|
UID:journal2
|
||||||
|
DTSTAMP:19950817T000000
|
||||||
|
DTSTART;TZID=Europe/Paris:20000101T100000
|
||||||
|
SUMMARY:happy new year
|
||||||
|
DESCRIPTION: Happy new year 2001 !
|
||||||
|
END:VJOURNAL
|
||||||
|
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
@ -20,4 +20,12 @@ RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
|||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
|
|
||||||
|
BEGIN:VJOURNAL
|
||||||
|
UID:journal2
|
||||||
|
DTSTAMP:19950817T000000
|
||||||
|
DTSTART;VALUE=DATE:20000101
|
||||||
|
SUMMARY:happy new year
|
||||||
|
DESCRIPTION: Happy new year 2001 !
|
||||||
|
END:VJOURNAL
|
||||||
|
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
@ -20,6 +20,7 @@ RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
|||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
BEGIN:VTODO
|
BEGIN:VTODO
|
||||||
|
DTSTART;TZID=Europe/Paris:20130901T180000
|
||||||
|
DURATION:PT1H
|
||||||
END:VTODO
|
END:VTODO
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
@ -20,6 +20,7 @@ RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
|||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
BEGIN:VTODO
|
BEGIN:VTODO
|
||||||
|
DTSTART;TZID=Europe/Paris:20130901T180000
|
||||||
|
DUE;TZID=Europe/Paris:20130903T180000
|
||||||
END:VTODO
|
END:VTODO
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
@ -20,6 +20,6 @@ RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
|||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
BEGIN:VTODO
|
BEGIN:VTODO
|
||||||
|
DTSTART;TZID=Europe/Paris:20130901T180000
|
||||||
END:VTODO
|
END:VTODO
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
@ -20,6 +20,6 @@ RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
|||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
BEGIN:VTODO
|
BEGIN:VTODO
|
||||||
|
DUE;TZID=Europe/Paris:20130903T180000
|
||||||
END:VTODO
|
END:VTODO
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
@ -20,6 +20,7 @@ RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
|||||||
END:STANDARD
|
END:STANDARD
|
||||||
END:VTIMEZONE
|
END:VTIMEZONE
|
||||||
BEGIN:VTODO
|
BEGIN:VTODO
|
||||||
|
CREATED;TZID=Europe/Paris:20130903T180000
|
||||||
|
COMPLETED;TZID=Europe/Paris:20130920T180000
|
||||||
END:VTODO
|
END:VTODO
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
|
25
tests/static/todo6.ics
Normal file
25
tests/static/todo6.ics
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
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:VTODO
|
||||||
|
COMPLETED;TZID=Europe/Paris:20130920T180000
|
||||||
|
END:VTODO
|
||||||
|
END:VCALENDAR
|
25
tests/static/todo7.ics
Normal file
25
tests/static/todo7.ics
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
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:VTODO
|
||||||
|
CREATED;TZID=Europe/Paris:20130803T180000
|
||||||
|
END:VTODO
|
||||||
|
END:VCALENDAR
|
25
tests/static/todo8.ics
Normal file
25
tests/static/todo8.ics
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
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:VTODO
|
||||||
|
|
||||||
|
END:VTODO
|
||||||
|
END:VCALENDAR
|
@ -371,14 +371,78 @@ class BaseRequests:
|
|||||||
assert "href>/calendar.ics/event4.ics</" not in answer
|
assert "href>/calendar.ics/event4.ics</" not in answer
|
||||||
assert "href>/calendar.ics/event5.ics</" not in answer
|
assert "href>/calendar.ics/event5.ics</" not in answer
|
||||||
|
|
||||||
|
answer = self._test_filter(["""
|
||||||
|
<C:comp-filter name="VCALENDAR">
|
||||||
|
<C:comp-filter name="VTODO">
|
||||||
|
<C:time-range start="20130801T000000Z" end="20131001T000000Z"/>
|
||||||
|
</C:comp-filter>
|
||||||
|
</C:comp-filter>"""],"todo", events=8)
|
||||||
|
assert "href>/calendar.ics/todo1.ics</" in answer
|
||||||
|
assert "href>/calendar.ics/todo2.ics</" in answer
|
||||||
|
assert "href>/calendar.ics/todo3.ics</" in answer
|
||||||
|
assert "href>/calendar.ics/todo4.ics</" in answer
|
||||||
|
assert "href>/calendar.ics/todo5.ics</" in answer
|
||||||
|
assert "href>/calendar.ics/todo6.ics</" in answer
|
||||||
|
assert "href>/calendar.ics/todo7.ics</" in answer
|
||||||
|
assert "href>/calendar.ics/todo8.ics</" in answer
|
||||||
|
|
||||||
|
answer = self._test_filter(["""
|
||||||
|
<C:comp-filter name="VCALENDAR">
|
||||||
|
<C:comp-filter name="VTODO">
|
||||||
|
<C:time-range start="20130801T180000Z" end="20130801T000000Z"/>
|
||||||
|
</C:comp-filter>
|
||||||
|
</C:comp-filter>"""],"todo", events=8)
|
||||||
|
assert "href>/calendar.ics/todo1.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/todo2.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/todo3.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/todo4.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/todo5.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/todo6.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/todo7.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/todo8.ics</" in answer
|
||||||
|
|
||||||
answer = self._test_filter(["""
|
answer = self._test_filter(["""
|
||||||
<C:comp-filter name="VCALENDAR">
|
<C:comp-filter name="VCALENDAR">
|
||||||
<C:comp-filter name="VJOURNAL">
|
<C:comp-filter name="VJOURNAL">
|
||||||
<C:time-range start="19991229T000000Z" end="20000202T000000Z"/>
|
<C:time-range start="19991229T000000Z" end="20000202T000000Z"/>
|
||||||
</C:comp-filter>
|
</C:comp-filter>
|
||||||
</C:comp-filter>"""], "journal", events=1)
|
</C:comp-filter>"""], "journal", events=3)
|
||||||
assert "href>/calendar.ics/journal1.ics</" in answer
|
assert "href>/calendar.ics/journal1.ics</" not in answer
|
||||||
# assert "href>/calendar.ics/journal2.ics</" not in answer
|
assert "href>/calendar.ics/journal2.ics</" in answer
|
||||||
|
assert "href>/calendar.ics/journal3.ics</" in answer
|
||||||
|
|
||||||
|
|
||||||
|
answer = self._test_filter(["""
|
||||||
|
<C:comp-filter name="VCALENDAR">
|
||||||
|
<C:comp-filter name="VJOURNAL">
|
||||||
|
<C:time-range start="19981229T000000Z" end="19991012T000000Z"/>
|
||||||
|
</C:comp-filter>
|
||||||
|
</C:comp-filter>"""], "journal", events=3)
|
||||||
|
assert "href>/calendar.ics/journal1.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/journal2.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/journal3.ics</" not in answer
|
||||||
|
|
||||||
|
answer = self._test_filter(["""
|
||||||
|
<C:comp-filter name="VCALENDAR">
|
||||||
|
<C:comp-filter name="VJOURNAL">
|
||||||
|
<C:time-range start="20131229T000000Z" end="21520202T000000Z"/>
|
||||||
|
</C:comp-filter>
|
||||||
|
</C:comp-filter>"""], "journal", events=3)
|
||||||
|
assert "href>/calendar.ics/journal1.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/journal2.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/journal3.ics</" not in answer
|
||||||
|
|
||||||
|
|
||||||
|
answer = self._test_filter(["""
|
||||||
|
<C:comp-filter name="VCALENDAR">
|
||||||
|
<C:comp-filter name="VJOURNAL">
|
||||||
|
<C:time-range start="20000101T000000Z" end="20000202T000000Z"/>
|
||||||
|
</C:comp-filter>
|
||||||
|
</C:comp-filter>"""], "journal", events=3)
|
||||||
|
assert "href>/calendar.ics/journal1.ics</" not in answer
|
||||||
|
assert "href>/calendar.ics/journal2.ics</" in answer
|
||||||
|
assert "href>/calendar.ics/journal3.ics</" in answer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestMultiFileSystem(BaseRequests, BaseTest):
|
class TestMultiFileSystem(BaseRequests, BaseTest):
|
||||||
|
Loading…
Reference in New Issue
Block a user