diff options
author | Giampaolo RodolĂ <g.rodola@gmail.com> | 2011-02-28 19:19:51 +0000 |
---|---|---|
committer | Giampaolo RodolĂ <g.rodola@gmail.com> | 2011-02-28 19:19:51 +0000 |
commit | cc901f475ad3e6cb58720c2eff7f371d8b0c14d6 (patch) | |
tree | 3e3b133bb5603e0088448f0c876fd59fefda7739 /Lib/test/test_ftplib.py | |
parent | fe3dd6fcd135841272ebeb87a68e7fc6f465afef (diff) | |
download | cpython-cc901f475ad3e6cb58720c2eff7f371d8b0c14d6.tar.gz |
Fix issue 8594: adds a source_address parameter to ftplib module.
Diffstat (limited to 'Lib/test/test_ftplib.py')
-rw-r--r-- | Lib/test/test_ftplib.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index 9d2eab7fa3..5f8a8bde44 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -608,6 +608,20 @@ class TestFTPClass(TestCase): self.assertEqual(self.server.handler_instance.last_received_cmd, 'quit') self.assertFalse(is_client_connected()) + def test_source_address(self): + self.client.quit() + port = support.find_unused_port() + self.client.connect(self.server.host, self.server.port, + source_address=(HOST, port)) + self.assertEqual(self.client.sock.getsockname()[1], port) + self.client.quit() + + def test_source_address_passive_connection(self): + port = support.find_unused_port() + self.client.source_address = (HOST, port) + sock = self.client.transfercmd('list') + self.assertEqual(sock.getsockname()[1], port) + def test_parse257(self): self.assertEqual(ftplib.parse257('257 "/foo/bar"'), '/foo/bar') self.assertEqual(ftplib.parse257('257 "/foo/bar" created'), '/foo/bar') |