Helper function for html validation
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
""" test for app action functionality """
|
||||
from unittest.mock import patch
|
||||
from tidylib import tidy_document
|
||||
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.template.response import TemplateResponse
|
||||
@ -8,6 +7,7 @@ from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
|
||||
from bookwyrm import models, views
|
||||
from bookwyrm.tests.validate_html import validate_html
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
class DirectoryViews(TestCase):
|
||||
@ -52,16 +52,7 @@ class DirectoryViews(TestCase):
|
||||
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
html = result.render()
|
||||
_, errors = tidy_document(
|
||||
html.content,
|
||||
options={
|
||||
"drop-empty-elements": False,
|
||||
"warn-proprietary-attributes": False,
|
||||
},
|
||||
)
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
validate_html(result.render())
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_directory_page_empty(self):
|
||||
@ -72,10 +63,7 @@ class DirectoryViews(TestCase):
|
||||
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
html = result.render()
|
||||
_, errors = tidy_document(html.content, options={"drop-empty-elements": False})
|
||||
if errors:
|
||||
raise Exception(errors)
|
||||
validate_html(result.render())
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_directory_page_logged_out(self):
|
||||
|
Reference in New Issue
Block a user