web/test/unittest_web.py
changeset 5713 605f571198eb
parent 5424 8ecbcbff9777
child 6197 d8f0dce0b86d
equal deleted inserted replaced
5712:e136d392bd71 5713:605f571198eb
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    14 # details.
    14 # details.
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """
       
    19 
    18 
    20 """
       
    21 from logilab.common.testlib import TestCase, unittest_main
    19 from logilab.common.testlib import TestCase, unittest_main
    22 from cubicweb.devtools.fake import FakeRequest
    20 from cubicweb.devtools.fake import FakeRequest
       
    21 
    23 class AjaxReplaceUrlTC(TestCase):
    22 class AjaxReplaceUrlTC(TestCase):
    24 
    23 
    25     def test_ajax_replace_url(self):
    24     def test_ajax_replace_url(self):
    26         req = FakeRequest()
    25         req = FakeRequest()
    27         arurl = req.build_ajax_replace_url
    26         arurl = req.ajax_replace_url
    28         # NOTE: for the simplest use cases, we could use doctest
    27         # NOTE: for the simplest use cases, we could use doctest
    29         self.assertEquals(arurl('foo', 'Person P', 'list'),
    28         self.assertEquals(arurl('foo', rql='Person P', vid='list'),
    30                           "javascript: loadxhtml('foo', 'http://testing.fr/cubicweb/view?rql=Person%20P&amp;__notemplate=1&amp;vid=list', 'replace')")
    29                           """javascript: $('#foo').loadxhtml("http://testing.fr/cubicweb/json?rql=Person%20P&fname=view&vid=list", null, 'get', 'replace'); noop()""")
    31         self.assertEquals(arurl('foo', 'Person P', 'oneline', name='bar', age=12),
    30         self.assertEquals(arurl('foo', rql='Person P', vid='oneline', name='bar', age=12),
    32                           '''javascript: loadxhtml('foo', 'http://testing.fr/cubicweb/view?age=12&amp;rql=Person%20P&amp;__notemplate=1&amp;vid=oneline&amp;name=bar', 'replace')''')
    31                           """javascript: $('#foo').loadxhtml("http://testing.fr/cubicweb/json?name=bar&age=12&rql=Person%20P&fname=view&vid=oneline", null, 'get', 'replace'); noop()""")
    33 
    32 
    34 
    33 
    35 if __name__ == '__main__':
    34 if __name__ == '__main__':
    36     unittest_main()
    35     unittest_main()