diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 921d4384bbbe13153ded97e430b444f302e65a6f..13bfee655a0c801fa549465f4e4a5a04f5faf291 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 0000000000000000000000000000000000000000..4c6c0687ba5426dc64ab75f50d70c6550b69f672 --- /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 792815418c373aa28b78b409b693dc144c700b98..7262612e189550c50e4a5a7575d6acfa2103677f 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,