1
0
Fork 0

Merge pull request #2471 from bookwyrm-social/impressum

Adds missing template
This commit is contained in:
Mouse Reeve 2022-12-04 13:24:07 -08:00 committed by GitHub
commit 117b86fdc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,15 @@
{% extends 'about/layout.html' %}
{% load i18n %}
{% block title %}{% trans "Impressum" %}{% endblock %}
{% block about_content %}
<div class="block content">
<h2>{% trans "Impressum" %}</h2>
<div class="content">
{{ site.impressum | safe }}
</div>
</div>
{% endblock %}

View file

@ -1,6 +1,7 @@
""" test for app action functionality """ """ test for app action functionality """
from unittest.mock import patch from unittest.mock import patch
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser
from django.http import Http404
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.test import TestCase from django.test import TestCase
from django.test.client import RequestFactory from django.test.client import RequestFactory
@ -77,6 +78,28 @@ class LandingViews(TestCase):
validate_html(result.render()) validate_html(result.render())
self.assertEqual(result.status_code, 200) 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): def test_landing(self):
"""there are so many views, this just makes sure it LOADS""" """there are so many views, this just makes sure it LOADS"""
view = views.Landing.as_view() view = views.Landing.as_view()