Ejemplo n.º 1
0
 def test_was_published_recently_with_old_question(self):
     """Test that was_published_recently() returns False for boards whose pub_date is older than 1 day."""
     time = timezone.now() - datetime.timedelta(days=30)
     old_board = Board(pub_date=time)
     self.assertIs(old_board.was_published_recently(), False)
Ejemplo n.º 2
0
 def test_was_published_recently_with_recent_question(self):
     """Test that was_published_recently() returns True for boards whose pub_date is within the last day."""
     time = timezone.now() - datetime.timedelta(hours=1)
     recent_board = Board(pub_date=time)
     self.assertIs(recent_board.was_published_recently(), True)
Ejemplo n.º 3
0
 def test_was_published_recently_with_future_board(self):
     """Test that was_published_recently() returns False for board whose pub_date is in the future."""
     time = timezone.now() + datetime.timedelta(days=30)
     future_board = Board(pub_date=time)
     self.assertIs(future_board.was_published_recently(), False)