diff --git a/test/unittest_blog.py b/test/unittest_blog.py index be454372d12a763a7271808cfe175a6f34b31866_dGVzdC91bml0dGVzdF9ibG9nLnB5..0e9f94ed3b8cf5ed636386a5450b90d51687ef2a_dGVzdC91bml0dGVzdF9ibG9nLnB5 100644 --- a/test/unittest_blog.py +++ b/test/unittest_blog.py @@ -1,3 +1,2 @@ """Blog unit tests""" -import re @@ -3,4 +2,4 @@ -from logilab.common.testlib import unittest_main, mock_object +from logilab.common.testlib import unittest_main from cubicweb.devtools.testlib import CubicWebTC, MAILBOX @@ -5,12 +4,8 @@ from cubicweb.devtools.testlib import CubicWebTC, MAILBOX -from email.Header import decode_header -from cubicweb.sobjects.notification import RenderAndSendNotificationView -from cubicweb.server.hookhelper import SendMailOp - class BlogTestsCubicWebTC(CubicWebTC): """test blog specific behaviours""" def test_notifications(self): req = self.request() @@ -11,8 +6,9 @@ class BlogTestsCubicWebTC(CubicWebTC): """test blog specific behaviours""" def test_notifications(self): req = self.request() - cubicweb_blog = req.create_entity('Blog', title=u'cubicweb', description=u"cubicweb c'est beau") + cubicweb_blog = req.create_entity('Blog', title=u'cubicweb', + description=u"cubicweb c'est beau") blog_entry_1 = req.create_entity('BlogEntry', title=u"hop", content=u"cubicweb hop") @@ -18,3 +14,3 @@ blog_entry_1 = req.create_entity('BlogEntry', title=u"hop", content=u"cubicweb hop") - self.execute('SET E entry_of B WHERE B eid %(beid)s, E eid %(eeid)s' % {'beid' :cubicweb_blog.eid, 'eeid' : blog_entry_1.eid}) + blog_entry_1.set_relations(entry_of=cubicweb_blog) blog_entry_2 = req.create_entity('BlogEntry', title=u"yes", content=u"cubicweb yes") @@ -20,5 +16,5 @@ blog_entry_2 = req.create_entity('BlogEntry', title=u"yes", content=u"cubicweb yes") - self.execute('SET E entry_of B WHERE B eid %(beid)s, E eid %(eeid)s' % {'beid' :cubicweb_blog.eid, 'eeid' : blog_entry_2.eid}) + blog_entry_2.set_relations(entry_of=cubicweb_blog) self.assertEquals(len(MAILBOX), 0) self.commit() self.assertEquals(len(MAILBOX), 0)