mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-20 15:17:06 +00:00
Use validate html in landing views tests
This commit is contained in:
parent
8cb91acb93
commit
b56147d70c
3 changed files with 15 additions and 12 deletions
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue