doc/book/en/devrepo/testing.rst
branchstable
changeset 6825 5ac338bc2133
parent 6731 3ea1f7a6311c
child 7078 bad26a22fe29
equal deleted inserted replaced
6823:dc4693820fc7 6825:5ac338bc2133
   194                                              content=u'cubicweb hop')
   194                                              content=u'cubicweb hop')
   195             blog_entry_1.set_relations(entry_of=cubicweb_blog)
   195             blog_entry_1.set_relations(entry_of=cubicweb_blog)
   196             blog_entry_2 = req.create_entity('BlogEntry', title=u'yes',
   196             blog_entry_2 = req.create_entity('BlogEntry', title=u'yes',
   197                                              content=u'cubicweb yes')
   197                                              content=u'cubicweb yes')
   198             blog_entry_2.set_relations(entry_of=cubicweb_blog)
   198             blog_entry_2.set_relations(entry_of=cubicweb_blog)
   199             self.assertEquals(len(MAILBOX), 0)
   199             self.assertEqual(len(MAILBOX), 0)
   200             self.commit()
   200             self.commit()
   201             self.assertEquals(len(MAILBOX), 2)
   201             self.assertEqual(len(MAILBOX), 2)
   202             mail = MAILBOX[0]
   202             mail = MAILBOX[0]
   203             self.assertEquals(mail.subject, '[data] hop')
   203             self.assertEqual(mail.subject, '[data] hop')
   204             mail = MAILBOX[1]
   204             mail = MAILBOX[1]
   205             self.assertEquals(mail.subject, '[data] yes')
   205             self.assertEqual(mail.subject, '[data] yes')
   206 
   206 
   207 Visible actions tests
   207 Visible actions tests
   208 `````````````````````
   208 `````````````````````
   209 
   209 
   210 It is easy to write unit tests to test actions which are visible to
   210 It is easy to write unit tests to test actions which are visible to
   227                                            reverse_is_reviewer_at=reviewer)
   227                                            reverse_is_reviewer_at=reviewer)
   228 
   228 
   229         def test_admin(self):
   229         def test_admin(self):
   230             req = self.request()
   230             req = self.request()
   231             rset = req.execute('Any C WHERE C is Conference')
   231             rset = req.execute('Any C WHERE C is Conference')
   232             self.assertListEquals(self.pactions(req, rset),
   232             self.assertListEqual(self.pactions(req, rset),
   233                                   [('workflow', workflow.WorkflowActions),
   233                                   [('workflow', workflow.WorkflowActions),
   234                                    ('edit', confactions.ModifyAction),
   234                                    ('edit', confactions.ModifyAction),
   235                                    ('managepermission', actions.ManagePermissionsAction),
   235                                    ('managepermission', actions.ManagePermissionsAction),
   236                                    ('addrelated', actions.AddRelatedActions),
   236                                    ('addrelated', actions.AddRelatedActions),
   237                                    ('delete', actions.DeleteAction),
   237                                    ('delete', actions.DeleteAction),
   238                                    ('generate_badge_action', badges.GenerateBadgeAction),
   238                                    ('generate_badge_action', badges.GenerateBadgeAction),
   239                                    ('addtalkinconf', confactions.AddTalkInConferenceAction)
   239                                    ('addtalkinconf', confactions.AddTalkInConferenceAction)
   240                                    ])
   240                                    ])
   241             self.assertListEquals(self.action_submenu(req, rset, 'addrelated'),
   241             self.assertListEqual(self.action_submenu(req, rset, 'addrelated'),
   242                                   [(u'add Track in_conf Conference object',
   242                                   [(u'add Track in_conf Conference object',
   243                                     u'http://testing.fr/cubicweb/add/Track'
   243                                     u'http://testing.fr/cubicweb/add/Track'
   244                                     u'?__linkto=in_conf%%3A%(conf)s%%3Asubject&'
   244                                     u'?__linkto=in_conf%%3A%(conf)s%%3Asubject&'
   245                                     u'__redirectpath=conference%%2Fconf&'
   245                                     u'__redirectpath=conference%%2Fconf&'
   246                                     u'__redirectvid=' % {'conf': self.conf.eid}),
   246                                     u'__redirectvid=' % {'conf': self.conf.eid}),