Esempio n. 1
0
    def test_ends_right_at_the_end_of_period(self):
        absenses = BusyPeriods(self.teacher.busy_periods)

        self.assertTrue(
            absenses.is_present(
                start=self.tzdatetime(2032, 12, 5, 13, 00),
                end=self.tzdatetime(2032, 12, 5, 13, 30),
            ))
Esempio n. 2
0
    def test_starts_right_at_the_beginning_of_the_period(self):
        absenses = BusyPeriods(self.teacher.busy_periods)

        self.assertFalse(
            absenses.is_present(
                start=self.tzdatetime(2032, 12, 5, 13, 30),
                end=self.tzdatetime(2032, 12, 5, 13, 45),
            ))
Esempio n. 3
0
    def test_start_outside_period(self):
        absenses = BusyPeriods(self.teacher.busy_periods)

        self.assertFalse(
            absenses.is_present(
                start=self.tzdatetime(2032, 12, 5, 13, 00),
                end=self.tzdatetime(2032, 12, 5, 14, 00),
            ))
Esempio n. 4
0
    def test_outside_period(self):
        absenses = BusyPeriods(self.teacher.busy_periods)

        self.assertTrue(
            absenses.is_present(
                start=self.tzdatetime(2032, 12, 5, 15, 40),
                end=self.tzdatetime(2032, 12, 5, 19, 45),
            ))
Esempio n. 5
0
    def test_within_period(self):
        absenses = BusyPeriods(self.teacher.busy_periods)

        self.assertFalse(
            absenses.is_present(
                start=self.tzdatetime(2032, 12, 5, 13, 40),
                end=self.tzdatetime(2032, 12, 5, 13, 45),
            ))
Esempio n. 6
0
    def test_from_queryset(self):
        for i in range(0, 10):
            mixer.blend('extevents.ExternalEvent', teacher=self.teacher)

        absenses = BusyPeriods(self.teacher.busy_periods)
        self.assertEqual(len(absenses), 11)