test/unittest_req.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 12 Mar 2010 14:51:59 +0100
branchstable
changeset 4891 90203ec7b3e3
child 5421 8167de96c523
permissions -rw-r--r--
[url] new rebuild_url method on base request
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4891
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     1
from logilab.common.testlib import TestCase, unittest_main
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     2
from cubicweb.req import RequestSessionBase
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     3
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     4
class RebuildURLTC(TestCase):
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     5
    def test(self):
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     6
        rebuild_url = RequestSessionBase(None).rebuild_url
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     7
        self.assertEquals(rebuild_url('http://logilab.fr?__message=pouet', __message='hop'),
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     8
                          'http://logilab.fr?__message=hop')
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     9
        self.assertEquals(rebuild_url('http://logilab.fr', __message='hop'),
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    10
                          'http://logilab.fr?__message=hop')
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    11
        self.assertEquals(rebuild_url('http://logilab.fr?vid=index', __message='hop'),
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    12
                          'http://logilab.fr?__message=hop&vid=index')
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    13
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    14
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    15
if __name__ == '__main__':
90203ec7b3e3 [url] new rebuild_url method on base request
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    16
    unittest_main()