From 60e683a98dbdacc2deccbfc1c5b8599ac3c0c95d Mon Sep 17 00:00:00 2001 From: Nathan Clerkx Date: Mon, 18 Dec 2023 15:10:15 +0100 Subject: [PATCH] Add line explaining no data was available in the selected area --- .../report-python-cloud-run/report/template.html.jinja | 5 ++++- App/functions/report-python-cloud-run/tests/main_test.py | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/App/functions/report-python-cloud-run/report/template.html.jinja b/App/functions/report-python-cloud-run/report/template.html.jinja index 9818a01f3..62a2edcff 100644 --- a/App/functions/report-python-cloud-run/report/template.html.jinja +++ b/App/functions/report-python-cloud-run/report/template.html.jinja @@ -17,4 +17,7 @@ {% endif %} -{% endfor %} \ No newline at end of file +{% endfor %} +{% if not data.datasets %} +

Unfortunately there was no data available in the region you selected.

+{% endif %} \ No newline at end of file diff --git a/App/functions/report-python-cloud-run/tests/main_test.py b/App/functions/report-python-cloud-run/tests/main_test.py index c440ddf47..8224fe8ac 100644 --- a/App/functions/report-python-cloud-run/tests/main_test.py +++ b/App/functions/report-python-cloud-run/tests/main_test.py @@ -26,6 +26,14 @@ def test_main_handler(client): assert r.status_code == 200 +def test_main_handler_empty_polygon(client): + r = client.get( + "/?polygon=%7B%22coordinates%22%3A%5B%5B%5B-4.918202520050414%2C58.52351957545039%5D%2C%5B-1.2336741157175197%2C57.89499975654721%5D%2C%5B-0.6371314216833355%2C59.83577280094184%5D%2C%5B-4.918202520050414%2C58.52351957545039%5D%5D%5D%2C%22type%22%3A%22Polygon%22%7D" + ) + + assert r.status_code == 200 + + # def test_handler_with_env_variable(client): # os.environ["NAME"] = "Foo" # r = client.get("/")