refactor: use enums

This commit is contained in:
lucasheld 2022-09-18 19:46:20 +02:00
parent 88e4ccc57e
commit a409c2dbaa
3 changed files with 5 additions and 5 deletions

View file

@ -41,7 +41,7 @@ class TestMonitor(UptimeKumaTestCase):
self.compare(monitor, expected_monitor) self.compare(monitor, expected_monitor)
# edit monitor # edit monitor
expected_monitor["type"] = "ping" expected_monitor["type"] = MonitorType.PING
expected_monitor["name"] = "monitor 1 new" expected_monitor["name"] = "monitor 1 new"
expected_monitor["hostname"] = "127.0.0.10" expected_monitor["hostname"] = "127.0.0.10"
del expected_monitor["url"] del expected_monitor["url"]

View file

@ -1,6 +1,6 @@
import unittest import unittest
from uptime_kuma_api import UptimeKumaException from uptime_kuma_api import UptimeKumaException, NotificationType
from uptime_kuma_test_case import UptimeKumaTestCase from uptime_kuma_test_case import UptimeKumaTestCase
@ -10,7 +10,7 @@ class TestNotification(UptimeKumaTestCase):
"name": "notification 1", "name": "notification 1",
"isDefault": True, "isDefault": True,
"applyExisting": True, "applyExisting": True,
"type": "PushByTechulus", "type": NotificationType.PUSHBYTECHULUS,
"pushAPIKey": "123456789" "pushAPIKey": "123456789"
} }
@ -37,7 +37,7 @@ class TestNotification(UptimeKumaTestCase):
expected_notification["name"] = "notification 1 new" expected_notification["name"] = "notification 1 new"
expected_notification["default"] = False expected_notification["default"] = False
expected_notification["applyExisting"] = False expected_notification["applyExisting"] = False
expected_notification["type"] = "PushDeer" expected_notification["type"] = NotificationType.PUSHDEER
expected_notification["pushdeerKey"] = "987654321" expected_notification["pushdeerKey"] = "987654321"
del expected_notification["pushAPIKey"] del expected_notification["pushAPIKey"]
r = self.api.edit_notification(notification_id, **expected_notification) r = self.api.edit_notification(notification_id, **expected_notification)

View file

@ -33,7 +33,7 @@ class TestProxy(UptimeKumaTestCase):
self.compare(proxy, expected_proxy) self.compare(proxy, expected_proxy)
# edit proxy # edit proxy
expected_proxy["protocol"] = "https" expected_proxy["protocol"] = ProxyProtocol.HTTPS
expected_proxy["host"] = "127.0.0.2" expected_proxy["host"] = "127.0.0.2"
expected_proxy["port"] = 8888 expected_proxy["port"] = 8888
r = self.api.edit_proxy(proxy_id, **expected_proxy) r = self.api.edit_proxy(proxy_id, **expected_proxy)