示例#1
0
文件: test.py 项目: rstgroup/nagctl
	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)
示例#2
0
文件: test.py 项目: rstgroup/nagctl
	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)
示例#3
0
文件: test.py 项目: rstgroup/nagctl
	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)
示例#4
0
文件: test.py 项目: rstgroup/nagctl
	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)
示例#5
0
文件: test.py 项目: rstgroup/nagctl
	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)
示例#6
0
文件: test.py 项目: rstgroup/nagctl
	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)
示例#7
0
文件: test.py 项目: rstgroup/nagctl
	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)
示例#8
0
文件: test.py 项目: sasg/nagctl
    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)
示例#9
0
文件: test.py 项目: sasg/nagctl
    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)
示例#10
0
文件: test.py 项目: sasg/nagctl
    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)
示例#11
0
文件: test.py 项目: sasg/nagctl
    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)
示例#12
0
文件: test.py 项目: sasg/nagctl
    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)
示例#13
0
文件: test.py 项目: sasg/nagctl
    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)
示例#14
0
文件: test.py 项目: sasg/nagctl
    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)