Changeset 1677:b4c9b089b6b8
- Timestamp:
- Oct 28, 2017, 7:17:42 PM (16 months ago)
- Branch:
- default
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ftputil/host.py
r1676 r1677 78 78 with ftputil.error.ftplib_error_to_ftp_os_error: 79 79 self._cached_current_dir = \ 80 ftputil.tool.as_unicode(self._session.pwd())80 self.path.normpath(ftputil.tool.as_unicode(self._session.pwd())) 81 81 # Associated `FTPHost` objects for data transfer. 82 82 self._children = [] -
test/test_host.py
r1663 r1677 71 71 if not hasattr(self, "pwd_called"): 72 72 self.pwd_called = True 73 return "/home" 73 74 else: 74 75 raise ftplib.error_temp 76 77 78 class UnnormalizedCurrentWorkingDirectory(mock_ftplib.MockSession): 79 80 def pwd(self): 81 # Deliberately return the current working directory with a 82 # trailing slash to test if it's removed when stored in the 83 # `FTPHost` instance. 84 return "/home/" 75 85 76 86 … … 159 169 # Test cases 160 170 # 161 class TestInitAndClose(object): 162 """Test initialization and closure of `FTPHost` objects.""" 171 class TestConstructor(object): 172 """ 173 Test initialization of `FTPHost` objects. 174 """ 163 175 164 176 def test_open_and_close(self): 177 """ 178 Test if opening and closing an `FTPHost` object works as 179 expected. 180 """ 165 181 host = test_base.ftp_host_factory() 166 182 host.close() … … 168 184 assert host._children == [] 169 185 170 171 class TestLogin(object):172 173 186 def test_invalid_login(self): 174 187 """Login to invalid host must fail.""" 175 188 with pytest.raises(ftputil.error.FTPOSError): 176 189 test_base.ftp_host_factory(FailOnLoginSession) 190 191 def test_pwd_normalization(self): 192 """ 193 Test if the stored current directory is normalized. 194 """ 195 host = test_base.ftp_host_factory(UnnormalizedCurrentWorkingDirectory) 196 assert host.getcwd() == "/home" 177 197 178 198
Note: See TracChangeset
for help on using the changeset viewer.