From f64121ab049b20f6a309bbfef53cb5fc22e1dd36 Mon Sep 17 00:00:00 2001 From: amercader Date: Thu, 6 Oct 2022 11:49:03 +0200 Subject: [PATCH] Fix CSRF issus in functional tests --- ckanext/spatial/tests/functional/test_package.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ckanext/spatial/tests/functional/test_package.py b/ckanext/spatial/tests/functional/test_package.py index 5da5f68..542618b 100644 --- a/ckanext/spatial/tests/functional/test_package.py +++ b/ckanext/spatial/tests/functional/test_package.py @@ -6,7 +6,7 @@ from ckanext.spatial.tests.base import SpatialTestBase import ckan.tests.helpers as helpers -@pytest.mark.usefixtures("with_plugins", "clean_db", "clean_index", "harvest_setup") +@pytest.mark.usefixtures("with_plugins", "with_request_context", "clean_db", "clean_index", "harvest_setup") class TestSpatialExtra(SpatialTestBase): def test_spatial_extra_base(self, app): @@ -18,7 +18,6 @@ class TestSpatialExtra(SpatialTestBase): offset = tk.url_for("dataset.edit", id=dataset["id"]) else: offset = tk.url_for(controller="package", action="edit", id=dataset["id"]) - res = app.get(offset, extra_environ=env) if tk.check_ckan_version(min_version="2.9"): data = { @@ -31,6 +30,8 @@ class TestSpatialExtra(SpatialTestBase): form = res.forms[1] form["extras__0__key"] = u"spatial" form["extras__0__value"] = self.geojson_examples["point"] + + res = app.get(offset, extra_environ=env) res = helpers.submit_and_follow(app, form, env, "save") assert "Error" not in res, res