Commit 430f14e8 authored by Julien Cristau's avatar Julien Cristau
Browse files

[test] stop using pyro-based mbox importer

parent d013d8f4e6d6
......@@ -4,8 +4,10 @@ from StringIO import StringIO
from os.path import join
from logilab.common.testlib import unittest_main
from cwclientlib import cwproxy
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb.devtools.httptest import CubicWebServerTC
from cubicweb.mail import construct_message_id
MSG = u'''From Tue Jan 23 15:21:10 2007
......@@ -146,24 +148,26 @@ hop
from import MBOXImporter
from import Importer
class ReplyCommentHooksTC(CubicWebTC):
class ReplyCommentHooksTC(CubicWebServerTC):
token_id = u'mboximport'
def setup_database(self):
with self.admin_access.client_cnx() as cnx:
self.b = cnx.create_entity('BlogEntry', title=u"une news !", content=u"cubicweb c'est beau").eid
e = cnx.create_entity('EmailAddress', address=u'', alias=u'syt')
cnx.execute('SET X use_email E WHERE X login "anon", E eid %(e)s', {'e': e.eid})
cnx.create_entity('AuthToken', enabled=True, id=self.token_id, token_for_user=cnx.user)
self.secret = cnx.execute('String X WHERE T token X')[0][0]
def test_comment_created(self):
msg = open(join(self.datadir, 'reply.mbox'), 'rb').read() % \
construct_message_id(self.vreg.config.appid, self.b, False)
mi = Importer(cwproxy.CWProxy(self.config['base-url'], auth=cwproxy.SignedRequestAuth(self.token_id, self.secret)))
with self.admin_access.client_cnx() as cnx:
mi = MBOXImporter(cnx)
self.assertTrue(cnx.execute('Email X'))
b = cnx.entity_from_eid(self.b)
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