mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
Fix issue 8594: adds a source_address parameter to ftplib module.
This commit is contained in:
parent
8a14a0c88b
commit
396ff06051
4 changed files with 49 additions and 12 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue