Tests: Add Notification state/type to string cases 7272/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Tue, 16 Jul 2019 11:46:22 +0000 (13:46 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Tue, 16 Jul 2019 11:46:22 +0000 (13:46 +0200)
test/CMakeLists.txt
test/icinga-notification.cpp

index f9eb12dc5eb576ee6472a21843716f5f7653dda7..3d5ed9b7c9e9d71289ee787c818a0d5ab86570dd 100644 (file)
@@ -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
index 13e105fd16e2f41ceaf2e92dcc73195818de8b65..5cf3f49e821cee260855a1e88bec9e68eedc71c1 100644 (file)
@@ -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;