From a409c2dbaaa1c1d519d6908ae81cf3e576c7b56b Mon Sep 17 00:00:00 2001 From: lucasheld Date: Sun, 18 Sep 2022 19:46:20 +0200 Subject: [PATCH] refactor: use enums --- tests/test_monitor.py | 2 +- tests/test_notification.py | 6 +++--- tests/test_proxy.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_monitor.py b/tests/test_monitor.py index acdc4d6..aee7d98 100644 --- a/tests/test_monitor.py +++ b/tests/test_monitor.py @@ -41,7 +41,7 @@ class TestMonitor(UptimeKumaTestCase): self.compare(monitor, expected_monitor) # edit monitor - expected_monitor["type"] = "ping" + expected_monitor["type"] = MonitorType.PING expected_monitor["name"] = "monitor 1 new" expected_monitor["hostname"] = "127.0.0.10" del expected_monitor["url"] diff --git a/tests/test_notification.py b/tests/test_notification.py index 60809f7..b411f82 100644 --- a/tests/test_notification.py +++ b/tests/test_notification.py @@ -1,6 +1,6 @@ import unittest -from uptime_kuma_api import UptimeKumaException +from uptime_kuma_api import UptimeKumaException, NotificationType from uptime_kuma_test_case import UptimeKumaTestCase @@ -10,7 +10,7 @@ class TestNotification(UptimeKumaTestCase): "name": "notification 1", "isDefault": True, "applyExisting": True, - "type": "PushByTechulus", + "type": NotificationType.PUSHBYTECHULUS, "pushAPIKey": "123456789" } @@ -37,7 +37,7 @@ class TestNotification(UptimeKumaTestCase): expected_notification["name"] = "notification 1 new" expected_notification["default"] = False expected_notification["applyExisting"] = False - expected_notification["type"] = "PushDeer" + expected_notification["type"] = NotificationType.PUSHDEER expected_notification["pushdeerKey"] = "987654321" del expected_notification["pushAPIKey"] r = self.api.edit_notification(notification_id, **expected_notification) diff --git a/tests/test_proxy.py b/tests/test_proxy.py index f0c6982..fce36b1 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -33,7 +33,7 @@ class TestProxy(UptimeKumaTestCase): self.compare(proxy, expected_proxy) # edit proxy - expected_proxy["protocol"] = "https" + expected_proxy["protocol"] = ProxyProtocol.HTTPS expected_proxy["host"] = "127.0.0.2" expected_proxy["port"] = 8888 r = self.api.edit_proxy(proxy_id, **expected_proxy)