web/test/unittest_web.py
changeset 2643 9976f511003b
parent 1977 606923dff11b
child 4212 ab6573088b4a
--- a/web/test/unittest_web.py	Sun Aug 02 11:54:02 2009 +0200
+++ b/web/test/unittest_web.py	Sun Aug 02 11:54:48 2009 +0200
@@ -6,19 +6,17 @@
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
 from logilab.common.testlib import TestCase, unittest_main
-from cubicweb.web import ajax_replace_url as  arurl
+from cubicweb.devtools.fake import FakeRequest
 class AjaxReplaceUrlTC(TestCase):
 
     def test_ajax_replace_url(self):
+        req = FakeRequest()
+        arurl = req.build_ajax_replace_url
         # NOTE: for the simplest use cases, we could use doctest
-        self.assertEquals(arurl('foo', 'Person P'),
-                          "javascript: replacePageChunk('foo', 'Person%20P');")
-        self.assertEquals(arurl('foo', 'Person P', 'oneline'),
-                          "javascript: replacePageChunk('foo', 'Person%20P', 'oneline');")
+        self.assertEquals(arurl('foo', 'Person P', 'list'),
+                          "javascript: loadxhtml('foo', 'http://testing.fr/cubicweb/view?rql=Person%20P&__notemplate=1&vid=list', 'replace')")
         self.assertEquals(arurl('foo', 'Person P', 'oneline', name='bar', age=12),
-                          'javascript: replacePageChunk(\'foo\', \'Person%20P\', \'oneline\', {"age": 12, "name": "bar"});')
-        self.assertEquals(arurl('foo', 'Person P', name='bar', age=12),
-                          'javascript: replacePageChunk(\'foo\', \'Person%20P\', \'null\', {"age": 12, "name": "bar"});')
+                          '''javascript: loadxhtml('foo', 'http://testing.fr/cubicweb/view?age=12&rql=Person%20P&__notemplate=1&vid=oneline&name=bar', 'replace')''')
 
 
 if __name__ == '__main__':