From 4a89a9ec88bd3a843285a055d5010281290e6998 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 4 Dec 2022 13:05:03 -0800 Subject: [PATCH 1/2] Adds missing template --- bookwyrm/templates/about/impressum.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 bookwyrm/templates/about/impressum.html diff --git a/bookwyrm/templates/about/impressum.html b/bookwyrm/templates/about/impressum.html new file mode 100644 index 000000000..3f892c7a7 --- /dev/null +++ b/bookwyrm/templates/about/impressum.html @@ -0,0 +1,15 @@ +{% extends 'about/layout.html' %} +{% load i18n %} + +{% block title %}{% trans "Impressum" %}{% endblock %} + + +{% block about_content %} +
+

{% trans "Impressum" %}

+
+ {{ site.impressum | safe }} +
+
+ +{% endblock %} From 26a05d21825550a5b81489b1df8296698fe1050f Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 4 Dec 2022 13:13:05 -0800 Subject: [PATCH 2/2] Adds tests for impressum page --- bookwyrm/tests/views/landing/test_landing.py | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bookwyrm/tests/views/landing/test_landing.py b/bookwyrm/tests/views/landing/test_landing.py index 779a710d0..f56eaf7a9 100644 --- a/bookwyrm/tests/views/landing/test_landing.py +++ b/bookwyrm/tests/views/landing/test_landing.py @@ -1,6 +1,7 @@ """ test for app action functionality """ from unittest.mock import patch from django.contrib.auth.models import AnonymousUser +from django.http import Http404 from django.template.response import TemplateResponse from django.test import TestCase from django.test.client import RequestFactory @@ -77,6 +78,28 @@ class LandingViews(TestCase): validate_html(result.render()) self.assertEqual(result.status_code, 200) + def test_impressum_page_off(self): + """there are so many views, this just makes sure it LOADS""" + view = views.impressum + request = self.factory.get("") + request.user = self.local_user + with self.assertRaises(Http404): + view(request) + + def test_impressum_page_on(self): + """there are so many views, this just makes sure it LOADS""" + site = models.SiteSettings.objects.get() + site.show_impressum = True + site.save() + + view = views.impressum + request = self.factory.get("") + request.user = self.local_user + result = view(request) + self.assertIsInstance(result, TemplateResponse) + validate_html(result.render()) + self.assertEqual(result.status_code, 200) + def test_landing(self): """there are so many views, this just makes sure it LOADS""" view = views.Landing.as_view()