part 5 - tests
This commit is contained in:
parent
2fcbc9cffb
commit
8a1d8b8ccf
@ -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)
|
||||
Loading…
Reference in New Issue
Block a user