diff --git a/frontend/tests.py b/frontend/tests.py index 841d45b..86d5d8d 100644 --- a/frontend/tests.py +++ b/frontend/tests.py @@ -15,6 +15,7 @@ from qlued.models import StorageProviderDb from qlued.storage_providers import get_storage_provider_from_entry +from .models import Impressum class IndexPageTests(TestCase): """ @@ -30,6 +31,32 @@ def test_call_index(self): self.assertEqual(r.status_code, 200) +class ImpressumTest(TestCase): + """ + Test basic properties of the job submission process. + """ + + def setUp(self): + self.username = "sandy" + self.password = "dog" + user = get_user_model().objects.create(username=self.username) + user.set_password(self.password) + user.save() + + def test_call_about(self): + """ + is it possible to reach the impressum page ? + """ + url = reverse("about") + r = self.client.get(url) + self.assertEqual(r.status_code, 200) + + # add an impressum to the database + Impressum.objects.create(impressum="This is the impressum") + r = self.client.get(url) + self.assertEqual(r.status_code, 200) + + class JobSubmissionTest(TestCase): """ Test basic properties of the job submission process. diff --git a/frontend/views.py b/frontend/views.py index 6ab476e..001773c 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -99,7 +99,11 @@ def about(request): template = loader.get_template("frontend/about.html") impressums_text = Impressum.objects.first() - context = {"impressums_text": impressums_text.impressum} + if impressums_text is None: + context = {"impressums_text": "No impressum known."} + + else: + context = {"impressums_text": impressums_text.impressum} return HttpResponse(template.render(context, request))