Remove test 404 and 500 paths outside dev

This commit is contained in:
Jake Howard 2022-10-02 19:25:36 +01:00
parent 8844aad247
commit 8f66feeaa5
Signed by: jake
GPG Key ID: 57AFB45680EDD477
4 changed files with 13 additions and 3 deletions

View File

@ -64,6 +64,7 @@ test_python:
variables:
POSTGRES_HOST_AUTH_METHOD: trust
DATABASE_URL: postgres://postgres@postgres/postgres
TEST: "true"
script:
- apt-get update && apt-get install --yes git libpq-dev
- ./manage.py collectstatic --noinput --clear

View File

@ -24,7 +24,7 @@ build:
pip {{ ARGS }}
test *ARGS:
./manage.py test {{ ARGS }}
TEST=true ./manage.py test {{ ARGS }}
coverage:
coverage run ./manage.py test --keepdb

View File

@ -12,12 +12,14 @@ env = environ.Env(
SPOTIFY_PROXY_HOST=(str, ""),
SEO_INDEX=(bool, False),
SENTRY_DSN=(str, ""),
TEST=(bool, False),
)
# Read local secrets
environ.Env.read_env(BASE_DIR / ".env")
DEBUG = env("DEBUG")
TEST = env("TEST")
SECRET_KEY = env("SECRET_KEY")

View File

@ -40,8 +40,6 @@ urlpatterns = [
KeybaseView.as_view(),
name="keybase",
),
path("404/", page_not_found, name="404"),
path("500/", server_error, name="500"),
path("feed/", AllPagesFeed(), name="feed"),
path(".health/", include("health_check.urls")),
path("", include("website.legacy.urls")),
@ -67,6 +65,15 @@ if settings.DEBUG:
# Add django-debug-toolbar
urlpatterns.append(path("__debug__/", include("debug_toolbar.urls")))
if settings.DEBUG or settings.TEST:
urlpatterns.extend(
[
path("404/", page_not_found, name="404"),
path("500/", server_error, name="500"),
]
)
urlpatterns = urlpatterns + [
# For anything not caught by a more specific rule above, hand over to
# Wagtail's page serving mechanism. This should be the last pattern in