author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Sun, 29 Nov 2009 23:17:31 +0100 | |
branch | stable |
changeset 3942 | 32da110d7168 |
parent 2650 | 18aec79ec3a3 |
child 2773 | b2530e3e0afb |
child 4212 | ab6573088b4a |
permissions | -rw-r--r-- |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
1 |
""" |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
2 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
3 |
:organization: Logilab |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
4 |
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
7 |
""" |
0 | 8 |
from logilab.common.testlib import unittest_main |
9 |
||
10 |
from cubicweb.devtools.apptest import EnvBasedTC |
|
11 |
||
12 |
class ActionsTC(EnvBasedTC): |
|
13 |
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
|
14 |
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
|
15 |
rset = self.execute('CWUser X') |
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2058
diff
changeset
|
16 |
vaction = [action for action in self.vreg['actions'].possible_vobjects(req, rset=rset) |
0 | 17 |
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
|
18 |
self.assertEquals(vaction.url(), 'http://testing.fr/cubicweb/view?rql=CWUser%20X') |
0 | 19 |
|
20 |
def test_sendmail_action(self): |
|
21 |
req = self.request() |
|
22 |
rset = self.execute('Any X WHERE X login "admin"', req=req) |
|
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2058
diff
changeset
|
23 |
self.failUnless([action for action in self.vreg['actions'].possible_vobjects(req, rset=rset) |
0 | 24 |
if action.id == 'sendemail']) |
25 |
self.login('anon') |
|
26 |
req = self.request() |
|
27 |
rset = self.execute('Any X WHERE X login "anon"', req=req) |
|
2650
18aec79ec3a3
R [vreg] important refactoring of the vregistry, moving behaviour to end dictionnary (and so leaving room for more flexibility ; keep bw compat ; update api usage in cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2058
diff
changeset
|
28 |
self.failIf([action for action in self.vreg['actions'].possible_vobjects(req, rset=rset) |
0 | 29 |
if action.id == 'sendemail']) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
30 |
|
0 | 31 |
if __name__ == '__main__': |
32 |
unittest_main() |