From e3d4725e52503e68f95b55fc079ce5c5fc4bce69 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Sat, 7 Dec 2019 12:05:53 +0100 Subject: [PATCH] Fix Django 3.0 tests with CSP issues --- .gitignore | 2 +- dpaste/settings/tests.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index db68e9b..9b69c0a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,5 @@ docs/_build dpaste/settings/local.py dpaste/static/ dpaste.egg-info -dpaste.db +dpaste.sqlite node_modules diff --git a/dpaste/settings/tests.py b/dpaste/settings/tests.py index 6c3fe0e..7fdf578 100644 --- a/dpaste/settings/tests.py +++ b/dpaste/settings/tests.py @@ -8,3 +8,9 @@ SECRET_KEY = "test-key" DATABASES = { "default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"} } + +# Drop CSP middleware for Django 3.0 until it was fixed upstream +# https://github.com/mozilla/django-csp/issues/129 +import django +if django.get_version().startswith("3."): + MIDDLEWARE.remove("csp.middleware.CSPMiddleware")