From 9586db763eee53e6de0c878d70cbe6fbf69c1ef8 Mon Sep 17 00:00:00 2001 From: bensteUEM Date: Mon, 13 Jan 2025 18:03:41 +0100 Subject: [PATCH] fix(#12): corrected testing automation and references --- .github/workflows/python-unittest.yml | 4 ++-- communi_api/churchToolsActions.py | 2 +- tests/test_communi_api.py | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-unittest.yml b/.github/workflows/python-unittest.yml index 12d6124..fd4c082 100644 --- a/.github/workflows/python-unittest.yml +++ b/.github/workflows/python-unittest.yml @@ -1,4 +1,4 @@ -name: Python Unittest CommuniAPI +name: Python Tests CommuniAPI on: [ push, pull_request ] @@ -45,6 +45,6 @@ jobs: - name: Run unittests run: | - python -m unittest tests.test_communi_api + pytest tests/* env: POETRY_HOME: ${{ github.workspace }}/.poetry \ No newline at end of file diff --git a/communi_api/churchToolsActions.py b/communi_api/churchToolsActions.py index 528ee9b..ae65fb8 100644 --- a/communi_api/churchToolsActions.py +++ b/communi_api/churchToolsActions.py @@ -66,7 +66,7 @@ def generate_services_for_event(ct_api, eventId): event = ct_api.get_events(eventId=eventId, include="eventServices")[0] service_names = ct_api.get_services(returnAsDict=True) - serviceGroups = ct_api.get_event_masterdata(type="serviceGroups", returnAsDict=True) + serviceGroups = ct_api.get_event_masterdata(resultClass="serviceGroups", returnAsDict=True) eventServices = {item["name"]: {} for item in serviceGroups.values()} for service in event["eventServices"]: diff --git a/tests/test_communi_api.py b/tests/test_communi_api.py index 4090aab..42e2c0a 100644 --- a/tests/test_communi_api.py +++ b/tests/test_communi_api.py @@ -22,8 +22,9 @@ logging.config.dictConfig(config=logging_config) -class TestsCommuniApp(unittest.TestCase): +class TestsCommuniApp(): def setup_class(self) -> None: + """Common setup with testing provides api connections.""" if "COMMUNI_TOKEN" in os.environ: self.COMMUNI_TOKEN = os.environ["COMMUNI_TOKEN"] self.COMMUNI_SERVER = os.environ["COMMUNI_SERVER"] @@ -52,6 +53,7 @@ def setup_class(self) -> None: def tearDown(self) -> None: """Destroy the session after test execution to avoid resource issues.""" self.api.session.close() + logger.debug("Finished Tests RUN") def test_config(self) -> None: """Check that configuration exists."""