# Path: IM/SSHRetry.py
# class SSHRetry(SSH):
#     TRIES = 5
#     DELAY = 3
#     BACKOFF = 2
#     def execute(self, command, timeout=None):
#     def sftp_get(self, src, dest):
#     def sftp_get_files(self, src, dest):
#     def sftp_put_files(self, files):
#     def sftp_put(self, src, dest):
#     def sftp_put_dir(self, src, dest):
#     def sftp_get_dir(self, src, dest):
#     def sftp_put_content(self, content, dest):
#     def sftp_mkdir(self, directory, mode=0o777):
#     def sftp_list(self, directory):
#     def sftp_list_attr(self, directory):
#     def getcwd(self):
#     def sftp_remove(self, path):
#     def sftp_chmod(self, path, mode):


import unittest
import os
from IM.SSHRetry import SSHRetry, SSH
from mock import patch, MagicMock
        client = MagicMock()
        ssh_client.return_value = client
        tansport = MagicMock()
        client.get_transport.return_value = tansport
        channel = MagicMock()
        tansport.open_session.return_value = channel
        channel.makefile.return_value = "out"
        channel.makefile_stderr.return_value = "err"
        channel.recv_exit_status.return_value = 0

        res_stdout, res_stderr, code = ssh.execute_timeout("ls", 5)
        self.assertEqual(res_stdout, "out")
        self.assertEqual(res_stderr, "err")
        self.assertEqual(code, 0)

    @patch('paramiko.SSHClient')
    @patch('paramiko.SFTPClient.from_transport')
    def test_sftp_remove(self, from_transport, ssh_client):
        ssh = SSHRetry("host", "user", "passwd", read_file_as_string("../files/privatekey.pem"))

        client = MagicMock()
        from_transport.return_value = client
        client.remove.return_value = True

        res = ssh.sftp_remove("some_file")
        self.assertTrue(res)

    @patch('paramiko.SSHClient')
    @patch('paramiko.SFTPClient.from_transport')
    def test_sftp_chmod(self, from_transport, ssh_client):

# Path: IM/SSHRetry.py
# class SSHRetry(SSH):
#     TRIES = 5
#     DELAY = 3
#     BACKOFF = 2
#     def execute(self, command, timeout=None):
#     def sftp_get(self, src, dest):
#     def sftp_get_files(self, src, dest):
#     def sftp_put_files(self, files):
#     def sftp_put(self, src, dest):
#     def sftp_put_dir(self, src, dest):
#     def sftp_get_dir(self, src, dest):
#     def sftp_put_content(self, content, dest):
#     def sftp_mkdir(self, directory, mode=0o777):
#     def sftp_list(self, directory):
#     def sftp_list_attr(self, directory):
#     def getcwd(self):
#     def sftp_remove(self, path):
#     def sftp_chmod(self, path, mode):


# Path: test/unit/SSH.py
import unittest
import os
from IM.SSHRetry import SSHRetry, SSH
from mock import patch, MagicMock

        client = MagicMock()
        ssh_client.return_value = client
        tansport = MagicMock()
        client.get_transport.return_value = tansport
        channel = MagicMock()
        tansport.open_session.return_value = channel
        channel.makefile.return_value = "out"
        channel.makefile_stderr.return_value = "err"
        channel.recv_exit_status.return_value = 0

        res_stdout, res_stderr, code = ssh.execute_timeout("ls", 5)
        self.assertEqual(res_stdout, "out")
        self.assertEqual(res_stderr, "err")
        self.assertEqual(code, 0)

    @patch('paramiko.SSHClient')
    @patch('paramiko.SFTPClient.from_transport')
    def test_sftp_remove(self, from_transport, ssh_client):
        ssh = SSHRetry("host", "user", "passwd", read_file_as_string("../files/privatekey.pem"))

        client = MagicMock()
        from_transport.return_value = client
        client.remove.return_value = True

        res = ssh.sftp_remove("some_file")
        self.assertTrue(res)

    @patch('paramiko.SSHClient')
    @patch('paramiko.SFTPClient.from_transport')
    def test_sftp_chmod(self, from_transport, ssh_client):

        ssh = SSHRetry("host", "user", "passwd", read_file_as_string("../files/privatekey.pem"))