From 97d2ebae3422c3073b04511239b8e5af2009fcc3 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 9 Oct 2024 10:15:54 +0200 Subject: [PATCH 1/2] fix: make sure maps of demo instances of uMap are no indexed fix #2201 --- umap/templates/umap/map_detail.html | 2 +- umap/tests/test_map_views.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/umap/templates/umap/map_detail.html b/umap/templates/umap/map_detail.html index 7c58e9b6f..3fde7391c 100644 --- a/umap/templates/umap/map_detail.html +++ b/umap/templates/umap/map_detail.html @@ -17,7 +17,7 @@ {% umap_css %} {{ block.super }} {% umap_js locale=locale %} - {% if object.share_status != object.PUBLIC %} + {% if UMAP_DEMO_SITE or object.share_status != object.PUBLIC %} {% endif %} ' in content assert f'' in content assert '' in content + + +def test_non_public_map_should_have_noindex_meta(client, map, datalayer): + map.share_status = Map.OPEN + map.save() + response = client.get(map.get_absolute_url()) + assert response.status_code == 200 + assert '' in response.content.decode() + + +def test_demo_instance_should_have_noindex(client, map, datalayer, settings): + settings.UMAP_DEMO_SITE = True + response = client.get(map.get_absolute_url()) + assert response.status_code == 200 + assert '' in response.content.decode() From 7aa445f01b3b48f254d95f3002b162caaf24cc20 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 10 Oct 2024 10:43:54 +0200 Subject: [PATCH 2/2] Update umap/templates/umap/map_detail.html Co-authored-by: David Larlet <3556+davidbgk@users.noreply.github.com> --- umap/templates/umap/map_detail.html | 2 +- umap/tests/test_map_views.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/umap/templates/umap/map_detail.html b/umap/templates/umap/map_detail.html index 3fde7391c..ddf685239 100644 --- a/umap/templates/umap/map_detail.html +++ b/umap/templates/umap/map_detail.html @@ -18,7 +18,7 @@ {{ block.super }} {% umap_js locale=locale %} {% if UMAP_DEMO_SITE or object.share_status != object.PUBLIC %} - + {% endif %} ' in response.content.decode() + assert ( + '' in response.content.decode() + ) def test_demo_instance_should_have_noindex(client, map, datalayer, settings): settings.UMAP_DEMO_SITE = True response = client.get(map.get_absolute_url()) assert response.status_code == 200 - assert '' in response.content.decode() + assert ( + '' in response.content.decode() + )