Example #1
0
	def test_getSimilar_list(self):
		"""getSimilar: return a list of one match"""

		self.assertEqual(nagctl.getSimilar(["hosts"], self.selectors), ["hosts"])
		self.assertEqual(nagctl.getSimilar(["HOSTS"], self.selectors), ["hosts"])
		self.assertEqual(nagctl.getSimilar(["a", "ever"], self.selectors), ["almost everything"])
		self.assertEqual(nagctl.getSimilar(["hosts", "monkeys"], self.selectors), ["hosts"])
Example #2
0
	def test_getSimilar_dict(self):
		"""getSimilar: return a dictionary of one match"""

		self.assertEqual(nagctl.getSimilar(["enab", "ho"], self.commands), {"enable host":0})
		self.assertEqual(nagctl.getSimilar(["ENAB", "HO"], self.commands), {"enable host":0})
		self.assertEqual(nagctl.getSimilar(["enab", "ho", "pretty", "please"], self.commands), {"enable host":0})
		self.assertEqual(nagctl.getSimilar(["hug"], self.commands), {"hug":2})
Example #3
0
File: test.py Project: sasg/nagctl
    def test_getSimilar_list_more(self):
        """getSimilar: return a list of multiple matches"""

        self.assertEqual(nagctl.getSimilar(["host"], self.selectors),
                         ["host", "hosts"])
        self.assertEqual(nagctl.getSimilar(["HOST"], self.selectors),
                         ["host", "hosts"])
        self.assertEqual(nagctl.getSimilar(["almost"], self.selectors),
                         ["almost everything", "almost honest"])
Example #4
0
File: test.py Project: sasg/nagctl
    def test_getSimilar_dict(self):
        """getSimilar: return a dictionary of one match"""

        self.assertEqual(nagctl.getSimilar(["enab", "ho"], self.commands),
                         {"enable host": 0})
        self.assertEqual(nagctl.getSimilar(["ENAB", "HO"], self.commands),
                         {"enable host": 0})
        self.assertEqual(
            nagctl.getSimilar(["enab", "ho", "pretty", "please"],
                              self.commands), {"enable host": 0})
        self.assertEqual(nagctl.getSimilar(["hug"], self.commands), {"hug": 2})
Example #5
0
File: test.py Project: sasg/nagctl
    def test_getSimilar_list(self):
        """getSimilar: return a list of one match"""

        self.assertEqual(nagctl.getSimilar(["hosts"], self.selectors),
                         ["hosts"])
        self.assertEqual(nagctl.getSimilar(["HOSTS"], self.selectors),
                         ["hosts"])
        self.assertEqual(nagctl.getSimilar(["a", "ever"], self.selectors),
                         ["almost everything"])
        self.assertEqual(
            nagctl.getSimilar(["hosts", "monkeys"], self.selectors), ["hosts"])
Example #6
0
File: test.py Project: sasg/nagctl
    def test_getSimilar_dict_more(self):
        """getSimilar: return a dictionary of multiple matches"""

        self.assertEqual(nagctl.getSimilar(["en", "h"], self.commands), {
            "enable host": 0,
            "enchant host": 1
        })
        self.assertEqual(nagctl.getSimilar(["EN", "H"], self.commands), {
            "enable host": 0,
            "enchant host": 1
        })
        self.assertEqual(nagctl.getSimilar(["en"], self.commands), {
            "enable host": 0,
            "enchant host": 1
        })
Example #7
0
	def test_getSimilar_none(self):
		"""getSimilar: return empty list when first argument is an empty string"""

		self.assertEqual(nagctl.getSimilar([""], self.commands), [])
Example #8
0
	def test_getSimilar_dict_empty(self):
		"""getSimilar: return an empty dictionary without any matches"""

		self.assertEqual(nagctl.getSimilar(["energize", "me"], self.commands), {})
		self.assertEqual(nagctl.getSimilar(["xen", "host"], self.commands), {})
Example #9
0
	def test_getSimilar_dict_more(self):
		"""getSimilar: return a dictionary of multiple matches"""

		self.assertEqual(nagctl.getSimilar(["en", "h"], self.commands), {"enable host":0, "enchant host":1})
		self.assertEqual(nagctl.getSimilar(["EN", "H"], self.commands), {"enable host":0, "enchant host":1})
		self.assertEqual(nagctl.getSimilar(["en"], self.commands), {"enable host":0, "enchant host":1})
Example #10
0
	def test_getSimilar_list_empty(self):
		"""getSimilar: return an empty list without any matches"""

		self.assertEqual(nagctl.getSimilar(["service"], self.selectors), [])
		self.assertEqual(nagctl.getSimilar(["aho"], self.selectors), [])
Example #11
0
	def test_getSimilar_list_more(self):
		"""getSimilar: return a list of multiple matches"""

		self.assertEqual(nagctl.getSimilar(["host"], self.selectors), ["host", "hosts"])
		self.assertEqual(nagctl.getSimilar(["HOST"], self.selectors), ["host", "hosts"])
		self.assertEqual(nagctl.getSimilar(["almost"], self.selectors), ["almost everything", "almost honest"])
Example #12
0
File: test.py Project: sasg/nagctl
    def test_getSimilar_none(self):
        """getSimilar: return empty list when first argument is an empty string"""

        self.assertEqual(nagctl.getSimilar([""], self.commands), [])
Example #13
0
File: test.py Project: sasg/nagctl
    def test_getSimilar_dict_empty(self):
        """getSimilar: return an empty dictionary without any matches"""

        self.assertEqual(nagctl.getSimilar(["energize", "me"], self.commands),
                         {})
        self.assertEqual(nagctl.getSimilar(["xen", "host"], self.commands), {})
Example #14
0
File: test.py Project: sasg/nagctl
    def test_getSimilar_list_empty(self):
        """getSimilar: return an empty list without any matches"""

        self.assertEqual(nagctl.getSimilar(["service"], self.selectors), [])
        self.assertEqual(nagctl.getSimilar(["aho"], self.selectors), [])