コード例 #1
0
    def test_show_raw_text_invalid(self):
        """UT: nxos module:show method - invalid argument"""

        command = "show version"
        raw_text = "invalid"

        result = nxos_module.show(command, raw_text)
        self.assertIn("INPUT ERROR", result)
コード例 #2
0
    def test_show_raw_text_true_multiple_commands(self):

        """ UT: nxos module:show method - raw_test true multiple commands """

        command = "show bgp sessions ; show processes"
        raw_text = True
        data = ["bgp_session_data", "process_data"]

        with patch("salt.modules.nxos.sendline", autospec=True, return_value=data):
            result = nxos_module.show(command, raw_text)
            self.assertEqual(result, data)
コード例 #3
0
    def test_show_raw_text_true(self):
        """UT: nxos module:show method - raw_test true"""

        command = "show version"
        raw_text = True

        with patch("salt.modules.nxos.sendline",
                   autospec=True,
                   return_value=n9k_show_ver):
            result = nxos_module.show(command, raw_text)
            self.assertEqual(result, n9k_show_ver)
コード例 #4
0
    def test_show_nxapi_structured(self):
        """UT: nxos module:show method - nxapi returns info as list"""

        command = "show version; show interface eth1/1"
        raw_text = False

        with patch(
                "salt.modules.nxos.sendline",
                autospec=True,
                return_value=n9k_show_ver_int_list_structured,
        ):
            result = nxos_module.show(command, raw_text)
            self.assertEqual(result[0], n9k_show_ver_int_list_structured[0])
            self.assertEqual(result[1], n9k_show_ver_int_list_structured[1])