summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ftplib.py
diff options
context:
space:
mode:
authorGiampaolo RodolĂ  <g.rodola@gmail.com>2010-08-23 22:10:32 (GMT)
committerGiampaolo RodolĂ  <g.rodola@gmail.com>2010-08-23 22:10:32 (GMT)
commitbbc4782d77ac76e317182fb2400c6b7e1c305bdd (patch)
treefa7af8dead271eb695e12e70a7a9be79009085bc /Lib/test/test_ftplib.py
parent076e031e54bd8d50b1d54083c86c7c6d53eed6bb (diff)
downloadcpython-bbc4782d77ac76e317182fb2400c6b7e1c305bdd.zip
cpython-bbc4782d77ac76e317182fb2400c6b7e1c305bdd.tar.gz
cpython-bbc4782d77ac76e317182fb2400c6b7e1c305bdd.tar.bz2
fix issue 9601: ftplib now provides a workaround for invalid response code returned on MKD and PWD by non-compliant FTPserver implementations such as ISS shipped with Windows server 2003
Diffstat (limited to 'Lib/test/test_ftplib.py')
-rw-r--r--Lib/test/test_ftplib.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index c8d0d88..8164ede 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -606,6 +606,18 @@ class TestFTPClass(TestCase):
self.assertEqual(self.server.handler_instance.last_received_cmd, 'quit')
self.assertFalse(is_client_connected())
+ def test_parse257(self):
+ self.assertEqual(ftplib.parse257('257 "/foo/bar"'), '/foo/bar')
+ self.assertEqual(ftplib.parse257('257 "/foo/bar" created'), '/foo/bar')
+ self.assertEqual(ftplib.parse257('257 ""'), '')
+ self.assertEqual(ftplib.parse257('257 "" created'), '')
+ self.assertRaises(ftplib.error_reply, ftplib.parse257, '250 "/foo/bar"')
+ # The 257 response is supposed to include the directory
+ # name and in case it contains embedded double-quotes
+ # they must be doubled (see RFC-959, chapter 7, appendix 2).
+ self.assertEqual(ftplib.parse257('257 "/foo/b""ar"'), '/foo/b"ar')
+ self.assertEqual(ftplib.parse257('257 "/foo/b""ar" created'), '/foo/b"ar')
+
class TestIPv6Environment(TestCase):