Changeset 1807:65b79d35761d
- Timestamp:
- Jun 17, 2019, 10:09:53 PM (21 months ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/test_host.py
r1806 r1807 26 26 from test import test_base 27 27 import test.scripted_session as scripted_session 28 29 30 Call = scripted_session.Call 28 31 29 32 … … 128 131 """ 129 132 script = [ 130 scripted_session.Call(method_name="__init__", result=None),131 scripted_session.Call(method_name="pwd", result="/"),132 scripted_session.Call(method_name="close")133 Call(method_name="__init__", result=None), 134 Call(method_name="pwd", result="/"), 135 Call(method_name="close") 133 136 ] 134 137 host = test_base.ftp_host_factory(scripted_session.factory(script)) … … 140 143 """Login to invalid host must fail.""" 141 144 script = [ 142 scripted_session.Call(method_name="__init__", result=ftplib.error_perm),143 scripted_session.Call(method_name="pwd", result="/"),145 Call(method_name="__init__", result=ftplib.error_perm), 146 Call(method_name="pwd", result="/"), 144 147 ] 145 148 with pytest.raises(ftputil.error.FTPOSError): … … 151 154 """ 152 155 script = [ 153 scripted_session.Call(method_name="__init__", result=None),156 Call(method_name="__init__", result=None), 154 157 # Deliberately return the current working directory with a 155 158 # trailing slash to test if it's removed when stored in the 156 159 # `FTPHost` instance. 157 scripted_session.Call(method_name="pwd", result="/home/")160 Call(method_name="pwd", result="/home/") 158 161 ] 159 162 host = test_base.ftp_host_factory(scripted_session.factory(script)) … … 171 174 """Assume the connection has timed out, so `keep_alive` fails.""" 172 175 script = [ 173 scripted_session.Call(method_name="__init__", result=None),174 scripted_session.Call(method_name="pwd", result="/home"),176 Call(method_name="__init__", result=None), 177 Call(method_name="pwd", result="/home"), 175 178 # Simulate failing `pwd` call after the server closed the connection 176 179 # due to a session timeout. 177 scripted_session.Call(method_name="pwd", result=ftplib.error_temp),180 Call(method_name="pwd", result=ftplib.error_temp), 178 181 ] 179 182 host = test_base.ftp_host_factory(scripted_session.factory(script)) … … 205 208 def test_set_parser(self): 206 209 """Test if the selected parser is used.""" 207 Call = scripted_session.Call208 210 script = [ 209 211 Call(method_name="__init__", result=None), … … 231 233 implemented by the server. 232 234 """ 233 Call = scripted_session.Call234 235 script = [ 235 236 Call(method_name="__init__"), … … 271 272 `session.dir` unmodified. 272 273 """ 273 Call = scripted_session.Call274 274 script = [ 275 275 Call(method_name="__init__"), … … 293 293 an empty string. 294 294 """ 295 Call = scripted_session.Call296 295 dir_result = """\ 297 296 total 10 … … 326 325 def test_download(self): 327 326 """Test mode download.""" 328 Call = scripted_session.Call329 327 remote_file_name = "dummy_name" 330 328 remote_file_content = b"dummy_content" … … 370 368 If the target file is newer, no upload should happen. 371 369 """ 372 Call = scripted_session.Call373 370 local_source = "_test_source_" 374 371 data = binary_data() … … 402 399 should be uploaded. 403 400 """ 404 Call = scripted_session.Call405 401 file_content = b"dummy_content" 406 402 local_source = "_test_source_" … … 475 471 data = binary_data() 476 472 # Target does not exist, so download. 477 Call = scripted_session.Call478 473 # There isn't a `dir` call to compare the datetimes of the 479 474 # remote and the target file because the local `exists` call … … 512 507 data = binary_data() 513 508 # Target is older, so download. 514 Call = scripted_session.Call515 509 # Use a date in the future. That isn't realistic, but for the 516 510 # purpose of the test it's an easy way to make sure the source … … 555 549 pass 556 550 data = binary_data() 557 Call = scripted_session.Call558 551 # Use date in the past, so the target file is newer and no 559 552 # download happens. … … 613 606 def test_rounded_time_shift(self): 614 607 """Test if time shift is rounded correctly.""" 615 Call = scripted_session.Call616 608 script = [ 617 609 Call("__init__"), … … 642 634 def test_assert_valid_time_shift(self): 643 635 """Test time shift sanity checks.""" 644 Call = scripted_session.Call645 636 script = [ 646 637 Call("__init__"), … … 670 661 def test_synchronize_times(self): 671 662 """Test time synchronization with server.""" 672 Call = scripted_session.Call673 663 host_script = [ 674 664 Call("__init__"), … … 729 719 def test_synchronize_times_for_server_in_east(self): 730 720 """Test for timestamp correction (see ticket #55).""" 731 Call = scripted_session.Call732 721 host_script = [ 733 722 Call("__init__"), … … 783 772 def test_upload(self): 784 773 """Test whether `upload` accepts either unicode or bytes.""" 785 Call = scripted_session.Call786 774 host_script = [ 787 775 Call("__init__"), … … 814 802 def test_download(self): 815 803 """Test whether `download` accepts either unicode or bytes.""" 816 Call = scripted_session.Call817 804 host_script = [ 818 805 Call("__init__"), … … 847 834 def test_rename(self): 848 835 """Test whether `rename` accepts either unicode or bytes.""" 849 Call = scripted_session.Call850 836 script = [ 851 837 Call("__init__"), … … 867 853 """Test whether `listdir` accepts either unicode or bytes.""" 868 854 as_bytes = ftputil.tool.as_bytes 869 Call = scripted_session.Call870 855 top_level_dir_line = test_base.dir_line(mode_string="drwxr-xr-x", 871 856 date_=datetime.date.today(), … … 904 889 def test_chmod(self): 905 890 """Test whether `chmod` accepts either unicode or bytes.""" 906 Call = scripted_session.Call907 891 script = [ 908 892 Call("__init__"), … … 938 922 def test_chdir(self): 939 923 """Test whether `chdir` accepts either unicode or bytes.""" 940 Call = scripted_session.Call941 924 script = [ 942 925 Call("__init__"), … … 949 932 def test_mkdir(self): 950 933 """Test whether `mkdir` accepts either unicode or bytes.""" 951 Call = scripted_session.Call952 934 script = [ 953 935 Call("__init__"), … … 963 945 def test_makedirs(self): 964 946 """Test whether `makedirs` accepts either unicode or bytes.""" 965 Call = scripted_session.Call966 947 script = [ 967 948 Call("__init__"), … … 980 961 def test_rmdir(self): 981 962 """Test whether `rmdir` accepts either unicode or bytes.""" 982 Call = scripted_session.Call983 963 dir_line = test_base.dir_line(mode_string="drwxr-xr-x", 984 964 date_=datetime.date.today(), … … 1032 1012 def test_remove(self): 1033 1013 """Test whether `remove` accepts either unicode or bytes.""" 1034 Call = scripted_session.Call1035 1014 dir_line = test_base.dir_line(mode_string="-rw-r--r--", 1036 1015 date_=datetime.date.today(), … … 1053 1032 def test_rmtree(self): 1054 1033 """Test whether `rmtree` accepts either unicode or bytes.""" 1055 Call = scripted_session.Call1056 1034 dir_line = test_base.dir_line(mode_string="drwxr-xr-x", 1057 1035 date_=datetime.date.today(), … … 1089 1067 def test_lstat(self): 1090 1068 """Test whether `lstat` accepts either unicode or bytes.""" 1091 Call = scripted_session.Call1092 1069 dir_line = test_base.dir_line(mode_string="-rw-r--r--", 1093 1070 date_=datetime.date.today(), … … 1106 1083 def test_stat(self): 1107 1084 """Test whether `stat` accepts either unicode or bytes.""" 1108 Call = scripted_session.Call1109 1085 dir_line = test_base.dir_line(mode_string="-rw-r--r--", 1110 1086 date_=datetime.date.today(), … … 1123 1099 def test_walk(self): 1124 1100 """Test whether `walk` accepts either unicode or bytes.""" 1125 Call = scripted_session.Call1126 1101 dir_line = test_base.dir_line(mode_string="-rw-r--r--", 1127 1102 date_=datetime.date.today(),
Note: See TracChangeset
for help on using the changeset viewer.