Fix ical tests

This commit is contained in:
Ludovic Stephan 2020-05-12 00:47:48 +02:00
parent 50266f2466
commit 9b0440429c

View file

@ -101,8 +101,8 @@ class ICalMixin:
def _find_event(self, ev, l):
for i, elt in enumerate(l):
if self._test_event_equal(ev, elt):
return elt, i
return False, -1
return i
return None
def assertCalEqual(self, ical_content, expected):
remaining = expected.copy()
@ -111,12 +111,15 @@ class ICalMixin:
cal = icalendar.Calendar.from_ical(ical_content)
for ev in cal.walk("vevent"):
found, i_found = self._find_event(ev, remaining)
if found:
i_found = self._find_event(ev, remaining)
if i_found is not None:
remaining.pop(i_found)
else:
unexpected.append(ev)
self.assertListEqual(remaining, [])
self.assertListEqual(unexpected, [])
class TestCaseMixin:
def assertForbidden(self, response):