def test_toggleNotifications_enable_service(self): """toggleNotifications: generate commands to enable service notifications""" nagctl.conf["service"] = "load" commands = nagctl.toggleNotifications(["enable", "notifications"], "service") expected = ["ENABLE_SVC_NOTIFICATIONS;worker0;load", "ENABLE_SVC_NOTIFICATIONS;worker1;load", "ENABLE_SVC_NOTIFICATIONS;database;load"] self.assertEqual(commands, expected)
def test_toggleNotifications_disable_service(self): """toggleNotifications: generate commands to disable service notifications""" nagctl.conf["service"] = "queue0" commands = nagctl.toggleNotifications(["disable", "notifications"], "service") expected = ["DISABLE_SVC_NOTIFICATIONS;worker0;queue0", "DISABLE_SVC_NOTIFICATIONS;database;queue0"] self.assertEqual(commands, expected)
def test_toggleNotifications_enable_host(self): """toggleNotifications: generate commands to enable host notifications""" nagctl.conf["host"] = "database" commands = nagctl.toggleNotifications(["enable", "notifications"], "host") expected = ["ENABLE_HOST_NOTIFICATIONS;database"] self.assertEqual(commands, expected)
def test_toggleNotifications_disable_host(self): """toggleNotifications: generate commands to disable host notifications""" nagctl.conf["host"] = "worker[01]" commands = nagctl.toggleNotifications(["disable", "notifications"], "host") expected = ["DISABLE_HOST_NOTIFICATIONS;worker0", "DISABLE_HOST_NOTIFICATIONS;worker1"] self.assertEqual(commands, expected)
def test_toggleNotifications_none(self): """toggleNotifications: do not generate any commands""" nagctl.conf["host"] = "worker0" nagctl.conf["service"] = "queue1" commands = nagctl.toggleNotifications(["disable", "notifications"], "all") expected = [] self.assertEqual(commands, expected)
def test_toggleNotifications_disable_all(self): """toggleNotifications: generate commands to disable host and service notifications""" nagctl.conf["host"] = "worker1" nagctl.conf["service"] = "queue1" commands = nagctl.toggleNotifications(["disable", "notifications"], "all") expected = ["DISABLE_HOST_NOTIFICATIONS;worker1", "DISABLE_SVC_NOTIFICATIONS;worker1;queue1"] self.assertEqual(commands, expected)
def test_toggleNotifications_enable_all(self): """toggleNotifications: generate commands to enable host and service notifications""" nagctl.conf["host"] = "database" nagctl.conf["service"] = "load" commands = nagctl.toggleNotifications(["enable", "notifications"], "all") expected = ["ENABLE_HOST_NOTIFICATIONS;database", "ENABLE_SVC_NOTIFICATIONS;database;load"] self.assertEqual(commands, expected)
def test_toggleNotifications_disable_service(self): """toggleNotifications: generate commands to disable service notifications""" nagctl.conf["service"] = "queue0" commands = nagctl.toggleNotifications(["disable", "notifications"], "service") expected = [ "DISABLE_SVC_NOTIFICATIONS;worker0;queue0", "DISABLE_SVC_NOTIFICATIONS;database;queue0" ] self.assertEqual(commands, expected)
def test_toggleNotifications_disable_host(self): """toggleNotifications: generate commands to disable host notifications""" nagctl.conf["host"] = "worker[01]" commands = nagctl.toggleNotifications(["disable", "notifications"], "host") expected = [ "DISABLE_HOST_NOTIFICATIONS;worker0", "DISABLE_HOST_NOTIFICATIONS;worker1" ] self.assertEqual(commands, expected)
def test_toggleNotifications_disable_all(self): """toggleNotifications: generate commands to disable host and service notifications""" nagctl.conf["host"] = "worker1" nagctl.conf["service"] = "queue1" commands = nagctl.toggleNotifications(["disable", "notifications"], "all") expected = [ "DISABLE_HOST_NOTIFICATIONS;worker1", "DISABLE_SVC_NOTIFICATIONS;worker1;queue1" ] self.assertEqual(commands, expected)
def test_toggleNotifications_enable_all(self): """toggleNotifications: generate commands to enable host and service notifications""" nagctl.conf["host"] = "database" nagctl.conf["service"] = "load" commands = nagctl.toggleNotifications(["enable", "notifications"], "all") expected = [ "ENABLE_HOST_NOTIFICATIONS;database", "ENABLE_SVC_NOTIFICATIONS;database;load" ] self.assertEqual(commands, expected)
def test_toggleNotifications_enable_service(self): """toggleNotifications: generate commands to enable service notifications""" nagctl.conf["service"] = "load" commands = nagctl.toggleNotifications(["enable", "notifications"], "service") expected = [ "ENABLE_SVC_NOTIFICATIONS;worker0;load", "ENABLE_SVC_NOTIFICATIONS;worker1;load", "ENABLE_SVC_NOTIFICATIONS;database;load" ] self.assertEqual(commands, expected)