Commit 9f849ab5 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

default is stable

--HG--
branch : stable
# -*- 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()
......
"""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)])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment