From 7837d7613c6dcb98b5d99e39c3646505d4dfca41 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Sun, 15 Sep 2024 15:37:40 +0200 Subject: [PATCH] Add test coverage for feature query parameter --- .github/workflows/main.yml | 9 + tests/Country.jrxml | 532 ++++++++++++++++++++++++++ tests/api_tests.py | 51 +++ tests/config/default/permissions.json | 3 +- 4 files changed, 594 insertions(+), 1 deletion(-) create mode 100644 tests/Country.jrxml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fd38e5e..f55c362 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,15 @@ jobs: repository: qwc-services/qwc-docker path: qwc-docker + - name: Start demo database + run: | + cd qwc-docker + cp pg_service.conf ~/.pg_service.conf + sed -i 's|host=qwc-postgis|host=localhost|g' ~/.pg_service.conf + sed -i 's|port=5432|port=5439|g' ~/.pg_service.conf + sed -Ei "s|^(\s*POSTGRES_PASSWORD:).*$|\1 'waej7WuoOoth0wor'|" docker-compose-example.yml + docker compose -f docker-compose-example.yml up -d qwc-postgis + - name: Setting up python 3.12 uses: actions/setup-python@v5 with: diff --git a/tests/Country.jrxml b/tests/Country.jrxml new file mode 100644 index 0000000..0ad7899 --- /dev/null +++ b/tests/Country.jrxml @@ -0,0 +1,532 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="79" splitType="Stretch"> + <staticText> + <reportElement x="0" y="0" width="100" height="30" uuid="bcfad055-3966-416d-80a4-4db9fb33fbd4"/> + <textElement> + <font size="20" isBold="true"/> + </textElement> + <text><![CDATA[Country]]></text> + </staticText> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/api_tests.py b/tests/api_tests.py index 09fc952..f9b462c 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -85,3 +85,54 @@ def test_getdocument_xlsx(self): def test_getdocument_404(self): response = self.app.get('/missing_report', headers=self.jwtHeader()) self.assertEqual(404, response.status_code, "Status code is 404") + + def test_country_report_html(self): + params = { + "feature": 5 + } + response = self.app.get('/Country.html?' + urlencode(params), headers=self.jwtHeader()) + success = False + html = None + try: + html = response.data.decode("utf-8") + success = "