def test_failed_ssh_connection_with_mock(self):
        """Test unsuccessful SSH Connection with mock."""

        command = 'echo hello'
        response = Exception("Connection unSuccessful")
        self._mock_exec_command({command: response})

        client = None
        try:
            client = Client('127.0.0.1', 'mock', 'mock')
            output = client.execute('echo hello')
            self.fail("Connection unSuccessful")
        except Exception as e:
            self.assertTrue("Connection unSuccessful", e)

        finally:
            if client is not None:
                client.disconnect()
    def test_failed_ssh_connection_with_mock(self):
        """Test unsuccessful SSH Connection with mock."""

        command = 'echo hello'
        response = Exception("Connection unSuccessful")
        self._mock_exec_command({command: response})

        client = None
        try:
            client = Client('127.0.0.1', 'mock', 'mock')
            output = client.execute('echo hello')
            self.fail("Connection unSuccessful")
        except Exception as e:
            self.assertTrue("Connection unSuccessful", e)

        finally:
            if client is not None:
                client.disconnect()
    def test_successful_ssh_connection_with_mock(self):
        """Test successful SSH Connection with mock."""

        command = 'echo hello'
        response = 'hello'
        self._mock_exec_command({command: response})

        client = None
        try:
            client = Client('127.0.0.1', 'mock', 'mock')
            output = client.execute(command)
            self.assertEqual(response, output)
        except Exception as e:
            self.fail(e)

        finally:
            if client is not None:
                client.disconnect()
    def test_successful_ssh_connection_with_mock(self):
        """Test successful SSH Connection with mock."""

        command = 'echo hello'
        response = 'hello'
        self._mock_exec_command({command: response})

        client = None
        try:
            client = Client('127.0.0.1', 'mock', 'mock')
            output = client.execute(command)
            self.assertEqual(response, output)
        except Exception as e:
            self.fail(e)

        finally:
            if client is not None:
                client.disconnect()