author | Aurelien Campeas <aurelien.campeas@logilab.fr> |
Mon, 11 May 2009 19:46:01 +0200 | |
branch | tls-sprint |
changeset 1736 | 40190717e2de |
parent 1643 | 59c5cec05bbd |
child 1977 | 606923dff11b |
permissions | -rw-r--r-- |
0 | 1 |
from logilab.common.testlib import unittest_main |
2 |
from cubicweb.devtools.apptest import EnvBasedTC |
|
3 |
||
1643 | 4 |
from cubicweb.ext.rest import rest_publish |
5 |
||
0 | 6 |
class RestTC(EnvBasedTC): |
7 |
def context(self): |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
8 |
return self.execute('CWUser X WHERE X login "admin"').get_entity(0, 0) |
1643 | 9 |
|
0 | 10 |
def test_eid_role(self): |
11 |
context = self.context() |
|
12 |
self.assertEquals(rest_publish(context, ':eid:`%s`' % context.eid), |
|
1643 | 13 |
'<p><a class="reference" href="http://testing.fr/cubicweb/cwuser/admin">#%s</a></p>\n' % context.eid) |
0 | 14 |
self.assertEquals(rest_publish(context, ':eid:`%s:some text`' % context.eid), |
1643 | 15 |
'<p><a class="reference" href="http://testing.fr/cubicweb/cwuser/admin">some text</a></p>\n') |
0 | 16 |
|
17 |
def test_bad_rest_no_crash(self): |
|
18 |
data = rest_publish(self.context(), ''' |
|
19 |
| card | implication | |
|
20 |
-------------------------- |
|
21 |
| 1-1 | N1 = N2 | |
|
22 |
| 1-? | N1 <= N2 | |
|
23 |
| 1-+ | N1 >= N2 | |
|
1643 | 24 |
| 1-* | N1>0 => N2>0 | |
0 | 25 |
-------------------------- |
26 |
| ?-? | N1 # N2 | |
|
27 |
| ?-+ | N1 >= N2 | |
|
28 |
| ?-* | N1 # N2 | |
|
29 |
-------------------------- |
|
30 |
| +-+ | N1>0 => N2>0 et | |
|
31 |
| | N2>0 => N1>0 | |
|
32 |
| +-* | N1>+ => N2>0 | |
|
33 |
-------------------------- |
|
34 |
| *-* | N1#N2 | |
|
35 |
-------------------------- |
|
36 |
||
37 |
''') |
|
1643 | 38 |
|
0 | 39 |
if __name__ == '__main__': |
40 |
unittest_main() |