[testlib] add convenience assertion method to check __message
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 26 May 2011 08:32:15 +0200
changeset 7441 b70f4f4c8620
parent 7440 539de926ec9d
child 7442 aee55fb4633c
[testlib] add convenience assertion method to check __message
devtools/testlib.py
--- a/devtools/testlib.py	Thu May 26 08:12:42 2011 +0200
+++ b/devtools/testlib.py	Thu May 26 08:32:15 2011 +0200
@@ -500,6 +500,10 @@
         it2 = set(getattr(x, 'eid', x) for x in it2)
         super(CubicWebTC, self).assertItemsEqual(it1, it2, *args, **kwargs)
 
+    def assertMessageEqual(self, req, params, msg):
+        msg = req.session.data[params['_cwmsgid']]
+        self.assertEqual(msg, msg)
+
     # workflow utilities #######################################################
 
     def assertPossibleTransitions(self, entity, expected):
@@ -724,8 +728,7 @@
         self.assertEqual(session.login, origsession.login)
         self.assertEqual(session.anonymous_session, False)
         self.assertEqual(path, 'view')
-        msg = req.session.data[params['_cwmsgid']]
-        self.assertEqual(msg, 'welcome %s !' % req.user.login)
+        self.assertMessageEqual(req, params, 'welcome %s !' % req.user.login)
 
     def assertAuthFailure(self, req, nbsessions=0):
         self.app.connect(req)