コード例 #1
0
ファイル: test_netmiko_mod.py プロジェクト: wh1te909/salt
 def test_send_config(self):
     """
     Test netmiko.send_config function
     """
     _, ret = netmiko_mod.send_config(config_commands=["ls", "echo hello world"])
     self.assertEqual(ret.get("config_commands"), ["ls", "echo hello world"])
     self.assertEqual(ret.get("user"), "salt")
     self.assertEqual(ret.get("password"), "password")
コード例 #2
0
 def test_send_config(self):
     """
     Test netmiko.send_config function
     """
     _, ret = netmiko_mod.send_config(
         config_commands=["ls", "echo hello world"],
         config_mode_command="config config-sess",
     )
     self.assertEqual(ret.get("config_commands"),
                      ["ls", "echo hello world"])
     self.assertEqual(ret.get("config_mode_command"), "config config-sess")
コード例 #3
0
    def test_send_config(self):
        """
        Test netmiko.send_config function
        """
        _, ret = netmiko_mod.send_config(
            config_commands=["ls", "echo hello world"],
            config_mode_command="config config-sess",
        )
        self.assertEqual(ret.get("config_commands"), ["ls", "echo hello world"])
        self.assertEqual(ret.get("config_mode_command"), "config config-sess")

        with patch.dict(
            netmiko_mod.__proxy__, {"netmiko.conn": MagicMock(return_value=None)}
        ):
            _, ret = netmiko_mod.send_config(
                config_commands=["ls", "echo hello world"],
                config_mode_command="config config-sess",
            )
            self.assertEqual(ret.get("config_commands"), ["ls", "echo hello world"])
            self.assertEqual(ret.get("config_mode_command"), "config config-sess")