From 8a0ad53753034f032f7fff2d08944f448463eb04 Mon Sep 17 00:00:00 2001 From: lucasheld Date: Sat, 20 May 2023 22:06:05 +0200 Subject: [PATCH] fix: check only for required notification arguments --- tests/test_notification.py | 5 +++-- uptime_kuma_api/api.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_notification.py b/tests/test_notification.py index ed8b364..7420fe8 100644 --- a/tests/test_notification.py +++ b/tests/test_notification.py @@ -13,8 +13,9 @@ class TestNotification(UptimeKumaTestCase): "name": "notification 1", "isDefault": True, "applyExisting": True, - "type": NotificationType.PUSHBYTECHULUS, - "pushAPIKey": "123456789" + "type": NotificationType.TELEGRAM, + "telegramChatID": "123456789", + "telegramBotToken": "987654321" } # test notification diff --git a/uptime_kuma_api/api.py b/uptime_kuma_api/api.py index 0c761cf..568c67a 100644 --- a/uptime_kuma_api/api.py +++ b/uptime_kuma_api/api.py @@ -305,7 +305,7 @@ def _check_arguments_notification(kwargs) -> None: _check_missing_arguments(required_args, kwargs) type_ = kwargs["type"] - required_args = notification_provider_options[type_] + required_args = [i for i, j in notification_provider_options[type_].items() if j["required"]] _check_missing_arguments(required_args, kwargs) _check_argument_conditions(notification_provider_conditions, kwargs)