test/unittest_req.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 20 Apr 2010 18:34:37 +0200
changeset 5364 e0feefb87de5
parent 4891 90203ec7b3e3
child 5421 8167de96c523
permissions -rw-r--r--
[dbapi] some compat with distant < 3.8 repo
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()