Skip to content

Commit

Permalink
Merge pull request #496 from betagouv/fix/static-pages-404
Browse files Browse the repository at this point in the history
fix: static pages unavailable
  • Loading branch information
wiwski authored Mar 20, 2023
2 parents 46ca578 + f5d14b6 commit 20c8a6a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import logging
from unittest import mock

import pytest

logging.getLogger("faker").setLevel(logging.WARNING)


@pytest.fixture(autouse=True)
def setup_envs(monkeypatch: pytest.MonkeyPatch):
Expand Down
2 changes: 1 addition & 1 deletion euphrosyne/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
),
path("api/", include("euphrosyne.api_urls")),
path("jsi18n/", JavaScriptCatalog.as_view(), name="javascript-catalog"),
path("", admin.site.urls),
path("", include("static_pages.urls")),
path("", admin.site.urls),
] + ([path("__debug__/", include(debug_toolbar.urls))] if settings.DEBUG else [])
Empty file added static_pages/tests/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions static_pages/tests/test_static_pages_access.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
from django.test import Client
from django.urls import URLPattern, reverse

from ..urls import urlpatterns


@pytest.mark.parametrize("url", urlpatterns)
def test_static_page_access_when_anonymous(url: URLPattern):
"""Test access to page when not logged in.
Should not redirect to login page."""
response = Client().get(reverse(url.name))
assert response.status_code == 200

0 comments on commit 20c8a6a

Please sign in to comment.