author | sylvain.thenault@logilab.fr |
Tue, 28 Apr 2009 11:22:31 +0200 | |
branch | tls-sprint |
changeset 1498 | 2c6eec0b46b9 |
parent 1398 | 5fe84a5f7035 |
child 1802 | d628defebc17 |
permissions | -rw-r--r-- |
0 | 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): |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
7 |
req = self.request(__message='bla bla bla', vid='rss', rql='CWUser X') |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
8 |
rset = self.execute('CWUser X') |
0 | 9 |
vaction = [action for action in self.vreg.possible_vobjects('actions', req, rset) |
10 |
if action.id == 'view'][0] |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
11 |
self.assertEquals(vaction.url(), 'http://testing.fr/cubicweb/view?rql=CWUser%20X') |
0 | 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() |