web/test/test_jscript.py
author Julien Cristau <julien.cristau@logilab.fr>
Mon, 29 Jun 2015 16:58:43 +0200
changeset 10463 9add9b7f9df7
parent 8879 982a49239420
child 10583 97c88aa7c779
permissions -rw-r--r--
[server/test] fix random error in unittest_security When entering a new Connection, we cache the user and its 'login' attribute (with no permissions checking). This test makes 'CWUser.login' unreadable by guests, and then proceeds to make sure the 'anon' user can actually not read any 'login' attribute. However, due to the above cnx initialization, anon's login is actually cached, hence readable. This happens to make the test fail sometimes depending on the order in which CWUser entities are returned, because one of them has .complete() called, which as a side effect sets the attribute cache to None for unreadable attributes. Call .complete() on both entities to reset the login cache. While this is still highly debatable, at least it's consistent.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5743
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     1
from cubicweb.devtools.qunit import QUnitTestCase, unittest_main
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     2
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     3
from os import path as osp
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     4
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     5
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     6
class JScript(QUnitTestCase):
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     7
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     8
    all_js_tests = (
5766
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
     9
        ("jstests/test_utils.js", (
7363
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    10
            "../../web/data/cubicweb.js",
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    11
            "../../web/data/cubicweb.compat.js",
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    12
            "../../web/data/cubicweb.python.js",
5766
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    13
            "jstests/utils.js",
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    14
            ),
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    15
         ),
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    16
5743
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    17
        ("jstests/test_htmlhelpers.js", (
7363
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    18
            "../../web/data/cubicweb.js",
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    19
            "../../web/data/cubicweb.compat.js",
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    20
            "../../web/data/cubicweb.python.js",
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    21
            "../../web/data/cubicweb.htmlhelpers.js",
5766
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    22
            ),
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    23
         ),
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    24
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    25
        ("jstests/test_ajax.js", (
7363
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    26
            "../../web/data/cubicweb.python.js",
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    27
            "../../web/data/cubicweb.js",
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    28
            "../../web/data/cubicweb.compat.js",
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    29
            "../../web/data/cubicweb.htmlhelpers.js",
2293c49b290a don't let windmill/qunit test break apycot warning for all web/test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5766
diff changeset
    30
            "../../web/data/cubicweb.ajax.js",
5766
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    31
            ), (
5743
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    32
            "jstests/ajax_url0.html",
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    33
            "jstests/ajax_url1.html",
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    34
            "jstests/ajax_url2.html",
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    35
            "jstests/ajaxresult.json",
5766
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    36
            ),
c397819f2482 [js tests] fix javascripts tests definition, test_datetime.js now included in test_utils.js, which test other stuff as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5743
diff changeset
    37
         ),
5743
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    38
    )
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    39
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    40
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    41
if __name__ == '__main__':
4a0600664f85 Use the qunit automatic launcher for existing testcase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    42
    unittest_main()