diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2017-07-26 07:04:42 (GMT) |
---|---|---|
committer | Ned Deily <nad@python.org> | 2017-07-26 07:04:42 (GMT) |
commit | 19b2890014d3098147d16475c492a47a43893768 (patch) | |
tree | 4c16d5fe794e062575e9b1a324a2ec960cd313ce /Lib/test | |
parent | 49175b3b670a4514b5dc5dcf7b58203d2be852c1 (diff) | |
download | cpython-19b2890014d3098147d16475c492a47a43893768.zip cpython-19b2890014d3098147d16475c492a47a43893768.tar.gz cpython-19b2890014d3098147d16475c492a47a43893768.tar.bz2 |
[3.5] [security] bpo-30119: fix ftplib.FTP.putline() to throw an error for a illegal command (#1214) (#2887)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ftplib.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index aef66da..583d3b1 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -482,6 +482,9 @@ class TestFTPClass(TestCase): self.assertEqual(self.client.sanitize('PASS 12345'), repr('PASS *****')) def test_exceptions(self): + self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\r\n0') + self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\n0') + self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\r0') self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 400') self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 499') self.assertRaises(ftplib.error_perm, self.client.sendcmd, 'echo 500') @@ -490,7 +493,8 @@ class TestFTPClass(TestCase): def test_all_errors(self): exceptions = (ftplib.error_reply, ftplib.error_temp, ftplib.error_perm, - ftplib.error_proto, ftplib.Error, OSError, EOFError) + ftplib.error_proto, ftplib.Error, OSError, + EOFError) for x in exceptions: try: raise x('exception not included in all_errors set') |