Skip to content

Commit

Permalink
Test the empty impressum
Browse files Browse the repository at this point in the history
  • Loading branch information
fretchen committed Jun 29, 2024
1 parent 4dff9a6 commit 5e6e318
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
27 changes: 27 additions & 0 deletions frontend/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))


Expand Down

0 comments on commit 5e6e318

Please sign in to comment.