add testiles

This commit is contained in:
Colin Goutte 2021-11-14 21:15:53 +01:00
parent de76383cfa
commit 0b5103df1b
3 changed files with 32 additions and 4 deletions

22
tests/test_config.py Normal file
View File

@ -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",
]

View File

@ -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={})

6
tests/test_relais.py Normal file
View File

@ -0,0 +1,6 @@
from papi import relais
def test_main():
relais.main(maxloop=1, pattern="relais_test_sonde")