devtools/testlib.py
changeset 7441 b70f4f4c8620
parent 7439 8e1c58a212ad
child 7763 31210a2ead63
equal deleted inserted replaced
7440:539de926ec9d 7441:b70f4f4c8620
   498     def assertItemsEqual(self, it1, it2, *args, **kwargs):
   498     def assertItemsEqual(self, it1, it2, *args, **kwargs):
   499         it1 = set(getattr(x, 'eid', x) for x in it1)
   499         it1 = set(getattr(x, 'eid', x) for x in it1)
   500         it2 = set(getattr(x, 'eid', x) for x in it2)
   500         it2 = set(getattr(x, 'eid', x) for x in it2)
   501         super(CubicWebTC, self).assertItemsEqual(it1, it2, *args, **kwargs)
   501         super(CubicWebTC, self).assertItemsEqual(it1, it2, *args, **kwargs)
   502 
   502 
       
   503     def assertMessageEqual(self, req, params, msg):
       
   504         msg = req.session.data[params['_cwmsgid']]
       
   505         self.assertEqual(msg, msg)
       
   506 
   503     # workflow utilities #######################################################
   507     # workflow utilities #######################################################
   504 
   508 
   505     def assertPossibleTransitions(self, entity, expected):
   509     def assertPossibleTransitions(self, entity, expected):
   506         transitions = entity.cw_adapt_to('IWorkflowable').possible_transitions()
   510         transitions = entity.cw_adapt_to('IWorkflowable').possible_transitions()
   507         self.assertListEqual(sorted(tr.name for tr in transitions),
   511         self.assertListEqual(sorted(tr.name for tr in transitions),
   722         session = req.session
   726         session = req.session
   723         self.assertEqual(len(self.open_sessions), nbsessions, self.open_sessions)
   727         self.assertEqual(len(self.open_sessions), nbsessions, self.open_sessions)
   724         self.assertEqual(session.login, origsession.login)
   728         self.assertEqual(session.login, origsession.login)
   725         self.assertEqual(session.anonymous_session, False)
   729         self.assertEqual(session.anonymous_session, False)
   726         self.assertEqual(path, 'view')
   730         self.assertEqual(path, 'view')
   727         msg = req.session.data[params['_cwmsgid']]
   731         self.assertMessageEqual(req, params, 'welcome %s !' % req.user.login)
   728         self.assertEqual(msg, 'welcome %s !' % req.user.login)
       
   729 
   732 
   730     def assertAuthFailure(self, req, nbsessions=0):
   733     def assertAuthFailure(self, req, nbsessions=0):
   731         self.app.connect(req)
   734         self.app.connect(req)
   732         self.assertIsInstance(req.session, dbapi.DBAPISession)
   735         self.assertIsInstance(req.session, dbapi.DBAPISession)
   733         self.assertEqual(req.session.cnx, None)
   736         self.assertEqual(req.session.cnx, None)