author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 07 Aug 2009 13:59:18 +0200 | |
changeset 2731 | 815b93271338 |
parent 1977 | 606923dff11b |
child 2773 | b2530e3e0afb |
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 |
""" |
970
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
8 |
from logilab.common.testlib import unittest_main |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
9 |
from cubicweb.devtools.apptest import EnvBasedTC |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
10 |
|
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
11 |
class WorkfloableMixInTC(EnvBasedTC): |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
12 |
def test_wf_state(self): |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
13 |
s = self.add_entity('State', name=u'activated') |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
14 |
self.execute('SET X state_of ET WHERE ET name "Bookmark", X eid %(x)s', |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
15 |
{'x': s.eid}) |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
16 |
es = self.user().wf_state('activated') |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
970
diff
changeset
|
17 |
self.assertEquals(es.state_of[0].name, 'CWUser') |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
18 |
|
970
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
19 |
def test_wf_transition(self): |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
20 |
t = self.add_entity('Transition', name=u'deactivate') |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
21 |
self.execute('SET X transition_of ET WHERE ET name "Bookmark", X eid %(x)s', |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
22 |
{'x': t.eid}) |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
23 |
et = self.user().wf_transition('deactivate') |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
970
diff
changeset
|
24 |
self.assertEquals(et.transition_of[0].name, 'CWUser') |
970
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
25 |
|
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
26 |
def test_change_state(self): |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
27 |
user = self.user() |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
28 |
user.change_state(user.wf_state('deactivated').eid) |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
29 |
self.assertEquals(user.state, 'deactivated') |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
30 |
|
970
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
31 |
if __name__ == '__main__': |
b52b1679f4e4
add test for some WorkfloableMixIn methods
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
32 |
unittest_main() |