Add ftp createdir suceess unit test

The patch add ftp createdir ok unit test

Change-Id: I790b3236057065399821ff8f7d9a0eee909f8740
This commit is contained in:
gecong1973 2018-12-07 19:44:27 -08:00
parent 6df8069992
commit 3ce7041715
1 changed files with 17 additions and 0 deletions

View File

@ -229,6 +229,23 @@ class FtpStorageTestCase(unittest.TestCase):
self.assertTrue(mock_ftp.retrbinary.called)
self.delete_ftp_test_file()
@patch('ftplib.FTP')
def test_create_dirs_ok_FtpStorage(self, mock_ftp_constructor):
mock_ftp = mock_ftp_constructor.return_value
ftpobj = ftp.FtpStorage(
storage_path=self.ftp_opt.ftp_storage_path,
remote_pwd=self.ftp_opt.ftp_remote_pwd,
remote_username=self.ftp_opt.ftp_remote_username,
remote_ip=self.ftp_opt.ftp_remote_ip,
port=self.ftp_opt.ftp_port,
max_segment_size=self.ftp_opt.ftp_max_segment_size)
path = '/'
ftpobj.create_dirs(path)
mock_ftp.cwd.assert_called_with(path)
path = '/home'
ftpobj.create_dirs(path)
mock_ftp.cwd.assert_called_with(path)
class FtpsStorageTestCase(unittest.TestCase):