From 46d65f42abaa2d2eca0782c324c943e023dda69f Mon Sep 17 00:00:00 2001 From: pdelboca Date: Wed, 20 Apr 2022 16:08:17 +0200 Subject: [PATCH 1/3] Fix tags facets not being displayed --- ckanext/showcase/templates/showcase/search.html | 9 +-------- ckanext/showcase/tests/test_plugin.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ckanext/showcase/templates/showcase/search.html b/ckanext/showcase/templates/showcase/search.html index b975a013..19457d8f 100644 --- a/ckanext/showcase/templates/showcase/search.html +++ b/ckanext/showcase/templates/showcase/search.html @@ -46,12 +46,5 @@ {% block secondary_content %} {{ h.snippet('showcase/snippets/helper.html') }} -
-
- {% for facet in c.facet_titles %} - {{ h.snippet('snippets/facet_list.html', title=c.facet_titles[facet], name=facet) }} - {% endfor %} -
- close -
+{{ super() }} {% endblock %} diff --git a/ckanext/showcase/tests/test_plugin.py b/ckanext/showcase/tests/test_plugin.py index 495ec5e7..a6417a7b 100644 --- a/ckanext/showcase/tests/test_plugin.py +++ b/ckanext/showcase/tests/test_plugin.py @@ -29,6 +29,16 @@ def test_showcase_listed_on_index(self, app): assert "1 showcase found" in response.body assert "my-showcase" in response.body + def test_tags_facets_are_being_shown(self, app): + factories.Dataset( + type="showcase", + name="my-showcase", + tags=[{"name": "this-must-be-shown"}] + ) + + response = app.get("/showcase", status=200) + assert 'this-must-be-shown' in response.body + @pytest.mark.usefixtures("clean_db") class TestShowcaseNewView(object): From 0a63533b5aa7cdfa1c6510567fb98391d7a74f7f Mon Sep 17 00:00:00 2001 From: pdelboca Date: Wed, 20 Apr 2022 16:22:26 +0200 Subject: [PATCH 2/3] Remove class for compatibility with 2.7 --- ckanext/showcase/tests/test_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/showcase/tests/test_plugin.py b/ckanext/showcase/tests/test_plugin.py index a6417a7b..2ab6ba24 100644 --- a/ckanext/showcase/tests/test_plugin.py +++ b/ckanext/showcase/tests/test_plugin.py @@ -37,7 +37,7 @@ def test_tags_facets_are_being_shown(self, app): ) response = app.get("/showcase", status=200) - assert 'this-must-be-shown' in response.body + assert 'this-must-be-shown' in response.body @pytest.mark.usefixtures("clean_db") From 0006975ea303165e464e61d28b88448ab443497b Mon Sep 17 00:00:00 2001 From: pdelboca Date: Wed, 20 Apr 2022 16:34:23 +0200 Subject: [PATCH 3/3] Add conditional testing --- ckanext/showcase/tests/test_plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ckanext/showcase/tests/test_plugin.py b/ckanext/showcase/tests/test_plugin.py index 2ab6ba24..4d65cc08 100644 --- a/ckanext/showcase/tests/test_plugin.py +++ b/ckanext/showcase/tests/test_plugin.py @@ -37,7 +37,10 @@ def test_tags_facets_are_being_shown(self, app): ) response = app.get("/showcase", status=200) - assert 'this-must-be-shown' in response.body + if tk.check_ckan_version(max_version="2.7"): + assert 'this-must-be-shown 1' in response.body + else: + assert 'this-must-be-shown' in response.body @pytest.mark.usefixtures("clean_db")