diff --git a/tests/test_config.py b/tests/test_config.py new file mode 100644 index 0000000..831b432 --- /dev/null +++ b/tests/test_config.py @@ -0,0 +1,22 @@ +from unittest import TestCase +from papi import main + + +class ConfigurationTestCase(TestCase): + """ Check configuration parsing """ + + def test_get_config(self): + configs = main.read_config(pattern="*test_sonde") + assert len(configs) == 1 + config = configs[0] + assert config["identifiant_sonde"] == "838266b2-fc3a-4430-95e8-f7f0d0fc9871" + assert config["nom_sonde"] == "SondeTest" + assert config["emails"] == ["1@1", "2@2"] + + def test_get_config1mail(self): + configs = main.read_config(pattern="*1mail") + assert len(configs) == 1 + config = configs[0] + assert config["emails"] == [ + "1@1", + ] diff --git a/tests/test_papi.py b/tests/test_papi.py index 4c52084..67d920d 100644 --- a/tests/test_papi.py +++ b/tests/test_papi.py @@ -248,7 +248,7 @@ class CodeCoverageTestCase(TestCase): import string id_sonde = "".join(choices(string.ascii_lowercase, k=8)) - r = client.get(f"/sonde/{id_sonde}/rapport") - r = client.post(f"/sonde/{id_sonde}/", json={}) - - assert r.ok + with pytest.raises(LookupError): + r = client.get(f"/sonde/{id_sonde}/rapport") + with pytest.raises(LookupError): + r = client.post(f"/sonde/{id_sonde}/", json={}) diff --git a/tests/test_relais.py b/tests/test_relais.py new file mode 100644 index 0000000..ac61aec --- /dev/null +++ b/tests/test_relais.py @@ -0,0 +1,6 @@ +from papi import relais + + +def test_main(): + + relais.main(maxloop=1, pattern="relais_test_sonde")