diff --git a/src/lists/tests.py b/src/lists/tests.py index 828f6fe..277835f 100644 --- a/src/lists/tests.py +++ b/src/lists/tests.py @@ -23,18 +23,25 @@ class NewListTest(TestCase): class ListViewTest(TestCase): def test_uses_list_template(self): - response = self.client.get('/lists/the-only-list-in-the-world/') + list_ = List.objects.create() + response = self.client.get('/lists/{list_.id}/') self.assertTemplateUsed(response=response, template_name='list.html') def test_displays_all_items(self): - list_ = List.objects.create() - Item.objects.create(text="itemey 1", list=list_) - Item.objects.create(text="itemey 2", list=list_) + correct_list = List.objects.create() + Item.objects.create(text="itemey 1", list=correct_list) + Item.objects.create(text="itemey 2", list=correct_list) + other_list = List.objects.create() + Item.objects.create(text="other list item 1", list=other_list) + Item.objects.create(text="other list item 2", list=other_list) + - response = self.client.get('/lists/the-only-list-in-the-world/') + response = self.client.get('/lists/{correct_list.id}/') self.assertContains(response, 'itemey 1') self.assertContains(response, 'itemey 2') + self.assertContains(response=response, text='other list item 1') + self.assertContains(response=response, text='other list item 2') class ListAndItemModelsTest(TestCase):