web/test/unittest_web.py
author Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
Wed, 27 May 2009 08:39:16 +0200
changeset 1956 9865daa96cd7
parent 1646 88182252fd11
child 1977 606923dff11b
permissions -rw-r--r--
[views][plot] piechart view now accepts either final or non final entities in the first column
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1646
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     1
from logilab.common.testlib import TestCase, unittest_main
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     2
from cubicweb.web import ajax_replace_url as  arurl
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     3
class AjaxReplaceUrlTC(TestCase):
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     4
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     5
    def test_ajax_replace_url(self):
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     6
        # NOTE: for the simplest use cases, we could use doctest
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     7
        self.assertEquals(arurl('foo', 'Person P'),
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     8
                          "javascript: replacePageChunk('foo', 'Person%20P');")
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     9
        self.assertEquals(arurl('foo', 'Person P', 'oneline'),
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    10
                          "javascript: replacePageChunk('foo', 'Person%20P', 'oneline');")
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    11
        self.assertEquals(arurl('foo', 'Person P', 'oneline', name='bar', age=12),
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    12
                          'javascript: replacePageChunk(\'foo\', \'Person%20P\', \'oneline\', {"age": 12, "name": "bar"});')
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    13
        self.assertEquals(arurl('foo', 'Person P', name='bar', age=12),
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    14
                          'javascript: replacePageChunk(\'foo\', \'Person%20P\', \'null\', {"age": 12, "name": "bar"});')
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    15
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    16
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    17
if __name__ == '__main__':
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    18
    unittest_main()