diff options
Diffstat (limited to 'docs/intro/tutorial05.txt')
| -rw-r--r-- | docs/intro/tutorial05.txt | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/docs/intro/tutorial05.txt b/docs/intro/tutorial05.txt index 45fdb3746d..bfb43358e6 100644 --- a/docs/intro/tutorial05.txt +++ b/docs/intro/tutorial05.txt @@ -462,8 +462,7 @@ class: in the past, positive for questions that have yet to be published). """ time = timezone.now() + datetime.timedelta(days=days) - return Question.objects.create(question_text=question_text, - pub_date=time) + return Question.objects.create(question_text=question_text, pub_date=time) class QuestionViewTests(TestCase): @@ -495,8 +494,7 @@ class: """ create_question(question_text="Future question.", days=30) response = self.client.get(reverse('polls:index')) - self.assertContains(response, "No polls are available.", - status_code=200) + self.assertContains(response, "No polls are available.") self.assertQuerysetEqual(response.context['latest_question_list'], []) def test_index_view_with_future_question_and_past_question(self): @@ -580,10 +578,9 @@ in the future is not: The detail view of a question with a pub_date in the future should return a 404 not found. """ - future_question = create_question(question_text='Future question.', - days=5) - response = self.client.get(reverse('polls:detail', - args=(future_question.id,))) + future_question = create_question(question_text='Future question.', days=5) + url = reverse('polls:detail', args=(future_question.id,)) + response = self.client.get(url) self.assertEqual(response.status_code, 404) def test_detail_view_with_a_past_question(self): @@ -591,13 +588,10 @@ in the future is not: The detail view of a question with a pub_date in the past should display the question's text. """ - past_question = create_question(question_text='Past Question.', - days=-5) - response = self.client.get(reverse('polls:detail', - args=(past_question.id,))) - self.assertContains(response, past_question.question_text, - status_code=200) - + past_question = create_question(question_text='Past Question.', days=-5) + url = reverse('polls:detail', args=(past_question.id,)) + response = self.client.get(url) + self.assertContains(response, past_question.question_text) Ideas for more tests -------------------- |
