From cba71044a2439b10ea88f4ef5186f37b88df16b5 Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Wed, 13 Mar 2024 14:45:36 +1100 Subject: [PATCH] Prevent test giving false-negative if settings.py moved --- conservancy/tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conservancy/tests.py b/conservancy/tests.py index 7ef3eed2..e81ad13b 100644 --- a/conservancy/tests.py +++ b/conservancy/tests.py @@ -1,5 +1,6 @@ import datetime +from django.conf import settings from django.http import Http404 import pytest from pytest_django.asserts import assertContains, assertTemplateUsed @@ -35,6 +36,7 @@ def test_annual_report_file_served(rf): def test_path_traversal_404s(rf): + assert (settings.BASE_DIR / 'static' / 'about/../../settings.py').exists() request = rf.get('/about/../../settings.py') with pytest.raises(Http404): views.index(request)