test/unittest_dbapi.py
changeset 6581 4a3b264589dc
parent 6427 c8a5ac2d1eaa
child 6613 e7ff604491b2
--- a/test/unittest_dbapi.py	Thu Oct 21 18:07:44 2010 +0200
+++ b/test/unittest_dbapi.py	Thu Oct 21 18:38:36 2010 +0200
@@ -18,9 +18,12 @@
 """unittest for cubicweb.dbapi"""
 
 from __future__ import with_statement
+
 from copy import copy
 
-from cubicweb import ConnectionError
+from logilab.common import tempattr
+
+from cubicweb import ConnectionError, cwconfig
 from cubicweb.dbapi import ProgrammingError
 from cubicweb.devtools.testlib import CubicWebTC
 
@@ -67,6 +70,13 @@
         self.assertRaises(ProgrammingError, cnx.set_shared_data, 'data', 0)
         self.assertRaises(ProgrammingError, cnx.get_shared_data, 'data')
 
+    def test_web_compatible_request(self):
+        config = cwconfig.CubicWebNoAppConfiguration()
+        with tempattr(self.cnx.vreg, 'config', config):
+            self.cnx.use_web_compatible_requests('http://perdu.com')
+            req = self.cnx.request()
+            self.assertEqual(req.base_url(), 'http://perdu.com')
+            req.ajax_replace_url('domid') # don't crash
 
 if __name__ == '__main__':
     from logilab.common.testlib import unittest_main