示例#1
0
    def testGetBlackedOutElectivePeriods(self):
        wa = ElectiveAlerts()
        periods = self.sesshun.period_set.all()

        now = datetime(2009, 4, 7, 12)
        stats = wa.getBlackedOutElectivePeriods(now, self.sesshun.elective_set.all())
        exp = [(self.elective1, [periods[2]]), (self.elective2, [periods[5]])]
        self.assertEquals(exp, stats)

        now = datetime(2009, 4, 8, 12)
        stats = wa.getBlackedOutElectivePeriods(now, self.sesshun.elective_set.all())
        exp = [(self.elective2, [periods[5]])]
        self.assertEquals(exp, stats)
示例#2
0
    def testFindBlackoutAlerts(self):
        wa = ElectiveAlerts()
        now = datetime(2009, 3, 24, 0)
        periods = self.sesshun.period_set.all()

        # stage 1 check on 3/24 reveals blacked-out period on 4/14
        alerts = wa.findBlackoutAlerts(1, now, self.sesshun.elective_set.all())
        exp = [(self.elective2, [periods[5]], 1)]
        self.assertEquals(exp, alerts)

        # stage 2 check on 3/24 reveals blacked-out period on 4/7
        alerts = wa.findBlackoutAlerts(2, now, self.sesshun.elective_set.all())
        exp = [(self.elective1, [periods[2]], 2)]
        self.assertEquals(exp, alerts)