Some test cases in test_ftp support python3.X

Some  test cases in test_ftp.py is only support python2.x, update
to support python3.x.

Change-Id: If9b6ecf798285d3bd3b2259cc54b990a07a782f4
This commit is contained in:
Caihui 2020-06-29 00:14:12 -07:00
parent bbc19c7619
commit 564675a7f5
1 changed files with 2 additions and 7 deletions

View File

@ -13,7 +13,6 @@
# limitations under the License.
import shutil
import sys
import tempfile
import unittest
from unittest import mock
@ -217,11 +216,9 @@ class FtpStorageTestCase(unittest.TestCase):
self.assertTrue(mock_ftp.dir.called)
self.assertTrue(mock_ftp.rmd.called)
@unittest.skipIf(sys.version_info.major == 3,
'Not supported on python v 3.x')
@patch("freezer.storage.ftp.BaseFtpStorage.create_dirs")
@patch("freezer.storage.ftp.BaseFtpStorage.put_file")
@patch("__builtin__.open")
@patch("builtins.open")
@patch('ftplib.FTP')
def test_write_backup_FtpStorage(self, mock_ftp_constructor,
mock_open,
@ -252,11 +249,9 @@ class FtpStorageTestCase(unittest.TestCase):
self.assertTrue(mock_create_dirs.called)
self.assertTrue(mock_put_file.called)
@unittest.skipIf(sys.version_info.major == 3,
'Not supported on python v 3.x')
@patch("freezer.storage.ftp.BaseFtpStorage.create_dirs")
@patch("freezer.storage.ftp.BaseFtpStorage.put_file")
@patch("__builtin__.open")
@patch("builtins.open")
@patch('ftplib.FTP')
def test_add_stream_FtpStorage(self, mock_ftp_constructor,
mock_open,