Changeset 140
- Timestamp:
- 2002-03-30 22:18:20 (7 years ago)
- Files:
-
- trunk/_test_ftputil.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/_test_ftputil.py
r139 r140 30 30 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 31 32 # $Id: _test_ftputil.py,v 1. 49 2002/03/30 22:14:53schwa Exp $32 # $Id: _test_ftputil.py,v 1.50 2002/03/30 22:18:20 schwa Exp $ 33 33 34 34 import unittest … … 44 44 45 45 46 class FailOnLoginSession(_mock_ftplib.MockSession): 47 def __init__(self, host='', user='', password=''): 48 raise ftplib.error_perm 49 50 class ReadMockSession(_mock_ftplib.MockSession): 51 mock_file_content = 'line 1\r\nanother line\r\nyet another line' 52 53 class AsciiReadMockSession(_mock_ftplib.MockSession): 54 mock_file_content = '\r\n'.join( map( str, range(20) ) ) 55 46 # 47 # helper functions to generate random data 48 # 56 49 def random_data(pool, size=10000): 57 50 """ … … 77 70 return random_data(pool) 78 71 72 # 73 # several customized MockSession classes 74 # 75 class FailOnLoginSession(_mock_ftplib.MockSession): 76 def __init__(self, host='', user='', password=''): 77 raise ftplib.error_perm 78 79 class ReadMockSession(_mock_ftplib.MockSession): 80 mock_file_content = 'line 1\r\nanother line\r\nyet another line' 81 82 class AsciiReadMockSession(_mock_ftplib.MockSession): 83 mock_file_content = '\r\n'.join( map( str, range(20) ) ) 84 79 85 class BinaryDownloadMockSession(_mock_ftplib.MockSession): 80 86 mock_file_content = binary_data() 81 87 82 88 89 # 90 # factory to produce FTPHost-like classes from a given FTPHost 91 # class and a given MockSession class 83 92 def ftp_host_factory(session_factory=_mock_ftplib.MockSession, 84 93 ftp_host_class=ftputil.FTPHost): … … 87 96 88 97 98 # 99 # test cases 100 # 89 101 class TestLogin(unittest.TestCase): 90 102 """Test invalid logins."""
