Django Test assertTemplateUsed() failed: AssertionError: Нет шаблонов, используемых для отображения ответа

У меня есть страница About и я написал тест для нее. Шаблон хорошо отображается в браузере, а assertTemplatedUsed не работает, даже имя шаблона, имя url и код состояния (возвращает 200) все правильные. Какая часть прошла неправильно?

Спасибо!

Ниже приведена ошибка:

System check identified no issues (0 silenced).
...F......
======================================================================
FAIL: test_aboutpage_template (pages.tests.AboutPageTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/code/pages/tests.py", line 54, in test_aboutpage_template
    self.assertTemplateUsed(self.response, 'about.html')
  File "/usr/local/lib/python3.8/site-packages/django/test/testcases.py", line 655, in assertTemplateUsed
    self.fail(msg_prefix + "No templates used to render the response")
AssertionError: No templates used to render the response

----------------------------------------------------------------------
Ran 10 tests in 0.070s

FAILED (failures=1)

Мой test.py:

class AboutPageTests(SimpleTestCase):


    def setUp(self):
        url = reverse('about')
        self.response = self.client.get(url)


    def test_aboutpage_status_code(self):
        self.assertEqual(self.response.status_code, 200)


    def test_aboutpage_template(self):
        self.assertTemplateUsed(self.response, 'about.html')
Вернуться на верх