コード例 #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)