From: Michael Friedrich Date: Tue, 16 Jul 2019 11:46:22 +0000 (+0200) Subject: Tests: Add Notification state/type to string cases X-Git-Tag: v2.11.0-rc1~21^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c5f280a853eac49692bf194cdc15afb0744bcf0;p=icinga2 Tests: Add Notification state/type to string cases --- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f9eb12dc5..3d5ed9b7c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -124,6 +124,7 @@ add_boost_test(base icinga_checkresult/service_3attempts icinga_checkresult/host_flapping_notification icinga_checkresult/service_flapping_notification + icinga_notification/strings icinga_notification/state_filter icinga_notification/type_filter icinga_macros/simple diff --git a/test/icinga-notification.cpp b/test/icinga-notification.cpp index 13e105fd1..5cf3f49e8 100644 --- a/test/icinga-notification.cpp +++ b/test/icinga-notification.cpp @@ -8,6 +8,21 @@ using namespace icinga; BOOST_AUTO_TEST_SUITE(icinga_notification) +BOOST_AUTO_TEST_CASE(strings) +{ + // States + BOOST_CHECK("OK" == Notification::NotificationServiceStateToString(ServiceOK)); + BOOST_CHECK("Critical" == Notification::NotificationServiceStateToString(ServiceCritical)); + BOOST_CHECK("Up" == Notification::NotificationHostStateToString(HostUp)); + + // Types + BOOST_CHECK("DowntimeStart" == Notification::NotificationTypeToString(NotificationDowntimeStart)); + BOOST_CHECK("Problem" == Notification::NotificationTypeToString(NotificationProblem)); + + // Compat + BOOST_CHECK("DOWNTIMECANCELLED" == Notification::NotificationTypeToStringCompat(NotificationDowntimeRemoved)); +} + BOOST_AUTO_TEST_CASE(state_filter) { unsigned long fstate;