Merge pull request #1538 from bookwyrm-social/author-page

Author page validation
This commit is contained in:
Mouse Reeve 2021-10-15 15:02:22 -07:00 committed by GitHub
commit 53e49baa20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -12,7 +12,9 @@
<div> <div>
<p>{% trans "Added:" %} {{ author.created_date | naturaltime }}</p> <p>{% trans "Added:" %} {{ author.created_date | naturaltime }}</p>
<p>{% trans "Updated:" %} {{ author.updated_date | naturaltime }}</p> <p>{% trans "Updated:" %} {{ author.updated_date | naturaltime }}</p>
{% if author.last_edited_by %}
<p>{% trans "Last edited by:" %} <a href="{{ author.last_edited_by.remote_id }}">{{ author.last_edited_by.display_name }}</a></p> <p>{% trans "Last edited by:" %} <a href="{{ author.last_edited_by.remote_id }}">{{ author.last_edited_by.display_name }}</a></p>
{% endif %}
</div> </div>
</header> </header>

View file

@ -9,6 +9,7 @@ from django.test.client import RequestFactory
from bookwyrm import forms, models, views from bookwyrm import forms, models, views
from bookwyrm.activitypub import ActivitypubResponse from bookwyrm.activitypub import ActivitypubResponse
from bookwyrm.tests.validate_html import validate_html
class AuthorViews(TestCase): class AuthorViews(TestCase):
@ -54,7 +55,7 @@ class AuthorViews(TestCase):
is_api.return_value = False is_api.return_value = False
result = view(request, author.id) result = view(request, author.id)
self.assertIsInstance(result, TemplateResponse) self.assertIsInstance(result, TemplateResponse)
result.render() validate_html(result.render())
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
@ -75,7 +76,7 @@ class AuthorViews(TestCase):
result = view(request, author.id) result = view(request, author.id)
self.assertIsInstance(result, TemplateResponse) self.assertIsInstance(result, TemplateResponse)
result.render() validate_html(result.render())
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)