Mi solución
def test_questions_with_future_pub_date(self):
"""
Questions with a pub_date greater than the current date should not appear in the Index View.
"""
Question(question_text='Present Question', pub_date=timezone.now()).save()
Question(question_text='Future Question', pub_date=timezone.now() + datetime.timedelta(days=30)).save()
response = self.client.get(reverse('polls:index'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Present Question")
self.assertNotContains(response, "Future Question")
¿Quieres ver más aportes, preguntas y respuestas de la comunidad? Crea una cuenta o inicia sesión.