""":organization: Logilab:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses"""fromlogilab.common.testlibimportunittest_mainfromcubicweb.devtools.apptestimportEnvBasedTCclassActionsTC(EnvBasedTC):deftest_view_action(self):req=self.request(__message='bla bla bla',vid='rss',rql='CWUser X')rset=self.execute('CWUser X')vaction=[actionforactioninself.vreg.possible_vobjects('actions',req,rset=rset)ifaction.id=='view'][0]self.assertEquals(vaction.url(),'http://testing.fr/cubicweb/view?rql=CWUser%20X')deftest_sendmail_action(self):req=self.request()rset=self.execute('Any X WHERE X login "admin"',req=req)self.failUnless([actionforactioninself.vreg.possible_vobjects('actions',req,rset=rset)ifaction.id=='sendemail'])self.login('anon')req=self.request()rset=self.execute('Any X WHERE X login "anon"',req=req)self.failIf([actionforactioninself.vreg.possible_vobjects('actions',req,rset=rset)ifaction.id=='sendemail'])if__name__=='__main__':unittest_main()