test/unittest_req.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 24 Mar 2010 15:22:01 +0100
branchstable
changeset 4999 221f76e14eea
parent 4891 90203ec7b3e3
child 5421 8167de96c523
permissions -rw-r--r--
don't update dontcheck until everything went fine: see usage in after_update_entity, where if we got an Unauthorized at hook time, we will retry and commit time.

from logilab.common.testlib import TestCase, unittest_main
from cubicweb.req import RequestSessionBase

class RebuildURLTC(TestCase):
    def test(self):
        rebuild_url = RequestSessionBase(None).rebuild_url
        self.assertEquals(rebuild_url('http://logilab.fr?__message=pouet', __message='hop'),
                          'http://logilab.fr?__message=hop')
        self.assertEquals(rebuild_url('http://logilab.fr', __message='hop'),
                          'http://logilab.fr?__message=hop')
        self.assertEquals(rebuild_url('http://logilab.fr?vid=index', __message='hop'),
                          'http://logilab.fr?__message=hop&vid=index')


if __name__ == '__main__':
    unittest_main()