mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-16 05:06:32 +00:00
Catches some stray unvalidated html in landing tests
This commit is contained in:
parent
c852405e42
commit
8bdedc9304
2 changed files with 7 additions and 6 deletions
|
@ -7,6 +7,7 @@ from django.test import TestCase
|
|||
from django.test.client import RequestFactory
|
||||
|
||||
from bookwyrm import forms, models, views
|
||||
from bookwyrm.tests.validate_html import validate_html
|
||||
|
||||
|
||||
# pylint: disable=too-many-public-methods
|
||||
|
@ -41,7 +42,7 @@ class LoginViews(TestCase):
|
|||
|
||||
result = login(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
validate_html(result.render())
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
request.user = self.local_user
|
||||
|
@ -102,7 +103,7 @@ class LoginViews(TestCase):
|
|||
|
||||
with patch("bookwyrm.views.landing.login.login"):
|
||||
result = view(request)
|
||||
result.render()
|
||||
validate_html(result.render())
|
||||
self.assertEqual(result.status_code, 200)
|
||||
self.assertEqual(
|
||||
result.context_data["login_form"].non_field_errors,
|
||||
|
|
|
@ -51,13 +51,13 @@ class PasswordViews(TestCase):
|
|||
view = views.PasswordResetRequest.as_view()
|
||||
resp = view(request)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
resp.render()
|
||||
validate_html(resp.render())
|
||||
|
||||
request = self.factory.post("", {"email": "mouse@mouse.com"})
|
||||
request.user = self.anonymous_user
|
||||
with patch("bookwyrm.emailing.send_email.delay"):
|
||||
resp = view(request)
|
||||
resp.render()
|
||||
validate_html(resp.render())
|
||||
|
||||
self.assertEqual(models.PasswordReset.objects.get().user, self.local_user)
|
||||
|
||||
|
@ -116,7 +116,7 @@ class PasswordViews(TestCase):
|
|||
models.PasswordReset.objects.create(user=self.local_user)
|
||||
request = self.factory.post("", {"password": "hi", "confirm-password": "hi"})
|
||||
resp = view(request, "jhgdkfjgdf")
|
||||
resp.render()
|
||||
validate_html(resp.render())
|
||||
self.assertTrue(models.PasswordReset.objects.exists())
|
||||
|
||||
def test_password_reset_mismatch(self):
|
||||
|
@ -125,5 +125,5 @@ class PasswordViews(TestCase):
|
|||
code = models.PasswordReset.objects.create(user=self.local_user)
|
||||
request = self.factory.post("", {"password": "hi", "confirm-password": "hihi"})
|
||||
resp = view(request, code.code)
|
||||
resp.render()
|
||||
validate_html(resp.render())
|
||||
self.assertTrue(models.PasswordReset.objects.exists())
|
||||
|
|
Loading…
Reference in a new issue