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

12 lines
297 B
Python
Raw Normal View History

2020-06-04 13:48:40 +00:00
import datetime
2020-03-14 14:52:39 +00:00
2020-06-04 13:48:40 +00:00
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()