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
b1436f18
Commit
b1436f18
authored
Nov 09, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix IMAP.login() to work properly.
Also, add remote tests for imaplib (part of #4471).
parent
adffced3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
6 deletions
+48
-6
Lib/imaplib.py
Lib/imaplib.py
+3
-3
Lib/test/test_imaplib.py
Lib/test/test_imaplib.py
+43
-3
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/imaplib.py
View file @
b1436f18
...
...
@@ -1054,10 +1054,10 @@ class IMAP4:
def
_quote
(
self
,
arg
):
arg
=
arg
.
replace
(
b'
\
\
'
,
b
'
\
\
\
\
'
)
arg
=
arg
.
replace
(
b'"'
,
b
'
\
\
"'
)
arg
=
arg
.
replace
(
'
\
\
'
,
'
\
\
\
\
'
)
arg
=
arg
.
replace
(
'"'
,
'
\
\
"'
)
return
b'"'
+
arg
+
b
'"'
return
'"'
+
arg
+
'"'
def
_simple_command
(
self
,
name
,
*
args
):
...
...
Lib/test/test_imaplib.py
View file @
b1436f18
...
...
@@ -10,7 +10,7 @@ import os.path
import
socketserver
import
time
from
test.support
import
reap_threads
,
verbose
from
test.support
import
reap_threads
,
verbose
,
transient_internet
import
unittest
try
:
...
...
@@ -192,8 +192,45 @@ class ThreadedNetworkedTestsSSL(BaseThreadedNetworkedTests):
imap_class
=
IMAP4_SSL
def
test_main
():
class
RemoteIMAPTest
(
unittest
.
TestCase
):
host
=
'cyrus.andrew.cmu.edu'
port
=
143
username
=
'anonymous'
password
=
'pass'
imap_class
=
imaplib
.
IMAP4
def
setUp
(
self
):
with
transient_internet
(
self
.
host
):
self
.
server
=
self
.
imap_class
(
self
.
host
,
self
.
port
)
def
tearDown
(
self
):
if
self
.
server
is
not
None
:
self
.
server
.
logout
()
def
test_logincapa
(
self
):
self
.
assertTrue
(
'LOGINDISABLED'
in
self
.
server
.
capabilities
)
def
test_anonlogin
(
self
):
self
.
assertTrue
(
'AUTH=ANONYMOUS'
in
self
.
server
.
capabilities
)
rs
=
self
.
server
.
login
(
self
.
username
,
self
.
password
)
self
.
assertEqual
(
rs
[
0
],
'OK'
)
def
test_logout
(
self
):
rs
=
self
.
server
.
logout
()
self
.
assertEqual
(
rs
[
0
],
'BYE'
)
@
unittest
.
skipUnless
(
ssl
,
"SSL not available"
)
class
RemoteIMAP_SSLTest
(
RemoteIMAPTest
):
port
=
993
imap_class
=
IMAP4_SSL
def
test_logincapa
(
self
):
self
.
assertFalse
(
'LOGINDISABLED'
in
self
.
server
.
capabilities
)
self
.
assertTrue
(
'AUTH=PLAIN'
in
self
.
server
.
capabilities
)
def
test_main
():
tests
=
[
TestImaplib
]
if
support
.
is_resource_enabled
(
'network'
):
...
...
@@ -203,7 +240,10 @@ def test_main():
"keycert.pem"
)
if
not
os
.
path
.
exists
(
CERTFILE
):
raise
support
.
TestFailed
(
"Can't read certificate files!"
)
tests
.
extend
([
ThreadedNetworkedTests
,
ThreadedNetworkedTestsSSL
])
tests
.
extend
([
ThreadedNetworkedTests
,
ThreadedNetworkedTestsSSL
,
RemoteIMAPTest
,
RemoteIMAP_SSLTest
,
])
support
.
run_unittest
(
*
tests
)
...
...
Misc/NEWS
View file @
b1436f18
...
...
@@ -60,6 +60,8 @@ Core and Builtins
Library
-------
- Fix IMAP.login() to work properly.
- Issue #9244: multiprocessing pool worker processes could terminate
unexpectedly if the return value of a task could not be pickled. Only
the ``repr`` of such errors are now sent back, wrapped in an
...
...
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