Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a5a3ea31
Commit
a5a3ea31
authored
May 07, 2011
by
Giampaolo Rodola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverting 9688977ef567 committed by accident
parent
edf0735a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
Lib/test/test_ftplib.py
Lib/test/test_ftplib.py
+9
-9
No files found.
Lib/test/test_ftplib.py
View file @
a5a3ea31
...
@@ -123,7 +123,7 @@ class DummyFTPHandler(asynchat.async_chat):
...
@@ -123,7 +123,7 @@ class DummyFTPHandler(asynchat.async_chat):
addr
=
list
(
map
(
int
,
arg
.
split
(
','
)))
addr
=
list
(
map
(
int
,
arg
.
split
(
','
)))
ip
=
'%d.%d.%d.%d'
%
tuple
(
addr
[:
4
])
ip
=
'%d.%d.%d.%d'
%
tuple
(
addr
[:
4
])
port
=
(
addr
[
4
]
*
256
)
+
addr
[
5
]
port
=
(
addr
[
4
]
*
256
)
+
addr
[
5
]
s
=
socket
.
create_connection
((
ip
,
port
),
timeout
=
10
)
s
=
socket
.
create_connection
((
ip
,
port
),
timeout
=
2
)
self
.
dtp
=
self
.
dtp_handler
(
s
,
baseclass
=
self
)
self
.
dtp
=
self
.
dtp_handler
(
s
,
baseclass
=
self
)
self
.
push
(
'200 active data connection established'
)
self
.
push
(
'200 active data connection established'
)
...
@@ -141,7 +141,7 @@ class DummyFTPHandler(asynchat.async_chat):
...
@@ -141,7 +141,7 @@ class DummyFTPHandler(asynchat.async_chat):
def
cmd_eprt
(
self
,
arg
):
def
cmd_eprt
(
self
,
arg
):
af
,
ip
,
port
=
arg
.
split
(
arg
[
0
])[
1
:
-
1
]
af
,
ip
,
port
=
arg
.
split
(
arg
[
0
])[
1
:
-
1
]
port
=
int
(
port
)
port
=
int
(
port
)
s
=
socket
.
create_connection
((
ip
,
port
),
timeout
=
10
)
s
=
socket
.
create_connection
((
ip
,
port
),
timeout
=
2
)
self
.
dtp
=
self
.
dtp_handler
(
s
,
baseclass
=
self
)
self
.
dtp
=
self
.
dtp_handler
(
s
,
baseclass
=
self
)
self
.
push
(
'200 active data connection established'
)
self
.
push
(
'200 active data connection established'
)
...
@@ -440,7 +440,7 @@ class TestFTPClass(TestCase):
...
@@ -440,7 +440,7 @@ class TestFTPClass(TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
server
=
DummyFTPServer
((
HOST
,
0
))
self
.
server
=
DummyFTPServer
((
HOST
,
0
))
self
.
server
.
start
()
self
.
server
.
start
()
self
.
client
=
ftplib
.
FTP
(
timeout
=
10
)
self
.
client
=
ftplib
.
FTP
(
timeout
=
2
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
def
tearDown
(
self
):
def
tearDown
(
self
):
...
@@ -663,7 +663,7 @@ class TestFTPClass(TestCase):
...
@@ -663,7 +663,7 @@ class TestFTPClass(TestCase):
return
True
return
True
# base test
# base test
with
ftplib
.
FTP
(
timeout
=
10
)
as
self
.
client
:
with
ftplib
.
FTP
(
timeout
=
2
)
as
self
.
client
:
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
sendcmd
(
'noop'
)
self
.
client
.
sendcmd
(
'noop'
)
self
.
assertTrue
(
is_client_connected
())
self
.
assertTrue
(
is_client_connected
())
...
@@ -671,7 +671,7 @@ class TestFTPClass(TestCase):
...
@@ -671,7 +671,7 @@ class TestFTPClass(TestCase):
self
.
assertFalse
(
is_client_connected
())
self
.
assertFalse
(
is_client_connected
())
# QUIT sent inside the with block
# QUIT sent inside the with block
with
ftplib
.
FTP
(
timeout
=
10
)
as
self
.
client
:
with
ftplib
.
FTP
(
timeout
=
2
)
as
self
.
client
:
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
sendcmd
(
'noop'
)
self
.
client
.
sendcmd
(
'noop'
)
self
.
client
.
quit
()
self
.
client
.
quit
()
...
@@ -681,7 +681,7 @@ class TestFTPClass(TestCase):
...
@@ -681,7 +681,7 @@ class TestFTPClass(TestCase):
# force a wrong response code to be sent on QUIT: error_perm
# force a wrong response code to be sent on QUIT: error_perm
# is expected and the connection is supposed to be closed
# is expected and the connection is supposed to be closed
try
:
try
:
with
ftplib
.
FTP
(
timeout
=
10
)
as
self
.
client
:
with
ftplib
.
FTP
(
timeout
=
2
)
as
self
.
client
:
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
sendcmd
(
'noop'
)
self
.
client
.
sendcmd
(
'noop'
)
self
.
server
.
handler_instance
.
next_response
=
'550 error on quit'
self
.
server
.
handler_instance
.
next_response
=
'550 error on quit'
...
@@ -779,7 +779,7 @@ class TestTLS_FTPClassMixin(TestFTPClass):
...
@@ -779,7 +779,7 @@ class TestTLS_FTPClassMixin(TestFTPClass):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
server
=
DummyTLS_FTPServer
((
HOST
,
0
))
self
.
server
=
DummyTLS_FTPServer
((
HOST
,
0
))
self
.
server
.
start
()
self
.
server
.
start
()
self
.
client
=
ftplib
.
FTP_TLS
(
timeout
=
10
)
self
.
client
=
ftplib
.
FTP_TLS
(
timeout
=
2
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
# enable TLS
# enable TLS
self
.
client
.
auth
()
self
.
client
.
auth
()
...
@@ -792,7 +792,7 @@ class TestTLS_FTPClass(TestCase):
...
@@ -792,7 +792,7 @@ class TestTLS_FTPClass(TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
server
=
DummyTLS_FTPServer
((
HOST
,
0
))
self
.
server
=
DummyTLS_FTPServer
((
HOST
,
0
))
self
.
server
.
start
()
self
.
server
.
start
()
self
.
client
=
ftplib
.
FTP_TLS
(
timeout
=
10
)
self
.
client
=
ftplib
.
FTP_TLS
(
timeout
=
2
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
def
tearDown
(
self
):
def
tearDown
(
self
):
...
@@ -852,7 +852,7 @@ class TestTLS_FTPClass(TestCase):
...
@@ -852,7 +852,7 @@ class TestTLS_FTPClass(TestCase):
self
.
assertRaises
(
ValueError
,
ftplib
.
FTP_TLS
,
certfile
=
CERTFILE
,
self
.
assertRaises
(
ValueError
,
ftplib
.
FTP_TLS
,
certfile
=
CERTFILE
,
keyfile
=
CERTFILE
,
context
=
ctx
)
keyfile
=
CERTFILE
,
context
=
ctx
)
self
.
client
=
ftplib
.
FTP_TLS
(
context
=
ctx
,
timeout
=
10
)
self
.
client
=
ftplib
.
FTP_TLS
(
context
=
ctx
,
timeout
=
2
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
client
.
connect
(
self
.
server
.
host
,
self
.
server
.
port
)
self
.
assertNotIsInstance
(
self
.
client
.
sock
,
ssl
.
SSLSocket
)
self
.
assertNotIsInstance
(
self
.
client
.
sock
,
ssl
.
SSLSocket
)
self
.
client
.
auth
()
self
.
client
.
auth
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment