Exemplo n.º 1
0
 def test_execute_command_error(self):
     auto_connect_ssh = AutoConnectSSH('user1', 'host1')
     auto_connect_ssh._client = mock.Mock()
     auto_connect_ssh.run = mock.Mock(side_effect=self._mock_run)
     self.assertRaises(exceptions.SSHError,
                       auto_connect_ssh.execute,
                       'ls',
                       raise_on_error=True)
     exit_code, _, _ = auto_connect_ssh.execute('ls')
     self.assertNotEqual(exit_code, 0)
Exemplo n.º 2
0
 def test_execute(self):
     auto_connect_ssh = AutoConnectSSH('user1', 'host1')
     auto_connect_ssh._client = mock.Mock()
     auto_connect_ssh.run = mock.Mock(return_value=0)
     exit_code, _, _ = auto_connect_ssh.execute('')
     self.assertEqual(exit_code, 0)