示例#1
0
    def testFindBlackoutAlerts(self):
        fa = FixedAlerts()
        now = datetime(2009, 3, 24, 0)
        periods = self.sesshun1.period_set.all()

        # stage 1 check on 3/24 reveals blacked-out period on 4/7
        alerts = fa.findBlackoutAlerts(1, now, self.sesshuns)
        exp = [(self.sesshun2, [self.sesshun2.period_set.all()[1]], 1)]
        self.assertEquals(exp, alerts)

        # stage 2 check on 3/24 reveals blacked-out period on 4/14
        alerts = fa.findBlackoutAlerts(2, now, self.sesshuns)
        exp = [(self.sesshun1, [self.sesshun1.period_set.all()[2]], 2)]
        self.assertEquals(exp, alerts)
示例#2
0
    def testGetBlackedOutFixedPeriods(self):
        fa = FixedAlerts()
        periods = []
        periods.extend(self.sesshun1.period_set.all())
        periods.extend(self.sesshun2.period_set.all())

        now = datetime(2009, 3, 24, 0)
        stats = fa.getBlackedOutFixedPeriods(now, self.sesshuns)
        exp = [(self.sesshun1, [periods[2]]), (self.sesshun2, [periods[5]])]
        self.assertEquals(exp, stats)

        now = datetime(2009, 4, 7, 14)
        stats = fa.getBlackedOutFixedPeriods(now, self.sesshuns)
        exp = [(self.sesshun2, [periods[5]])]
        self.assertEquals(exp, stats)