From 16d8489df7ffa1f6180547f270f5517398e7963d Mon Sep 17 00:00:00 2001 From: schroeder5 <s.schroeder@fz-juelich.de> Date: Mon, 15 Jun 2020 09:48:26 +0200 Subject: [PATCH] preparing everything for CI pytest. Is it possible to have PostgreSQL/PostGIS running on zam347? --- .gitlab-ci.yml | 15 +++++++++++++++ CI/do_pytest.sh | 8 ++++++++ toardb/stationmeta/test_stationmeta.py | 12 +++++++----- 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 CI/do_pytest.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 921d438..13bfee6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,5 @@ stages: + - test - deploy - pages @@ -7,6 +8,20 @@ cache: paths: - public/docs/ +#### Test #### +test: + stage: test + tags: + - leap + - zam347 + - base + script: + - zypper --non-interactive install python3-pip + - pip install --upgrade pip + - pip install --no-cache-dir -r requirements.txt + - chmod +x ./CI/do_pytest.sh + - ./CI/do_pytest.sh + #### Documentation #### docs: stage: deploy diff --git a/CI/do_pytest.sh b/CI/do_pytest.sh new file mode 100644 index 0000000..4c6c068 --- /dev/null +++ b/CI/do_pytest.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# run make command +for MOD in contacts data stationmeta timeseries variables +do + pytest toardb/$MOD +done + diff --git a/toardb/stationmeta/test_stationmeta.py b/toardb/stationmeta/test_stationmeta.py index 7928154..7262612 100644 --- a/toardb/stationmeta/test_stationmeta.py +++ b/toardb/stationmeta/test_stationmeta.py @@ -162,8 +162,8 @@ class TestApps: def test_insert_new(self, client, db): - response = client.post("/stationmeta_core/", - json={"stationmeta_core": + response = client.post("/stationmeta/", + json={"stationmeta": {"codes":["ttt3","ttt4"], "name":"Test_China","coordinates":{"lat":36.256,"lng":117.106,"alt":1534.0}, "country":"China","state":"Shandong Sheng","coordinate_validation_status":0, @@ -179,13 +179,15 @@ class TestApps: 'country': 'China', 'state': 'Shandong Sheng', 'coordinate_validation_status': 0, 'coordinate_validation_date': '2020-03-11T12:22:18.047974+01:00', 'type_of_environment': 0, 'type_of_area': 0, 'category': '', 'timezone': '', - 'additional_metadata': {}, 'coordinate_validator_id': 1} + 'additional_metadata': {}, 'coordinate_validator_id': 1, + 'roles': [], 'annotations': [], 'aux_images': [], 'aux_docs': [], 'aux_urls': [], + 'globalmeta': None, 'globalservice': None} assert response.json() == expected_resp def test_insert_duplicate(self, client, db): - response = client.post("/stationmeta_core/", - json={"stationmeta_core": + response = client.post("/stationmeta/", + json={"stationmeta": {"codes":["China11"], "name":"Test_China","coordinates":{"lat":36.256,"lng":117.106,"alt":1534.0}, "country":"China","state":"Shandong Sheng","coordinate_validation_status":0, -- GitLab