Exemple #1
0
    def test_starts_before_start_ends_before_start(self):
        self.event.start = datetime.datetime(2014, 5, 23, 10, 46, 45, 349955)
        self.event.end = datetime.datetime(2014, 5, 24, 10, 46, 45, 349955)

        self.w = WeeklyRecurrenceFactory(event=self.event)
        self.w.days_of_week = '1000000'
        self.w.last_event_end = datetime.datetime(2014, 5, 29, 10, 46, 45,
                                                  349955)
        # self.w.total_number = 5
        self.assertEquals(
            self.event.get_between(
                timezone.now(),
                timezone.now() + timezone.timedelta(hours=1)), [])
Exemple #2
0
    def test_starts_after_end_ends_after_end(self):
        self.event.start = datetime.datetime(2015, 5, 23, 10, 46, 45, 349955)
        self.event.end = datetime.datetime(2015, 5, 24, 10, 46, 45, 349955)

        self.w = WeeklyRecurrenceFactory(event=self.event)
        self.w.days_of_week = '1000000'
        self.w.frequency = 1
        self.w.last_event_end = datetime.datetime(2015, 5, 31, 10, 46, 45,
                                                  349955)
        self.assertEquals(
            len(
                self.event.get_between(
                    datetime.datetime(2015, 4, 21, 10, 46, 45, 349955),
                    datetime.datetime(2015, 4, 29, 10, 46, 45, 349955))), 0)
Exemple #3
0
    def test_frequency2(self):
        self.event.start = datetime.datetime(2015, 1, 1, 1, 46, 45, 349955)
        self.event.end = datetime.datetime(2015, 1, 2, 1, 46, 45, 349955)

        self.w = WeeklyRecurrenceFactory(event=self.event)
        self.w.days_of_week = '1010101'
        self.w.frequency = 3
        self.w.last_event_end = datetime.datetime(2015, 12, 31, 10, 46, 45,
                                                  349955)
        self.assertEquals(
            len(
                self.event.get_between(
                    datetime.datetime(2013, 5, 29, 10, 46, 45, 349955),
                    datetime.datetime(2016, 6, 29, 10, 46, 45, 349955))), 69)
Exemple #4
0
    def test_on_range_end_between_first_event_start_end(self):
        self.event.start = datetime.datetime(2015, 5, 23, 10, 46, 45, 349955)
        self.event.end = datetime.datetime(2015, 5, 24, 10, 46, 45, 349955)

        self.w = WeeklyRecurrenceFactory(event=self.event)
        self.w.days_of_week = '0000010'
        self.w.frequency = 1
        self.w.last_event_end = datetime.datetime(2015, 5, 29, 10, 46, 45,
                                                  349955)
        self.assertEquals(
            len(
                self.event.get_between(
                    datetime.datetime(2015, 5, 21, 10, 46, 45, 349955),
                    datetime.datetime(2015, 5, 23, 11, 46, 45, 349955))), 1)
Exemple #5
0
    def test_starts_before_start_ends_after_end(self):
        self.event.start = timezone.now() - timezone.timedelta(
            days=1) - timezone.timedelta(hours=1)
        self.event.end = timezone.now() - timezone.timedelta(days=1)

        self.w = WeeklyRecurrenceFactory(event=self.event)
        self.w.frequency = 1
        self.w.days_of_week = '1000000'
        self.w.last_event_end = timezone.now() + timezone.timedelta(weeks=6)

        self.assertEquals(
            len(
                self.event.get_between(
                    timezone.now(),
                    timezone.now() + timezone.timedelta(days=7))), 1)