forked from DGNum/gestioCOF
Fix ical tests
This commit is contained in:
parent
50266f2466
commit
9b0440429c
1 changed files with 7 additions and 4 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue