Test rendered html

This commit is contained in:
Mouse Reeve
2021-09-28 13:44:49 -07:00
parent 0fa0c1e2d9
commit afcd296513
6 changed files with 58 additions and 12 deletions

View File

@ -1,5 +1,6 @@
""" test for app action functionality """
from unittest.mock import patch
from tidylib import tidy_document
from django.template.response import TemplateResponse
from django.test import TestCase
from django.test.client import RequestFactory
@ -36,5 +37,8 @@ class IPBlocklistViews(TestCase):
result = view(request)
self.assertIsInstance(result, TemplateResponse)
result.render()
html = result.render()
_, errors = tidy_document(html.content)
if errors:
raise Exception(errors)
self.assertEqual(result.status_code, 200)