From 282d000d9c1df612c509c6b73b31680ac2e698f9 Mon Sep 17 00:00:00 2001 From: Greg Turner Date: Tue, 18 Oct 2016 14:01:50 +1100 Subject: [PATCH] Add test showing strange occurrence generation. --- icekit_events/tests/tests.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/icekit_events/tests/tests.py b/icekit_events/tests/tests.py index f883b02..4a06448 100644 --- a/icekit_events/tests/tests.py +++ b/icekit_events/tests/tests.py @@ -725,6 +725,35 @@ def test_event_without_occurrences(self): (None, None), event.get_occurrences_range()) +class TestEventRepeatsGeneratorStrangeness(TestCase): + def setUp(self): + self.start = datetime(2016,10,1, 9,0) + self.end = datetime(2016,10,1, 17,0) + self.repeat_end = datetime(2016,10,31, 17,0) + + self.event = G(SimpleEvent) + + def test_daily_occurrences(self): + generator = models.EventRepeatsGenerator.objects.create( + event=self.event, + start=self.start, + end=self.end, + repeat_end=self.repeat_end, + recurrence_rule='RRULE:FREQ=DAILY', + ) # This generates occurrences + + occurrences = self.event.occurrences.all() + self.assertEquals(occurrences.count(), 31) + + st = localize(self.start).time() + et = localize(self.end).time() + self.assertEquals(st, time(9,0)) + self.assertEquals(et, time(17,0)) + + for o in occurrences: + self.assertEquals(localize(o.start).time(), st) + self.assertEquals(localize(o.end).time(), et) + class TestEventRepeatsGeneratorModel(TestCase): def setUp(self):