From 307b25249c13188c10b120bda56f0687b0d9bf4f Mon Sep 17 00:00:00 2001 From: lucasheld Date: Fri, 7 Apr 2023 20:03:30 +0200 Subject: [PATCH] test: delete maintenances and api keys in setUp --- tests/uptime_kuma_test_case.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/uptime_kuma_test_case.py b/tests/uptime_kuma_test_case.py index a43e027..430ec05 100644 --- a/tests/uptime_kuma_test_case.py +++ b/tests/uptime_kuma_test_case.py @@ -80,6 +80,18 @@ class UptimeKumaTestCase(unittest.TestCase): for docker_host in docker_hosts: self.api.delete_docker_host(docker_host["id"]) + if parse_version(self.api.version) >= parse_version("1.19"): + # delete maintenances + maintenances = self.api.get_maintenances() + for maintenance in maintenances: + self.api.delete_maintenance(maintenance["id"]) + + if parse_version(self.api.version) >= parse_version("1.21"): + # delete api keys + api_keys = self.api.get_api_keys() + for api_key in api_keys: + self.api.delete_api_key(api_key["id"]) + # login again to receive initial messages self.api.disconnect() self.api = UptimeKumaApi(self.url)