Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
email
Commits
10adbfb4b9cd
Commit
caf9b4c1
authored
Jan 06, 2016
by
David Douard
Browse files
[py3k] use BytesIO instead of StringIO
parent
1fa5e2c98fce
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/unittest_hooks.py
View file @
10adbfb4
...
...
@@ -3,7 +3,7 @@ import sys
from
os.path
import
join
,
dirname
,
abspath
from
socket
import
gethostname
from
StringIO
import
String
IO
from
io
import
Bytes
IO
from
logilab.common.testlib
import
unittest_main
from
cwclientlib
import
cwproxy
...
...
@@ -182,7 +182,7 @@ class ReplyCommentHooksTC(CubicWebServerTC):
mi
=
Importer
(
cwproxy
.
CWProxy
(
self
.
config
[
'base-url'
],
auth
=
cwproxy
.
SignedRequestAuth
(
self
.
token_id
,
self
.
secret
)))
mi
.
import_mbox_stream
(
StringIO
(
msg
))
mi
.
import_mbox_stream
(
BytesIO
(
msg
.
encode
(
'utf-8'
)
))
with
self
.
admin_access
.
client_cnx
()
as
cnx
:
self
.
assertTrue
(
cnx
.
execute
(
'Email X'
))
b
=
cnx
.
entity_from_eid
(
self
.
b
)
...
...
test/unittest_mboximport.py
View file @
10adbfb4
...
...
@@ -4,7 +4,7 @@ import sys
from
os
import
mkdir
from
os.path
import
join
,
dirname
,
exists
,
abspath
from
StringIO
import
String
IO
from
io
import
Bytes
IO
from
logilab.common.testlib
import
TestCase
,
unittest_main
from
cwclientlib
import
cwproxy
...
...
@@ -89,7 +89,7 @@ http://lists.logilab.org/mailman/listinfo/python-projects''')
self
.
assertEqual
(
part2
.
content_format
,
'text/plain'
)
NOSUBJECT
=
"""
NOSUBJECT
=
b
"""
From python-projects-bounces@lists.logilab.org Tue Mar 28 17:06:41 2006
Return-Path: <python-projects-bounces@lists.logilab.org>
X-Original-To: sylvain.thenault@logilab.fr
...
...
@@ -202,7 +202,7 @@ http://lists.logilab.org/mailman/listinfo/python-projects
def
test_no_subject
(
self
):
mi
=
Importer
(
cwproxy
.
CWProxy
(
self
.
config
[
'base-url'
],
auth
=
cwproxy
.
SignedRequestAuth
(
self
.
token_id
,
self
.
secret
)))
mi
.
import_mbox_stream
(
String
IO
(
self
.
NOSUBJECT
))
mi
.
import_mbox_stream
(
Bytes
IO
(
self
.
NOSUBJECT
))
with
self
.
admin_access
.
client_cnx
()
as
cnx
:
rset
=
cnx
.
execute
(
'Any X ORDERBY S WHERE X is Email, X subject S'
)
self
.
assertEqual
(
len
(
rset
),
1
)
...
...
@@ -212,8 +212,8 @@ http://lists.logilab.org/mailman/listinfo/python-projects
def
test_double_import
(
self
):
mi
=
Importer
(
cwproxy
.
CWProxy
(
self
.
config
[
'base-url'
],
auth
=
cwproxy
.
SignedRequestAuth
(
self
.
token_id
,
self
.
secret
)))
mi
.
import_mbox_stream
(
String
IO
(
self
.
NOSUBJECT
))
mi
.
import_mbox_stream
(
String
IO
(
self
.
NOSUBJECT
))
mi
.
import_mbox_stream
(
Bytes
IO
(
self
.
NOSUBJECT
))
mi
.
import_mbox_stream
(
Bytes
IO
(
self
.
NOSUBJECT
))
with
self
.
admin_access
.
client_cnx
()
as
cnx
:
rset
=
cnx
.
execute
(
'Any X, S ORDERBY S WHERE X is Email, X subject S'
)
self
.
assertEqual
(
len
(
rset
),
1
,
rset
.
rows
)
...
...
@@ -235,7 +235,7 @@ http://lists.logilab.org/mailman/listinfo/python-projects
#self.assertEqual(testrset[0][0], eid2)
cnx
.
commit
()
mi
=
Importer
(
cwproxy
.
CWProxy
(
self
.
config
[
'base-url'
],
auth
=
cwproxy
.
SignedRequestAuth
(
self
.
token_id
,
self
.
secret
)))
mi
.
import_mbox_stream
(
String
IO
(
self
.
NOSUBJECT
))
mi
.
import_mbox_stream
(
Bytes
IO
(
self
.
NOSUBJECT
))
with
self
.
admin_access
.
client_cnx
()
as
cnx
:
rset
=
cnx
.
execute
(
'Any X ORDERBY S WHERE X is Email, X subject S'
)
self
.
assertEqual
(
len
(
rset
),
1
)
...
...
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