1
0
Fork 0

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,6 +1,8 @@
""" test for app action functionality """
import json
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
@ -42,7 +44,10 @@ class ReportViews(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)
def test_reports_page_with_data(self):
@ -55,7 +60,10 @@ class ReportViews(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)
def test_report_page(self):
@ -69,7 +77,10 @@ class ReportViews(TestCase):
result = view(request, report.id)
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)
def test_report_comment(self):