Beispiel #1
0
 def test_was_published_recently_recent(self):
     recent_poll = Poll(pub_date = timezone.now() - datetime.timedelta(hours=1))
     self.assertEqual(recent_poll.was_published_recently(), True, "HORRAY?!")
Beispiel #2
0
 def test_was_published_recently_old_poll(self):
     old_poll = Poll(pub_date = timezone.now() - datetime.timedelta(days=30))
     self.assertEqual(old_poll.was_published_recently(), False)
Beispiel #3
0
 def test_was_published_recently_with_future_poll(self):
     #First we create the object we expect to fail
     future_poll = Poll(pub_date=timezone.now() + datetime.timedelta(days=30))
     #Then, we test that object, to see if the object's function returns the correct value
     self.assertEqual(future_poll.was_published_recently(), False)
Beispiel #4
0
 def test_was_published_recently_recent(self):
     recent_poll = Poll(pub_date=timezone.now() -
                        datetime.timedelta(hours=1))
     self.assertEqual(recent_poll.was_published_recently(), True,
                      "HORRAY?!")
Beispiel #5
0
 def test_was_published_recently_old_poll(self):
     old_poll = Poll(pub_date=timezone.now() - datetime.timedelta(days=30))
     self.assertEqual(old_poll.was_published_recently(), False)
Beispiel #6
0
 def test_was_published_recently_with_future_poll(self):
     #First we create the object we expect to fail
     future_poll = Poll(pub_date=timezone.now() +
                        datetime.timedelta(days=30))
     #Then, we test that object, to see if the object's function returns the correct value
     self.assertEqual(future_poll.was_published_recently(), False)