author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 09 Jul 2009 14:58:55 +0200 | |
branch | stable |
changeset 2352 | 734eb79680e9 |
parent 1977 | 606923dff11b |
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:
1643
diff
changeset
|
1 |
""" |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1643
diff
changeset
|
2 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1643
diff
changeset
|
3 |
:organization: Logilab |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1643
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:
1643
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:
1643
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:
1643
diff
changeset
|
7 |
""" |
0 | 8 |
from logilab.common.testlib import unittest_main |
9 |
from cubicweb.devtools.apptest import EnvBasedTC |
|
10 |
||
1643 | 11 |
from cubicweb.ext.rest import rest_publish |
12 |
||
0 | 13 |
class RestTC(EnvBasedTC): |
14 |
def context(self): |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
15 |
return self.execute('CWUser X WHERE X login "admin"').get_entity(0, 0) |
1643 | 16 |
|
0 | 17 |
def test_eid_role(self): |
18 |
context = self.context() |
|
19 |
self.assertEquals(rest_publish(context, ':eid:`%s`' % context.eid), |
|
1643 | 20 |
'<p><a class="reference" href="http://testing.fr/cubicweb/cwuser/admin">#%s</a></p>\n' % context.eid) |
0 | 21 |
self.assertEquals(rest_publish(context, ':eid:`%s:some text`' % context.eid), |
1643 | 22 |
'<p><a class="reference" href="http://testing.fr/cubicweb/cwuser/admin">some text</a></p>\n') |
0 | 23 |
|
24 |
def test_bad_rest_no_crash(self): |
|
25 |
data = rest_publish(self.context(), ''' |
|
26 |
| card | implication | |
|
27 |
-------------------------- |
|
28 |
| 1-1 | N1 = N2 | |
|
29 |
| 1-? | N1 <= N2 | |
|
30 |
| 1-+ | N1 >= N2 | |
|
1643 | 31 |
| 1-* | N1>0 => N2>0 | |
0 | 32 |
-------------------------- |
33 |
| ?-? | N1 # N2 | |
|
34 |
| ?-+ | N1 >= N2 | |
|
35 |
| ?-* | N1 # N2 | |
|
36 |
-------------------------- |
|
37 |
| +-+ | N1>0 => N2>0 et | |
|
38 |
| | N2>0 => N1>0 | |
|
39 |
| +-* | N1>+ => N2>0 | |
|
40 |
-------------------------- |
|
41 |
| *-* | N1#N2 | |
|
42 |
-------------------------- |
|
43 |
||
44 |
''') |
|
1643 | 45 |
|
0 | 46 |
if __name__ == '__main__': |
47 |
unittest_main() |