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
2b46da8af305
Commit
dbab9e2c
authored
Jan 17, 2011
by
Sylvain Thénault
Browse files
make test cwd independant
parent
e8c667bb9774
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/unittest_hooks.py
View file @
2b46da8a
# -*- coding: iso-8859-1 -*-
# -*- coding: iso-8859-1 -*-
from
socket
import
gethostname
from
socket
import
gethostname
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
os.path
import
join
from
logilab.common.testlib
import
unittest_main
from
logilab.common.testlib
import
unittest_main
...
@@ -149,7 +150,7 @@ class ReplyCommentHooksTC(CubicWebTC):
...
@@ -149,7 +150,7 @@ class ReplyCommentHooksTC(CubicWebTC):
def
test_comment_created
(
self
):
def
test_comment_created
(
self
):
mi
=
MBOXImporter
(
self
.
cnx
)
mi
=
MBOXImporter
(
self
.
cnx
)
msg
=
open
(
'data/
reply.mbox'
,
'rb'
).
read
()
%
\
msg
=
open
(
join
(
self
.
datadir
,
'
reply.mbox'
)
,
'rb'
).
read
()
%
\
construct_message_id
(
self
.
vreg
.
config
.
appid
,
self
.
b
.
eid
,
False
)
construct_message_id
(
self
.
vreg
.
config
.
appid
,
self
.
b
.
eid
,
False
)
mi
.
import_mbox_stream
(
StringIO
(
msg
))
mi
.
import_mbox_stream
(
StringIO
(
msg
))
self
.
commit
()
self
.
commit
()
...
...
test/unittest_mboximport.py
View file @
2b46da8a
"""unit tests for email mbox import functionnality"""
"""unit tests for email mbox import functionnality"""
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
os.path
import
join
from
logilab.common.testlib
import
TestCase
,
unittest_main
from
logilab.common.testlib
import
TestCase
,
unittest_main
...
@@ -13,7 +14,7 @@ class MBOXImporterTC(CubicWebTC):
...
@@ -13,7 +14,7 @@ class MBOXImporterTC(CubicWebTC):
def
test_all
(
self
):
def
test_all
(
self
):
mi
=
MBOXImporter
(
self
.
cnx
)
mi
=
MBOXImporter
(
self
.
cnx
)
mi
.
import_mbox_stream
(
open
(
'data/
mbox'
))
mi
.
import_mbox_stream
(
open
(
join
(
self
.
datadir
,
'
mbox'
))
)
self
.
assertEqual
(
sorted
([(
x
,
len
(
y
))
for
x
,
y
in
mi
.
created
.
items
()]),
self
.
assertEqual
(
sorted
([(
x
,
len
(
y
))
for
x
,
y
in
mi
.
created
.
items
()]),
[(
'email'
,
2
),
(
'emailaddress'
,
4
),
[(
'email'
,
2
),
(
'emailaddress'
,
4
),
(
'emailpart'
,
5
),
(
'emailthread'
,
2
),
(
'file'
,
2
)])
(
'emailpart'
,
5
),
(
'emailthread'
,
2
),
(
'file'
,
2
)])
...
...
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