Exemplo n.º 1
0
 def test_next_daily_digest_existing_future_date(self):
     "The next digest date is correctly generated for a daily digest with a last published date in the future."
     today = dt.today()
     digestobj, created = dh.get_create_digest_feed(self.get_user(),
                                                    self.feedobj, 'daily')
     digestobj.date_last_digest = today + timedelta(
         days=28)  # a month from now a digest was/will be created
     digestobj.save()
     self.assertEqual(dh.date_next_digest(digestobj), today)
Exemplo n.º 2
0
 def test_next_daily_digest_existing_past_date(self):
     "The next digest date is correctly generated for a daily digest with a last published date in the past."
     today = dt.today()
     digestobj, created = dh.get_create_digest_feed(self.get_user(),
                                                    self.feedobj, 'daily')
     digestobj.date_last_digest = today - timedelta(
         days=28)  # no digest has been created for a month. tsk tsk.
     digestobj.save()
     self.assertEqual(dh.date_next_digest(digestobj), today)
Exemplo n.º 3
0
 def test_next_daily_digest_existing_digest(self):
     "The next digest date is correctly generated for a daily digest with a last published date in the present."
     today = dt.today()
     digestobj, created = dh.get_create_digest_feed(self.get_user(),
                                                    self.feedobj, 'daily')
     digestobj.date_last_digest = today
     digestobj.save()
     self.assertEqual(dh.date_next_digest(digestobj),
                      today + timedelta(days=1))
Exemplo n.º 4
0
 def test_next_weekly_digest_new_digest_same_day(self):
     "The next digest date is correctly generated for a weekly digest with no last published date in the present."
     today_sat = date(year=2012, month=02,
                      day=01) + rd.relativedelta(weekday=rd.SA)
     digestobj, created = dh.get_create_digest_feed(self.get_user(),
                                                    self.feedobj, 'weekly',
                                                    'sat')
     date_next_digest = dh.date_next_digest(digestobj, today_sat)
     self.assertEqual(date_next_digest, today_sat)
Exemplo n.º 5
0
 def test_next_weekly_digest_existing_future_date(self):
     "The next digest date is correctly generated for a weekly digest with a last published date in the future."
     today_mon = date(year=2012, month=02,
                      day=01) + rd.relativedelta(weekday=rd.SA)
     digestobj, created = dh.get_create_digest_feed(self.get_user(),
                                                    self.feedobj, 'weekly',
                                                    'sat')
     digestobj.date_last_digest = today_mon + timedelta(days=28)
     digestobj.save()
     date_next_digest = dh.date_next_digest(digestobj, today=today_mon)
     this_sat = today_mon + rd.relativedelta(weekday=rd.SA)
     self.assertEqual(date_next_digest, this_sat)
Exemplo n.º 6
0
 def test_next_daily_digest_new_digest(self):
     "The next digest date is correctly generated for a daily digest with no last published date."
     today = dt.today()
     digestobj, created = dh.get_create_digest_feed(self.get_user(),
                                                    self.feedobj, 'daily')
     self.assertEqual(dh.date_next_digest(digestobj), today)