debug on tests

This commit is contained in:
Cedric Boscher 2016-06-15 18:01:19 +02:00
parent 6ed471b9d6
commit e4e1d81f9f
2 changed files with 20 additions and 7 deletions

View File

@ -311,7 +311,8 @@ def _time_range_match(vobject_item, filter_, child_name):
return True return True
elif child_name == "VJOURNAL": elif child_name == "VJOURNAL":
dtstart = getattr(child, "dtstart", None) dtstart = getattr(child, "dstart", 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):
@ -321,6 +322,7 @@ def _time_range_match(vobject_item, filter_, child_name):
.replace(tzinfo=timezone.utc)) .replace(tzinfo=timezone.utc))
else: else:
dtstart_is_datetime = True dtstart_is_datetime = True
if dtstart_is_datetime: if dtstart_is_datetime:
# Line 1 # Line 1
return start <= dtstart and end > dtstart return start <= dtstart and end > dtstart

View File

@ -407,7 +407,7 @@ class BaseRequests:
<C:comp-filter name="VTODO"> <C:comp-filter name="VTODO">
<C:time-range start="20130903T160000Z" end="20130901T183000Z"/> <C:time-range start="20130903T160000Z" end="20130901T183000Z"/>
</C:comp-filter> </C:comp-filter>
</C:comp-filter>"""],"todo", events=1) </C:comp-filter>"""],"todo", events=8)
assert "href>/calendar.ics/todo2.ics</" not in answer assert "href>/calendar.ics/todo2.ics</" not in answer
answer = self._test_filter([""" answer = self._test_filter(["""
@ -415,7 +415,7 @@ class BaseRequests:
<C:comp-filter name="VTODO"> <C:comp-filter name="VTODO">
<C:time-range start="20130903T160000Z" end="20130901T173000Z"/> <C:time-range start="20130903T160000Z" end="20130901T173000Z"/>
</C:comp-filter> </C:comp-filter>
</C:comp-filter>"""],"todo", events=1) </C:comp-filter>"""],"todo", events=8)
assert "href>/calendar.ics/todo2.ics</" not in answer assert "href>/calendar.ics/todo2.ics</" not in answer
answer = self._test_filter([""" answer = self._test_filter(["""
@ -423,16 +423,27 @@ class BaseRequests:
<C:comp-filter name="VTODO"> <C:comp-filter name="VTODO">
<C:time-range start="20130903T160000Z" end="20130903T173000Z"/> <C:time-range start="20130903T160000Z" end="20130903T173000Z"/>
</C:comp-filter> </C:comp-filter>
</C:comp-filter>"""],"todo", events=1) </C:comp-filter>"""],"todo", events=8)
assert "href>/calendar.ics/todo3.ics</" not in answer assert "href>/calendar.ics/todo3.ics</" not in answer
answer = self._test_filter([""" answer = self._test_filter(["""
<C:comp-filter name="VCALENDAR"> <C:comp-filter name="VCALENDAR">
<C:comp-filter name="VTODO"> <C:comp-filter name="VTODO">
<C:time-range start="20130903T180000Z" end="20130903T173000Z"/> <C:time-range start="20130903T160000Z" end="20130803T203000Z"/>
</C:comp-filter> </C:comp-filter>
</C:comp-filter>"""],"todo", events=1) </C:comp-filter>"""],"todo", events=8)
assert "href>/calendar.ics/todo3.ics</" not in answer assert "href>/calendar.ics/todo7.ics</" in answer
answer = self._test_filter(["""
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VJOURNAL">
<C:time-range start="19991229T000000Z" 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
answer = self._test_filter([""" answer = self._test_filter(["""