box-o-sand/djtut/mysite/polls/tests.py

12 lines
297 B
Python

import datetime
from django.utils import timezone
from .models import Question
def test_was_published_recently_with_future_question():
time = timezone.now() + datetime.timedelta(days=30)
future_question = Question(pub_date=time)
assert not future_question.was_published_recently()