test: delete maintenances and api keys in setUp

This commit is contained in:
lucasheld 2023-04-07 20:03:30 +02:00
parent cc3588cf4d
commit 307b25249c

View file

@ -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)