equal
deleted
inserted
replaced
|
1 from logilab.common.testlib import unittest_main |
|
2 |
|
3 from cubicweb.devtools.apptest import EnvBasedTC |
|
4 |
|
5 class ActionsTC(EnvBasedTC): |
|
6 def test_view_action(self): |
|
7 req = self.request(__message='bla bla bla', vid='rss', rql='EUser X') |
|
8 rset = self.execute('EUser X') |
|
9 vaction = [action for action in self.vreg.possible_vobjects('actions', req, rset) |
|
10 if action.id == 'view'][0] |
|
11 self.assertEquals(vaction.url(), 'http://testing.fr/cubicweb/view?rql=EUser%20X') |
|
12 |
|
13 def test_sendmail_action(self): |
|
14 req = self.request() |
|
15 rset = self.execute('Any X WHERE X login "admin"', req=req) |
|
16 self.failUnless([action for action in self.vreg.possible_vobjects('actions', req, rset) |
|
17 if action.id == 'sendemail']) |
|
18 self.login('anon') |
|
19 req = self.request() |
|
20 rset = self.execute('Any X WHERE X login "anon"', req=req) |
|
21 self.failIf([action for action in self.vreg.possible_vobjects('actions', req, rset) |
|
22 if action.id == 'sendemail']) |
|
23 |
|
24 if __name__ == '__main__': |
|
25 unittest_main() |