author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 05 Jun 2009 15:06:55 +0200 | |
changeset 2057 | 0a0cbccafcb5 |
parent 1977 | 606923dff11b |
child 2643 | 9976f511003b |
permissions | -rw-r--r-- |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1646
diff
changeset
|
1 |
""" |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1646
diff
changeset
|
2 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1646
diff
changeset
|
3 |
:organization: Logilab |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1646
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:
1646
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:
1646
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:
1646
diff
changeset
|
7 |
""" |
1646 | 8 |
from logilab.common.testlib import TestCase, unittest_main |
9 |
from cubicweb.web import ajax_replace_url as arurl |
|
10 |
class AjaxReplaceUrlTC(TestCase): |
|
11 |
||
12 |
def test_ajax_replace_url(self): |
|
13 |
# NOTE: for the simplest use cases, we could use doctest |
|
14 |
self.assertEquals(arurl('foo', 'Person P'), |
|
15 |
"javascript: replacePageChunk('foo', 'Person%20P');") |
|
16 |
self.assertEquals(arurl('foo', 'Person P', 'oneline'), |
|
17 |
"javascript: replacePageChunk('foo', 'Person%20P', 'oneline');") |
|
18 |
self.assertEquals(arurl('foo', 'Person P', 'oneline', name='bar', age=12), |
|
19 |
'javascript: replacePageChunk(\'foo\', \'Person%20P\', \'oneline\', {"age": 12, "name": "bar"});') |
|
20 |
self.assertEquals(arurl('foo', 'Person P', name='bar', age=12), |
|
21 |
'javascript: replacePageChunk(\'foo\', \'Person%20P\', \'null\', {"age": 12, "name": "bar"});') |
|
22 |
||
23 |
||
24 |
if __name__ == '__main__': |
|
25 |
unittest_main() |