Exemple #1
0
 def test_was_published_recently_with_recent_poll(self):
     """Tests that :py:meth:`sphinx_demo.models.Poll.was_published_recently` should return True for polls whose pub_date
     is within the last day
     """
     recent_poll = Poll(pub_date=timezone.now() - datetime.timedelta(hours=1))
     self.assertEqual(recent_poll.was_published_recently(), True)
Exemple #2
0
 def test_was_published_recently_with_old_poll(self):
     """Tests that :py:meth:`sphinx_demo.models.Poll.was_published_recently` should return False for polls whose pub_date
     is older than 1 day
     """
     old_poll = Poll(pub_date=timezone.now() - datetime.timedelta(days=30))
     self.assertEqual(old_poll.was_published_recently(), False)