Exemplo n.º 1
0
 def test_published_recently_with_future_poll(self):
     """
     published_recently() should return False for polls whose
     pub_date is in the future
     """
     poll = Poll(pub_date=timezone.now() + datetime.timedelta(days=30))
     self.assertEqual(poll.published_recently(), False)
Exemplo n.º 2
0
 def test_recent_poll(self):
     recent_poll = Poll(pub_date=timezone.now()-datetime.timedelta(hours=1))
     self.assertEqual(recent_poll.published_recently(), True)
Exemplo n.º 3
0
 def test_old_poll(self):
     old_poll = Poll(pub_date=timezone.now()-datetime.timedelta(days=30))
     self.assertEqual(old_poll.published_recently(), False)
Exemplo n.º 4
0
 def test_published_recently_with_recent_poll(self):
     """
     published_recently() should return True for polls whose pub_date is within the last day
     """
     poll = Poll(pub_date=timezone.now() - datetime.timedelta(hours=1))
     self.assertEqual(poll.published_recently(), True)
Exemplo n.º 5
0
 def test_published_recently_with_old_poll(self):
     """
     published_recently() should return False for polls whose pub_date is older than 1 day
     """
     poll = Poll(pub_date = timezone.now() - datetime.timedelta(days=30))
     self.assertEqual(poll.published_recently(), False)