web/test/unittest_web.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 19 Feb 2010 09:34:14 +0100
branchstable
changeset 4643 921737d2e3a8
parent 4212 ab6573088b4a
child 5421 8167de96c523
permissions -rw-r--r--
fix optimisation with super session that may lead to integrity loss at some point I've decided to stop ensuring ?1 cardinality was respected when adding a new relation using a super session, to avoid the cost of the delete query. That was yet discussable because it introduced unexpected difference between execute and unsafe_execute, which is imo not worth it. Also, now that rql() in migration script default to unsafe_execute, we definitly don't want that implicit behaviour change (which already cause bug when for instance adding another default workflow for an entity type: without that fix we end up with *two* default workflows while the schema tells we can have only one. IMO we should go to the direction that super session skip all security check, but nothing else, unless explicitly asked.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1646
diff changeset
     1
"""
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1646
diff changeset
     2
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1646
diff changeset
     3
:organization: Logilab
4212
ab6573088b4a update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2643
diff changeset
     4
:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1646
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1646
diff changeset
     6
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1646
diff changeset
     7
"""
1646
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
     8
from logilab.common.testlib import TestCase, unittest_main
2643
9976f511003b web test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
     9
from cubicweb.devtools.fake import FakeRequest
1646
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    10
class AjaxReplaceUrlTC(TestCase):
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    11
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    12
    def test_ajax_replace_url(self):
2643
9976f511003b web test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    13
        req = FakeRequest()
9976f511003b web test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    14
        arurl = req.build_ajax_replace_url
1646
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    15
        # NOTE: for the simplest use cases, we could use doctest
2643
9976f511003b web test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    16
        self.assertEquals(arurl('foo', 'Person P', 'list'),
9976f511003b web test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    17
                          "javascript: loadxhtml('foo', 'http://testing.fr/cubicweb/view?rql=Person%20P&amp;__notemplate=1&amp;vid=list', 'replace')")
1646
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    18
        self.assertEquals(arurl('foo', 'Person P', 'oneline', name='bar', age=12),
2643
9976f511003b web test update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    19
                          '''javascript: loadxhtml('foo', 'http://testing.fr/cubicweb/view?age=12&amp;rql=Person%20P&amp;__notemplate=1&amp;vid=oneline&amp;name=bar', 'replace')''')
1646
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    20
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    21
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    22
if __name__ == '__main__':
88182252fd11 fix tests, cleanup
sylvain.thenault@logilab.fr
parents:
diff changeset
    23
    unittest_main()