From 1d38cbfd9c348f8cfe79d13e8fd6b14420b2cad7 Mon Sep 17 00:00:00 2001 From: Colin Goutte Date: Wed, 13 Oct 2021 14:23:12 +0200 Subject: [PATCH] sampel test for configuration --- confs/api_client_test_sonde.ini | 10 ++++++++++ papi/config.py | 12 ++++++++++++ tests/test_papi.py | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 confs/api_client_test_sonde.ini create mode 100644 papi/config.py diff --git a/confs/api_client_test_sonde.ini b/confs/api_client_test_sonde.ini new file mode 100644 index 0000000..7d1762c --- /dev/null +++ b/confs/api_client_test_sonde.ini @@ -0,0 +1,10 @@ +[probe] +identitifant_sonde = 838266b2-fc3a-4430-95e8-f7f0d0fc9871 +nom_sonde = SondeTest +emails = colin.goutte@free.fr + colin@cgoutte.fr + + + + + diff --git a/papi/config.py b/papi/config.py new file mode 100644 index 0000000..22688ca --- /dev/null +++ b/papi/config.py @@ -0,0 +1,12 @@ +import os +import glob + + +def read_config(): + + res = [] + for relpath in glob.glob("confs/*.ini"): + if "/api_client" in relpath: + res.append(os.path.abspath(relpath)) + + return res diff --git a/tests/test_papi.py b/tests/test_papi.py index d515f0a..1a7124b 100644 --- a/tests/test_papi.py +++ b/tests/test_papi.py @@ -211,7 +211,8 @@ class ConfigurationTestCase(TestCase): """ Check configuration parsing """ def test_get_config(self): - main.read_config() + config = main.read_config() + assert len(config) == 1 class CodeCoverageTestCase(TestCase):