Adds tests for impressum page
This commit is contained in:
parent
4a89a9ec88
commit
26a05d2182
1 changed files with 23 additions and 0 deletions
|
@ -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()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue