self.assertTemplateUsed(response,('goods/item_list.html', 'base.html', 'inc/_nav.html') ,)
error
AssertionError: False is not true : Template '('goods/item_list.html', 'base.html', 'inc/_nav.html')' was not a template used to render the response. Actual template(s) used: goods/items_list.html, base.html, inc/_nav.html
how to check for multiple templates in response
CodePudding user response:
You can use three method calls:
self.assertTemplateUsed(response, 'goods/items_list.html')
self.assertTemplateUsed(response, 'base.html')
self.assertTemplateUsed(response, 'inc/_nav.html')
Or you can work with an iterable, and enumerate over that iterable:
for template in ('goods/items_list.html', 'base.html', 'inc/_nav.html'):
self.assertTemplateUsed(response, template)