diff --git a/bookwyrm/tests/views/test_invite.py b/bookwyrm/tests/views/test_invite.py index c1e425c8c..a93821a9e 100644 --- a/bookwyrm/tests/views/test_invite.py +++ b/bookwyrm/tests/views/test_invite.py @@ -8,6 +8,7 @@ from django.test.client import RequestFactory from bookwyrm import forms, models from bookwyrm import views +from bookwyrm.tests.validate_html import validate_html class InviteViews(TestCase): @@ -40,7 +41,7 @@ class InviteViews(TestCase): invite.return_value = True result = view(request, "hi") self.assertIsInstance(result, TemplateResponse) - result.render() + validate_html(result.render()) self.assertEqual(result.status_code, 200) def test_manage_invites(self): @@ -51,7 +52,7 @@ class InviteViews(TestCase): request.user.is_superuser = True result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + validate_html(result.render()) self.assertEqual(result.status_code, 200) def test_manage_invites_post(self): @@ -67,7 +68,7 @@ class InviteViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + validate_html(result.render()) self.assertEqual(result.status_code, 200) invite = models.SiteInvite.objects.get() @@ -83,7 +84,7 @@ class InviteViews(TestCase): request = self.factory.post("", form.data) result = view(request) - result.render() + validate_html(result.render()) req = models.InviteRequest.objects.get() self.assertEqual(req.email, "new@user.email") @@ -97,7 +98,7 @@ class InviteViews(TestCase): request = self.factory.post("", form.data) result = view(request) - result.render() + validate_html(result.render()) # no request created self.assertFalse(models.InviteRequest.objects.exists()) @@ -110,14 +111,14 @@ class InviteViews(TestCase): request.user.is_superuser = True result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + validate_html(result.render()) self.assertEqual(result.status_code, 200) # now with data models.InviteRequest.objects.create(email="fish@example.com") result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + validate_html(result.render()) self.assertEqual(result.status_code, 200) def test_manage_invite_requests_send(self): diff --git a/bookwyrm/tests/views/test_landing.py b/bookwyrm/tests/views/test_landing.py index f3a50fbc2..829919177 100644 --- a/bookwyrm/tests/views/test_landing.py +++ b/bookwyrm/tests/views/test_landing.py @@ -7,6 +7,7 @@ from django.test.client import RequestFactory from bookwyrm import models from bookwyrm import views +from bookwyrm.tests.validate_html import validate_html class LandingViews(TestCase): @@ -38,13 +39,13 @@ class LandingViews(TestCase): with patch("bookwyrm.activitystreams.ActivityStream.get_activity_stream"): result = view(request) self.assertEqual(result.status_code, 200) - result.render() + validate_html(result.render()) request.user = self.anonymous_user result = view(request) self.assertIsInstance(result, TemplateResponse) self.assertEqual(result.status_code, 200) - result.render() + validate_html(result.render()) def test_about_page(self): """there are so many views, this just makes sure it LOADS""" @@ -53,7 +54,7 @@ class LandingViews(TestCase): request.user = self.local_user result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + validate_html(result.render()) self.assertEqual(result.status_code, 200) def test_landing(self): diff --git a/bookwyrm/tests/views/test_password.py b/bookwyrm/tests/views/test_password.py index 47d8bb27b..852f03c3c 100644 --- a/bookwyrm/tests/views/test_password.py +++ b/bookwyrm/tests/views/test_password.py @@ -7,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 class PasswordViews(TestCase): @@ -37,7 +38,7 @@ class PasswordViews(TestCase): result = view(request) self.assertIsInstance(result, TemplateResponse) - result.render() + validate_html(result.render()) self.assertEqual(result.status_code, 200) def test_password_reset_request_post(self): @@ -65,7 +66,7 @@ class PasswordViews(TestCase): request.user = self.anonymous_user result = view(request, code.code) self.assertIsInstance(result, TemplateResponse) - result.render() + validate_html(result.render()) self.assertEqual(result.status_code, 200) def test_password_reset_post(self):