Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDerrick Kearney
2,962 PointsArticles tests.py. - note on use pk when using reverse.
I am confused about the instructions for challenge on testing, you state to use the pk when using reverse. In the last example given, for testing templates, the function used was:
def test_course_list_view(self):
resp = self.client.get(reverse('courses:list'))
self.assertEqual(resp.status_code, 200)
self.assertIn(self.course, resp.context['courses'])
self.assertIn(self.course2, resp.context['courses'])
self.assertTemplateUsed(resp, 'courses/course_list.html')
self.assertContains(resp, self.course.title)
The challenge requires a pk, so I am bit confused. Are the pks from both writer and article needed?
Please advise thank you.