diff --git a/scripts/build_notification_info_return.py b/scripts/build_notification_info_return.py index cc27729..7c84dfb 100644 --- a/scripts/build_notification_info_return.py +++ b/scripts/build_notification_info_return.py @@ -1,14 +1,18 @@ -from uptime_kuma_api import params_map_notification_providers, notification_provider_options, params_map_notification_provider_options, convert_from_socket +from uptime_kuma_api import notification_provider_options -for provider_sock, provider_py in params_map_notification_providers.items(): - options = notification_provider_options[provider_sock] - tmp = options - params_map = params_map_notification_provider_options[provider_py] - options = convert_from_socket(params_map, options) +def build_providers(): + providers = [] + for provider_enum in notification_provider_options: + provider = provider_enum.__dict__["_value_"] + providers.append(provider) + return providers + +for provider in build_providers(): + options = notification_provider_options[provider] for option in options: print(f'{option}:') - print(f' description: {provider_py} provider option.') - print(f' returned: if type is {provider_py}') + print(f' description: {provider} provider option.') + print(f' returned: if type is {provider}') print(' type: str') diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 19304fa..51dd92b 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -22,11 +22,16 @@ class TestProxy(UptimeKumaTestCase): proxy = self.api.get_proxy(proxy_id) self.compare(proxy, expected_proxy) + # get proxies + proxies = self.api.get_proxies() + proxy = self.find_by_id(proxies, proxy_id) + self.assertIsNotNone(proxy) + self.compare(proxy, expected_proxy) + # edit proxy expected_proxy["protocol"] = "https" expected_proxy["host"] = "127.0.0.2" expected_proxy["port"] = 8888 - expected_proxy["active"] = False r = self.api.edit_proxy(proxy_id, **expected_proxy) self.assertEqual(r["msg"], "Saved") proxy = self.api.get_proxy(proxy_id) diff --git a/tests/test_tag.py b/tests/test_tag.py index afc411d..1a57728 100644 --- a/tests/test_tag.py +++ b/tests/test_tag.py @@ -30,7 +30,7 @@ class TestTag(UptimeKumaTestCase): r = self.api.delete_tag(tag_id) self.assertEqual(r["msg"], "Deleted Successfully.") with self.assertRaises(UptimeKumaException): - self.api.get_proxy(tag_id) + self.api.get_tag(tag_id) if __name__ == '__main__': diff --git a/tests/uptime_kuma_test_case.py b/tests/uptime_kuma_test_case.py index bb90fc3..d28b81c 100644 --- a/tests/uptime_kuma_test_case.py +++ b/tests/uptime_kuma_test_case.py @@ -31,7 +31,7 @@ class UptimeKumaTestCase(unittest.TestCase): cls.api.disconnect() def compare(self, superset, subset): - return subset.items() <= superset.items() + self.assertTrue(subset.items() <= superset.items()) def find_by_id(self, objects, value, key="id"): for obj in objects: diff --git a/uptime_kuma_api/__version__.py b/uptime_kuma_api/__version__.py index 29d4c15..c08e40e 100644 --- a/uptime_kuma_api/__version__.py +++ b/uptime_kuma_api/__version__.py @@ -1,5 +1,5 @@ __title__ = "uptime_kuma_api" -__version__ = "0.0.6" +__version__ = "0.0.7" __author__ = "Lucas Held" __license__ = "MIT" __copyright__ = "Copyright 2022 Lucas Held"