Skip to content

Commit

Permalink
Test the empty impressum (#319)
Browse files Browse the repository at this point in the history
* Test the empty impressum

* Update tests.py

* Updates for dependency

* Update requirementes
  • Loading branch information
fretchen authored Jun 29, 2024
1 parent 4dff9a6 commit dd31c0c
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 78 deletions.
28 changes: 28 additions & 0 deletions frontend/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
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 +32,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
119 changes: 47 additions & 72 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
django = "^5.0.2"
django-allauth = "^0.61.1"
dj-database-url = "^2.1.0"
python-decouple = "^3.8"
django-csp = "^3.7"
django-qlued = {git = "https://github.com/Alqor-UG/django-qlued.git"}
django-allauth = {extras = ["socialaccount"], version = "^0.63.3"}


[tool.poetry.group.prod]
Expand All @@ -33,7 +33,7 @@ mike = "^2.0.0"


[tool.poetry.group.dev.dependencies]
django-stubs = {version = "^4.2.3", extras = ["compatible-mypy"]}
django-stubs = {version = "^5.0.2", extras = ["compatible-mypy"]}
pylint = "^3.0.3"
pylint-django = "^2.5.5"
black = "^24.1.0"
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ charset-normalizer==3.3.2 ; python_version >= "3.10" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.10" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
cryptography==42.0.8 ; python_version >= "3.10" and python_version < "4.0"
defusedxml==0.7.1 ; python_version >= "3.10" and python_version < "4.0"
dj-database-url==2.2.0 ; python_version >= "3.10" and python_version < "4.0"
django-allauth==0.61.1 ; python_version >= "3.10" and python_version < "4.0"
django-allauth[socialaccount]==0.63.3 ; python_version >= "3.10" and python_version < "4.0"
django-csp==3.8 ; python_version >= "3.10" and python_version < "4.0"
django-ninja==1.2.0 ; python_version >= "3.10" and python_version < "4.0"
django-qlued @ git+https://github.com/Alqor-UG/django-qlued.git@ba78dc11739da29ecd03191fbdea5cf33ccee39e ; python_version >= "3.10" and python_version < "4.0"
Expand All @@ -27,7 +26,6 @@ pydantic==2.7.4 ; python_version >= "3.10" and python_version < "4.0"
pyjwt[crypto]==2.8.0 ; python_version >= "3.10" and python_version < "4.0"
pymongo==4.8.0 ; python_version >= "3.10" and python_version < "4.0"
python-decouple==3.8 ; python_version >= "3.10" and python_version < "4.0"
python3-openid==3.2.0 ; python_version >= "3.10" and python_version < "4.0"
pytz==2024.1 ; python_version >= "3.10" and python_version < "4.0"
regex==2024.5.15 ; python_version >= "3.10" and python_version < "4.0"
requests-oauthlib==2.0.0 ; python_version >= "3.10" and python_version < "4.0"
Expand Down

0 comments on commit dd31c0c

Please sign in to comment.