Ticket #2875: 2875-ftp-access-1.diff
| File 2875-ftp-access-1.diff, 1.8 KB (added by adiroiban, 11 months ago) |
|---|
-
twisted/test/test_ftp.py
2589 2589 return self.assertFailure(d, ftp.FileNotFoundError) 2590 2590 2591 2591 2592 def test_accessNotAllowed(self): 2593 """ 2594 access should fail on a resource for which we can't list its content. 2595 """ 2596 path = 'foo' 2597 self.createDirectory(path) 2598 self.root.child(path).chmod(000) 2599 d = self.shell.access((path,)) 2600 2601 def revert_permissions(result_or_failure): 2602 """Folder permissions are reverted so that any clean function 2603 will be allowed to remove the folder. 2604 """ 2605 self.root.child(path).chmod(0700) 2606 self.root.child(path).remove() 2607 return result_or_failure 2608 2609 d.addBoth(revert_permissions) 2610 return self.assertFailure(d, ftp.PermissionDeniedError) 2611 2612 if not os.name == 'posix': 2613 test_accessNotAllowed.skip = "test_accessNotAllowed not supported" 2614 2592 2615 def test_openForReading(self): 2593 2616 """ 2594 2617 Check that openForReading returns an object providing C{ftp.IReadFile}. -
twisted/protocols/ftp.py
1674 1674 1675 1675 1676 1676 def access(self, path): 1677 """ 1678 See L{IFTPShell.access}. 1679 1680 If path doesn't exists, it returns L{FileNotFoundError}. 1681 It checks path access by issuing a folder listing command. 1682 """ 1677 1683 p = self._path(path) 1678 1684 if not p.exists(): 1679 1685 # Again, win32 doesn't report a sane error after, so let's fail
