diff --git a/polls/tests.py b/polls/tests.py index 7ce503c..be761e3 100644 --- a/polls/tests.py +++ b/polls/tests.py @@ -1,3 +1,17 @@ -from django.test import TestCase +import datetime -# Create your tests here. +from django.test import TestCase +from django.utils import timezone + +from .models import Question + + +class QuestionModelTests(TestCase): + def test_was_published_recently_with_future_question(self): + """ + was_published_recently() returns False for questions whose pub_date + is in the future. + """ + time = timezone.now() + datetime.timedelta(days=30) + future_question = Question(pub_date=time) + self.assertIs(future_question.was_published_recently(), False) \ No newline at end of file