Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Add test showing strange occurrence generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Turner committed Oct 18, 2016
1 parent cc08d81 commit 282d000
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions icekit_events/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 282d000

Please sign in to comment.