backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 11 May 2011 13:41:21 +0200
changeset 7368 f1d9e3b9e51e
parent 7364 aff846ce1050 (current diff)
parent 7367 96cdd8418a10 (diff)
child 7377 d8083b2ae4d6
backport stable
i18n/de.po
i18n/en.po
i18n/es.po
i18n/fr.po
test/unittest_selectors.py
web/test/jstests/ajax_url0.html
web/test/jstests/ajax_url1.html
web/test/jstests/ajax_url2.html
web/test/jstests/ajaxresult.json
web/test/jstests/test_ajax.html
web/test/jstests/test_ajax.js
web/test/jstests/test_htmlhelpers.html
web/test/jstests/test_htmlhelpers.js
web/test/jstests/test_utils.html
web/test/jstests/test_utils.js
web/test/jstests/utils.js
web/test/test_jscript.py
web/test/test_windmill.py
web/test/windmill/test_connexion.py
web/test/windmill/test_creation.py
web/test/windmill/test_edit_relation.py
--- a/.hgtags	Wed May 11 12:11:51 2011 +0200
+++ b/.hgtags	Wed May 11 13:41:21 2011 +0200
@@ -198,3 +198,5 @@
 b3c6702761a18a41fdbb7bc1083f92aefce07765 cubicweb-debian-version-3.11.3-1
 e712bc6f1f71684f032bfcb9bb151a066c707dec cubicweb-version-3.12.3
 ba8fe4f2e408c3fdf6c297cd42c2577dcac50e71 cubicweb-debian-version-3.12.3-1
+5cd0dbc26882f60e3f11ec55e7f058d94505e7ed cubicweb-version-3.12.4
+7c4d34a5ec57f927a70cbc7af7fa8310c847ac42 cubicweb-debian-version-3.12.4-1
--- a/__pkginfo__.py	Wed May 11 12:11:51 2011 +0200
+++ b/__pkginfo__.py	Wed May 11 13:41:21 2011 +0200
@@ -22,7 +22,7 @@
 
 modname = distname = "cubicweb"
 
-numversion = (3, 12, 3)
+numversion = (3, 12, 4)
 version = '.'.join(str(num) for num in numversion)
 
 description = "a repository of entities / relations for knowledge management"
--- a/debian/changelog	Wed May 11 12:11:51 2011 +0200
+++ b/debian/changelog	Wed May 11 13:41:21 2011 +0200
@@ -1,3 +1,9 @@
+cubicweb (3.12.4-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Sylvain Thénault <sylvain.thenault@logilab.fr>  Wed, 11 May 2011 12:28:42 +0200
+
 cubicweb (3.12.3-1) unstable; urgency=low
 
   * new upstream release
--- a/devtools/qunit.py	Wed May 11 12:11:51 2011 +0200
+++ b/devtools/qunit.py	Wed May 11 13:41:21 2011 +0200
@@ -5,7 +5,7 @@
 from Queue import Queue, Empty
 from subprocess import Popen, check_call, CalledProcessError
 from shutil import rmtree, copy as copyfile
-from uuid import uuid4 
+from uuid import uuid4
 
 # imported by default to simplify further import statements
 from logilab.common.testlib import unittest_main, with_tempdir, InnerTest, Tags
--- a/i18n/de.po	Wed May 11 12:11:51 2011 +0200
+++ b/i18n/de.po	Wed May 11 13:41:21 2011 +0200
@@ -1061,10 +1061,6 @@
 msgid "add WorkflowTransition transition_of Workflow object"
 msgstr "Workflow-Übergang"
 
-#, python-format
-msgid "add a %s"
-msgstr ""
-
 msgctxt "inlined:CWRelation.from_entity.subject"
 msgid "add a CWEType"
 msgstr "einen Entitätstyp hinzufügen"
--- a/i18n/en.po	Wed May 11 12:11:51 2011 +0200
+++ b/i18n/en.po	Wed May 11 13:41:21 2011 +0200
@@ -1021,10 +1021,6 @@
 msgid "add WorkflowTransition transition_of Workflow object"
 msgstr "workflow-transition"
 
-#, python-format
-msgid "add a %s"
-msgstr ""
-
 msgctxt "inlined:CWRelation.from_entity.subject"
 msgid "add a CWEType"
 msgstr "add an entity type"
--- a/i18n/es.po	Wed May 11 12:11:51 2011 +0200
+++ b/i18n/es.po	Wed May 11 13:41:21 2011 +0200
@@ -1071,10 +1071,6 @@
 msgid "add WorkflowTransition transition_of Workflow object"
 msgstr "Transición Workflow"
 
-#, python-format
-msgid "add a %s"
-msgstr "agregar un %s"
-
 msgctxt "inlined:CWRelation.from_entity.subject"
 msgid "add a CWEType"
 msgstr "Agregar un tipo de entidad"
@@ -4549,3 +4545,6 @@
 msgstr ""
 "usted debe  quitar la puesta en línea de la relación %s que es aceptada y "
 "puede ser cruzada"
+
+#~ msgid "add a %s"
+#~ msgstr "agregar un %s"
--- a/i18n/fr.po	Wed May 11 12:11:51 2011 +0200
+++ b/i18n/fr.po	Wed May 11 13:41:21 2011 +0200
@@ -1069,10 +1069,6 @@
 msgid "add WorkflowTransition transition_of Workflow object"
 msgstr "transition workflow"
 
-#, python-format
-msgid "add a %s"
-msgstr "ajouter un %s"
-
 msgctxt "inlined:CWRelation.from_entity.subject"
 msgid "add a CWEType"
 msgstr "ajouter un type d'entité sujet"
@@ -4565,6 +4561,9 @@
 #~ msgid "Relation types"
 #~ msgstr "Types de relation"
 
+#~ msgid "add a %s"
+#~ msgstr "ajouter un %s"
+
 #~ msgid "am/pm calendar (month)"
 #~ msgstr "calendrier am/pm (mois)"
 
--- a/selectors.py	Wed May 11 12:11:51 2011 +0200
+++ b/selectors.py	Wed May 11 13:41:21 2011 +0200
@@ -1160,9 +1160,12 @@
     See :class:`~cubicweb.selectors.EntitySelector` documentation for entity
     lookup / score rules according to the input context.
     """
-    def __init__(self, expression, once_is_enough=False):
+    def __init__(self, expression, once_is_enough=False, user_condition=False):
         super(rql_condition, self).__init__(once_is_enough)
-        if 'U' in frozenset(split_expression(expression)):
+        self.user_condition = user_condition
+        if user_condition:
+            rql = 'Any COUNT(U) WHERE U eid %%(u)s, %s' % expression
+        elif 'U' in frozenset(split_expression(expression)):
             rql = 'Any COUNT(X) WHERE X eid %%(x)s, U eid %%(u)s, %s' % expression
         else:
             rql = 'Any COUNT(X) WHERE X eid %%(x)s, %s' % expression
@@ -1171,6 +1174,16 @@
     def __str__(self):
         return '%s(%r)' % (self.__class__.__name__, self.rql)
 
+    @lltrace
+    def __call__(self, cls, req, **kwargs):
+        if self.user_condition:
+            try:
+                return req.execute(self.rql, {'u': req.user.eid})[0][0]
+            except Unauthorized:
+                return 0
+        else:
+            return super(rql_condition, self).__call__(cls, req, **kwargs)
+
     def _score(self, req, eid):
         try:
             return req.execute(self.rql, {'x': eid, 'u': req.user.eid})[0][0]
--- a/test/unittest_selectors.py	Wed May 11 12:11:51 2011 +0200
+++ b/test/unittest_selectors.py	Wed May 11 13:41:21 2011 +0200
@@ -427,6 +427,13 @@
         self.assertEqual(selector(None, req, entity=req.user), 1)
         self.assertEqual(selector(None, req), 0)
 
+    def test_rql_condition_user(self):
+        req = self.request()
+        selector = rql_condition('U login "admin"', user_condition=True)
+        self.assertEqual(selector(None, req), 1)
+        selector = rql_condition('U login "toto"', user_condition=True)
+        self.assertEqual(selector(None, req), 0)
+
 if __name__ == '__main__':
     unittest_main()
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/ajax_url0.html	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,3 @@
+<div id="ajaxroot">
+  <h1>Hello</h1>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/ajax_url1.html	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,6 @@
+<div id="ajaxroot">
+  <div class="ajaxHtmlHead">
+    <script src="http://foo.js" type="text/javascript"> </script>
+  </div>
+  <h1>Hello</h1>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/ajax_url2.html	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,7 @@
+<div id="ajaxroot">
+  <div class="ajaxHtmlHead">
+    <script src="http://foo.js" type="text/javascript"> </script>
+    <link rel="stylesheet" type="text/css" media="all" href="qunit.css" />
+  </div>
+  <h1>Hello</h1>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/ajaxresult.json	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,1 @@
+['foo', 'bar']
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/test_ajax.html	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,24 @@
+<html>
+  <head>
+    <!-- dependencies -->
+    <script type="text/javascript" src="../../data/jquery.js"></script>
+    <script src="../../data/cubicweb.python.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.compat.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.dom.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.htmlhelpers.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.ajax.js" type="text/javascript"></script>
+    <!-- qunit files -->
+    <script type="text/javascript" src="../../../devtools/data/qunit.js"></script>
+    <link rel="stylesheet" type="text/css" media="all" href="../../../devtools/data/qunit.css" />
+    <!-- test suite -->
+    <script src="cwmock.js" type="text/javascript"></script>
+    <script src="test_ajax.js" type="text/javascript"></script>
+  </head>
+  <body>
+    <div id="main"> </div>
+    <h1 id="qunit-header">cubicweb.ajax.js functions tests</h1>
+    <h2 id="qunit-banner"></h2>
+    <ol id="qunit-tests">
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/test_ajax.js	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,244 @@
+$(document).ready(function() {
+
+    module("ajax", {
+        setup: function() {
+          this.scriptsLength = $('head script[src]').length-1;
+          this.cssLength = $('head link[rel=stylesheet]').length-1;
+          // re-initialize cw loaded cache so that each tests run in a
+          // clean environment, have a lookt at _loadAjaxHtmlHead implementation
+          // in cubicweb.ajax.js for more information.
+          cw.loaded_src = [];
+          cw.loaded_href = [];
+        },
+        teardown: function() {
+          $('head script[src]:gt(' + this.scriptsLength + ')').remove();
+          $('head link[rel=stylesheet]:gt(' + this.cssLength + ')').remove();
+        }
+      });
+
+    function jsSources() {
+        return $.map($('head script[src]'), function(script) {
+            return script.getAttribute('src');
+        });
+    }
+
+    test('test simple h1 inclusion (ajax_url0.html)', function() {
+        expect(3);
+        equals(jQuery('#main').children().length, 0);
+        stop();
+        jQuery('#main').loadxhtml('/../ajax_url0.html', {
+            callback: function() {
+                equals(jQuery('#main').children().length, 1);
+                equals(jQuery('#main h1').html(), 'Hello');
+                start();
+            }
+        });
+    });
+
+    test('test simple html head inclusion (ajax_url1.html)', function() {
+        expect(6);
+        var scriptsIncluded = jsSources();
+        equals(jQuery.inArray('http://foo.js', scriptsIncluded), - 1);
+        stop();
+        jQuery('#main').loadxhtml('/../ajax_url1.html', {
+            callback: function() {
+                var origLength = scriptsIncluded.length;
+                scriptsIncluded = jsSources();
+                // check that foo.js has been *appended* to <head>
+                equals(scriptsIncluded.length, origLength + 1);
+                equals(scriptsIncluded[origLength].indexOf('http://foo.js'), 0);
+                // check that <div class="ajaxHtmlHead"> has been removed
+                equals(jQuery('#main').children().length, 1);
+                equals(jQuery('div.ajaxHtmlHead').length, 0);
+                equals(jQuery('#main h1').html(), 'Hello');
+                start();
+            }
+        });
+    });
+
+    test('test addCallback', function() {
+        expect(3);
+        equals(jQuery('#main').children().length, 0);
+        stop();
+        var d = jQuery('#main').loadxhtml('/../ajax_url0.html');
+        d.addCallback(function() {
+            equals(jQuery('#main').children().length, 1);
+            equals(jQuery('#main h1').html(), 'Hello');
+            start();
+        });
+    });
+
+    test('test callback after synchronous request', function() {
+        expect(1);
+        var deferred = new Deferred();
+        var result = jQuery.ajax({
+            url: './ajax_url0.html',
+            async: false,
+            beforeSend: function(xhr) {
+                deferred._req = xhr;
+            },
+            success: function(data, status) {
+                deferred.success(data);
+            }
+        });
+        stop();
+        deferred.addCallback(function() {
+            // add an assertion to ensure the callback is executed
+            ok(true, "callback is executed");
+            start();
+        });
+    });
+
+    test('test addCallback with parameters', function() {
+        expect(3);
+        equals(jQuery('#main').children().length, 0);
+        stop();
+        var d = jQuery('#main').loadxhtml('/../ajax_url0.html');
+        d.addCallback(function(data, req, arg1, arg2) {
+            equals(arg1, 'Hello');
+            equals(arg2, 'world');
+            start();
+        },
+        'Hello', 'world');
+    });
+
+    test('test callback after synchronous request with parameters', function() {
+        var deferred = new Deferred();
+        var result = jQuery.ajax({
+            url: '/../ajax_url0.html',
+            async: false,
+            beforeSend: function(xhr) {
+                deferred._req = xhr;
+            },
+            success: function(data, status) {
+                deferred.success(data);
+            }
+        });
+        deferred.addCallback(function(data, req, arg1, arg2) {
+            // add an assertion to ensure the callback is executed
+            ok(true, "callback is executed");
+            equals(arg1, 'Hello');
+            equals(arg2, 'world');
+        },
+        'Hello', 'world');
+    });
+
+  test('test addErrback', function() {
+        expect(1);
+        stop();
+        var d = jQuery('#main').loadxhtml('/../ajax_url0.html');
+        d.addCallback(function() {
+            // throw an exception to start errback chain
+            throw new Error();
+        });
+        d.addErrback(function() {
+            ok(true, "errback is executed");
+            start();
+        });
+    });
+
+    test('test callback / errback execution order', function() {
+        expect(4);
+        var counter = 0;
+        stop();
+        var d = jQuery('#main').loadxhtml('/../ajax_url0.html', {
+            callback: function() {
+                equals(++counter, 1); // should be executed first
+                start();
+            }
+        });
+        d.addCallback(function() {
+            equals(++counter, 2); // should be executed and break callback chain
+            throw new Error();
+        });
+        d.addCallback(function() {
+            // should not be executed since second callback raised an error
+            ok(false, "callback is executed");
+        });
+        d.addErrback(function() {
+            // should be executed after the second callback
+            equals(++counter, 3);
+        });
+        d.addErrback(function() {
+            // should be executed after the first errback
+            equals(++counter, 4);
+        });
+    });
+
+    test('test already included resources are ignored (ajax_url1.html)', function() {
+        expect(10);
+        var scriptsIncluded = jsSources();
+        // NOTE:
+        equals(jQuery.inArray('http://foo.js', scriptsIncluded), -1);
+        equals(jQuery('head link').length, 1);
+        /* use endswith because in pytest context we have an absolute path */
+        ok(jQuery('head link').attr('href').endswith('/qunit.css'));
+        stop();
+        jQuery('#main').loadxhtml('/../ajax_url1.html', {
+            callback: function() {
+                var origLength = scriptsIncluded.length;
+                scriptsIncluded = jsSources();
+                try {
+                    // check that foo.js has been inserted in <head>
+                    equals(scriptsIncluded.length, origLength + 1);
+                    equals(scriptsIncluded[origLength].indexOf('http://foo.js'), 0);
+                    // check that <div class="ajaxHtmlHead"> has been removed
+                    equals(jQuery('#main').children().length, 1);
+                    equals(jQuery('div.ajaxHtmlHead').length, 0);
+                    equals(jQuery('#main h1').html(), 'Hello');
+                    // qunit.css is not added twice
+                    equals(jQuery('head link').length, 1);
+                    /* use endswith because in pytest context we have an absolute path */
+                    ok(jQuery('head link').attr('href').endswith('/qunit.css'));
+                } finally {
+                    start();
+                }
+            }
+        });
+    });
+
+    test('test synchronous request loadRemote', function() {
+        var res = loadRemote('/../ajaxresult.json', {},
+        'GET', true);
+        same(res, ['foo', 'bar']);
+    });
+
+    test('test event on CubicWeb', function() {
+        expect(1);
+        stop();
+        var events = null;
+        jQuery(CubicWeb).bind('server-response', function() {
+            // check that server-response event on CubicWeb is triggered
+            events = 'CubicWeb';
+        });
+        jQuery('#main').loadxhtml('/../ajax_url0.html', {
+            callback: function() {
+                equals(events, 'CubicWeb');
+                start();
+            }
+        });
+    });
+
+    test('test event on node', function() {
+        expect(3);
+        stop();
+        var nodes = [];
+        jQuery('#main').bind('server-response', function() {
+            nodes.push('node');
+        });
+        jQuery(CubicWeb).bind('server-response', function() {
+            nodes.push('CubicWeb');
+        });
+        jQuery('#main').loadxhtml('/../ajax_url0.html', {
+            callback: function() {
+                equals(nodes.length, 2);
+                // check that server-response event on CubicWeb is triggered
+                // only once and event server-response on node is triggered
+                equals(nodes[0], 'CubicWeb');
+                equals(nodes[1], 'node');
+                start();
+            }
+        });
+    });
+});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/test_htmlhelpers.html	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,21 @@
+<html>
+  <head>
+    <script type="text/javascript" src="../../data/jquery.js"></script>
+    <script src="../../data/cubicweb.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.compat.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.python.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.htmlhelpers.js" type="text/javascript"></script>
+    <script type="text/javascript" src="qunit.js"></script>
+    <link rel="stylesheet" type="text/css" media="all" href="qunit.css" />
+    <script src="cwmock.js" type="text/javascript"></script>
+    <script src="test_htmlhelpers.js" type="text/javascript"></script>
+  </head>
+  <body>
+    <div id="main">
+    </div>
+    <h1 id="qunit-header">cubicweb.htmlhelpers.js functions tests</h1>
+    <h2 id="qunit-banner"></h2>
+    <h2 id="qunit-userAgent"></h2>
+    <ol id="qunit-tests">
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/test_htmlhelpers.js	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,36 @@
+$(document).ready(function() {
+
+    module("module2", {
+      setup: function() {
+        $('#main').append('<select id="theselect" multiple="multiple" size="2">' +
+    			'</select>');
+      }
+    });
+
+    test("test first selected", function() {
+        $('#theselect').append('<option value="foo">foo</option>' +
+    			     '<option selected="selected" value="bar">bar</option>' +
+    			     '<option value="baz">baz</option>' +
+    			     '<option selected="selecetd"value="spam">spam</option>');
+        var selected = firstSelected(document.getElementById("theselect"));
+        equals(selected.value, 'bar');
+    });
+
+    test("test first selected 2", function() {
+        $('#theselect').append('<option value="foo">foo</option>' +
+    			     '<option value="bar">bar</option>' +
+    			     '<option value="baz">baz</option>' +
+    			     '<option value="spam">spam</option>');
+        var selected = firstSelected(document.getElementById("theselect"));
+        equals(selected, null);
+    });
+
+    module("visibilty");
+    test('toggleVisibility', function() {
+        $('#main').append('<div id="foo"></div>');
+        toggleVisibility('foo');
+        ok($('#foo').hasClass('hidden'), 'check hidden class is set');
+    });
+
+});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/test_utils.html	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,22 @@
+<html>
+  <head>
+    <script type="text/javascript" src="../../data/jquery.js"></script>
+    <script src="../../data/jquery.corner.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.python.js" type="text/javascript"></script>
+    <script src="../../data/cubicweb.compat.js" type="text/javascript"></script>
+    <script src="utils.js" type="text/javascript"></script>
+    <script type="text/javascript" src="qunit.js"></script>
+    <link rel="stylesheet" type="text/css" media="all" href="qunit.css" />
+    <script src="cwmock.js" type="text/javascript"></script>
+    <script src="test_utils.js" type="text/javascript"></script>
+  </head>
+  <body>
+    <div id="main">
+    </div>
+    <h1 id="qunit-header">cw.utils functions tests</h1>
+    <h2 id="qunit-banner"></h2>
+    <h2 id="qunit-userAgent"></h2>
+    <ol id="qunit-tests">
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/test_utils.js	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,92 @@
+$(document).ready(function() {
+
+  module("datetime");
+
+  test("test full datetime", function() {
+      equals(cw.utils.toISOTimestamp(new Date(1986, 3, 18, 10, 30, 0, 0)),
+	     '1986-04-18 10:30:00');
+  });
+
+  test("test only date", function() {
+      equals(cw.utils.toISOTimestamp(new Date(1986, 3, 18)), '1986-04-18 00:00:00');
+  });
+
+  test("test null", function() {
+      equals(cw.utils.toISOTimestamp(null), null);
+  });
+
+  module("parsing");
+  test("test basic number parsing", function() {
+      var d = strptime('2008/08/08', '%Y/%m/%d');
+      same(datetuple(d), [2008, 8, 8, 0, 0]);
+      d = strptime('2008/8/8', '%Y/%m/%d');
+      same(datetuple(d), [2008, 8, 8, 0, 0]);
+      d = strptime('8/8/8', '%Y/%m/%d');
+      same(datetuple(d), [8, 8, 8, 0, 0]);
+      d = strptime('0/8/8', '%Y/%m/%d');
+      same(datetuple(d), [0, 8, 8, 0, 0]);
+      d = strptime('-10/8/8', '%Y/%m/%d');
+      same(datetuple(d), [-10, 8, 8, 0, 0]);
+      d = strptime('-35000', '%Y');
+      same(datetuple(d), [-35000, 1, 1, 0, 0]);
+  });
+
+  test("test custom format parsing", function() {
+      var d = strptime('2008-08-08', '%Y-%m-%d');
+      same(datetuple(d), [2008, 8, 8, 0, 0]);
+      d = strptime('2008 - !  08: 08', '%Y - !  %m: %d');
+      same(datetuple(d), [2008, 8, 8, 0, 0]);
+      d = strptime('2008-08-08 12:14', '%Y-%m-%d %H:%M');
+      same(datetuple(d), [2008, 8, 8, 12, 14]);
+      d = strptime('2008-08-08 1:14', '%Y-%m-%d %H:%M');
+      same(datetuple(d), [2008, 8, 8, 1, 14]);
+      d = strptime('2008-08-08 01:14', '%Y-%m-%d %H:%M');
+      same(datetuple(d), [2008, 8, 8, 1, 14]);
+  });
+
+  module("sliceList");
+  test("test slicelist", function() {
+      var list = ['a', 'b', 'c', 'd', 'e', 'f'];
+      same(sliceList(list, 2),  ['c', 'd', 'e', 'f']);
+      same(sliceList(list, 2, -2), ['c', 'd']);
+      same(sliceList(list, -3), ['d', 'e', 'f']);
+      same(sliceList(list, 0, -2), ['a', 'b', 'c', 'd']);
+      same(sliceList(list),  list);
+  });
+
+  module("formContents", {
+    setup: function() {
+      $('#main').append('<form id="test-form"></form>');
+    }
+  });
+  // XXX test fckeditor
+  test("test formContents", function() {
+      $('#test-form').append('<input name="input-text" ' +
+			     'type="text" value="toto" />');
+      $('#test-form').append('<textarea rows="10" cols="30" '+
+			     'name="mytextarea">Hello World!</textarea> ');
+      $('#test-form').append('<input name="choice" type="radio" ' +
+			     'value="yes" />');
+      $('#test-form').append('<input name="choice" type="radio" ' +
+			     'value="no" checked="checked"/>');
+      $('#test-form').append('<input name="check" type="checkbox" ' +
+			     'value="yes" />');
+      $('#test-form').append('<input name="check" type="checkbox" ' +
+			     'value="no" checked="checked"/>');
+      $('#test-form').append('<select id="theselect" name="theselect" ' +
+			     'multiple="multiple" size="2"></select>');
+      $('#theselect').append('<option selected="selected" ' +
+			     'value="foo">foo</option>' +
+  			     '<option value="bar">bar</option>');
+      //Append an unchecked radio input : should not be in formContents list
+      $('#test-form').append('<input name="unchecked-choice" type="radio" ' +
+			     'value="one" />');
+      $('#test-form').append('<input name="unchecked-choice" type="radio" ' +
+			     'value="two"/>');
+      same(formContents($('#test-form')[0]), [
+	['input-text', 'mytextarea', 'choice', 'check', 'theselect'],
+	['toto', 'Hello World!', 'no', 'no', 'foo']
+      ]);
+  });
+});
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/jstests/utils.js	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,29 @@
+function datetuple(d) {
+    return [d.getFullYear(), d.getMonth()+1, d.getDate(),
+	    d.getHours(), d.getMinutes()];
+}
+
+function pprint(obj) {
+    print('{');
+    for(k in obj) {
+	print('  ' + k + ' = ' + obj[k]);
+    }
+    print('}');
+}
+
+function arrayrepr(array) {
+    return '[' + array.join(', ') + ']';
+}
+
+function assertArrayEquals(array1, array2) {
+    if (array1.length != array2.length) {
+	throw new crosscheck.AssertionFailure(array1.join(', ') + ' != ' + array2.join(', '));
+    }
+    for (var i=0; i<array1.length; i++) {
+	if (array1[i] != array2[i]) {
+
+	    throw new crosscheck.AssertionFailure(arrayrepr(array1) + ' and ' + arrayrepr(array2)
+						 + ' differs at index ' + i);
+	}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/test_jscript.py	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,42 @@
+from cubicweb.devtools.qunit import QUnitTestCase, unittest_main
+
+from os import path as osp
+
+
+class JScript(QUnitTestCase):
+
+    all_js_tests = (
+        ("jstests/test_utils.js", (
+            "../../web/data/cubicweb.js",
+            "../../web/data/cubicweb.compat.js",
+            "../../web/data/cubicweb.python.js",
+            "jstests/utils.js",
+            ),
+         ),
+
+        ("jstests/test_htmlhelpers.js", (
+            "../../web/data/cubicweb.js",
+            "../../web/data/cubicweb.compat.js",
+            "../../web/data/cubicweb.python.js",
+            "../../web/data/cubicweb.htmlhelpers.js",
+            ),
+         ),
+
+        ("jstests/test_ajax.js", (
+            "../../web/data/cubicweb.python.js",
+            "../../web/data/cubicweb.js",
+            "../../web/data/cubicweb.compat.js",
+            "../../web/data/cubicweb.htmlhelpers.js",
+            "../../web/data/cubicweb.ajax.js",
+            ), (
+            "jstests/ajax_url0.html",
+            "jstests/ajax_url1.html",
+            "jstests/ajax_url2.html",
+            "jstests/ajaxresult.json",
+            ),
+         ),
+    )
+
+
+if __name__ == '__main__':
+    unittest_main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/test_windmill.py	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,12 @@
+# Run all scenarii found in windmill directory
+from os.path import join, dirname
+from cubicweb.devtools.cwwindmill import (CubicWebWindmillUseCase,
+                                          unittest_main)
+
+class CubicWebWindmillUseCase(CubicWebWindmillUseCase):
+    #test_dir = join(dirname(__file__), "windmill/test_edit_relation.py")
+    pass
+
+
+if __name__ == '__main__':
+    unittest_main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/windmill/test_connexion.py	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,41 @@
+from cubicweb.devtools import DEFAULT_SOURCES
+LOGIN, PASSWORD = DEFAULT_SOURCES['admin'].values()
+
+# Generated by the windmill services transformer
+from windmill.authoring import WindmillTestClient
+
+def test_connect():
+    client = WindmillTestClient(__name__)
+
+    client.open(url=u'/')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
+    client.type(text=LOGIN, id=u'__login')
+    client.type(text=PASSWORD, id=u'__password')
+
+    client.execJS(js=u"$('#loginForm').submit()")
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.sleep(milliseconds=u'5000')
+    client.asserts.assertJS(js=u'$(\'.message\').text() == "welcome %s !"' % LOGIN)
+    client.open(url=u'/logout')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.open(url=u'/')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
+
+
+def test_wrong_connect():
+    client = WindmillTestClient(__name__)
+
+    client.open(url=u'/')
+    # XXX windmill wants to use its proxy internally on 403 :-(
+    #client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
+    #client.type(text=LOGIN, id=u'__login')
+    #client.type(text=u'novalidpassword', id=u'__password')
+    #client.click(value=u'log in')
+    client.open(url=u'/?__login=user&__password=nopassword')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertTextIn(validator=u'authentication failure', id=u'loginBox')
+    client.open(url=u'/')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/windmill/test_creation.py	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,58 @@
+from cubicweb.devtools import DEFAULT_SOURCES
+LOGIN, PASSWORD = DEFAULT_SOURCES['admin'].values()
+
+# Generated by the windmill services transformer
+from windmill.authoring import WindmillTestClient
+
+def test_creation():
+    client = WindmillTestClient(__name__)
+
+    client.open(url=u'/')
+    client.waits.forPageLoad(timeout=u'8000')
+    client.type(text=LOGIN, id=u'__login')
+    client.type(text=PASSWORD, id=u'__password')
+    client.click(value=u'log in')
+    client.waits.forPageLoad(timeout=u'20000')
+
+    # pre-condition
+    client.open(url=u'/cwuser/myuser')
+    client.asserts.assertJS(js=u'$(\'#contentmain h1\').text() == "this resource does not exist"')
+    client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"')
+    client.asserts.assertJS(js=u'$(\'.searchMessage strong\').text() == "No result matching query"')
+
+    client.open(url=u'/manage')
+    client.open(url=u'/add/CWUser')
+    client.type(text=u'myuser', id=u'login-subject:A')
+    client.type(text=u'myuser', id=u'upassword-subject:A')
+    client.type(text=u'myuser', name=u'upassword-subject-confirm:A')
+    client.type(text=u'myuser', id=u'firstname-subject:A')
+    client.select(option=u'managers', id=u'from_in_group-subject:A')
+    client.click(id=u'cwinoutadd')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(id=u'adduse_email:Alink')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.type(text=u'myuser@logilab.fr', id=u'address-subject:B')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(value=u'button_ok')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.sleep(milliseconds=u'5000')
+    client.asserts.assertJS(js=u'$(\'.message\').text() == "entity created"')
+    client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertJS(js=u'$(\'#contentmain h1\').text() == "myuser"')
+    client.waits.forPageLoad(timeout=u'8000')
+    client.open(url=u'/cwuser/myuser?vid=sameetypelist')
+    client.waits.forPageLoad(timeout=u'8000')
+    client.asserts.assertJS(js=u'$(\'#contentmain a\').text() == "myuser"')
+    client.open(url=u'/cwuser/myuser?vid=text')
+    client.waits.forPageLoad(timeout=u'8000')
+    client.asserts.assertJS(js=u'$(\'#contentmain\').text() == "\\nmyuser"')
+    client.open(url=u'/cwuser/myuser?vid=deleteconf')
+    client.waits.forElement(timeout=u'8000', value=u'button_delete')
+    client.click(value=u'button_delete')
+    client.waits.forPageLoad(timeout=u'8000')
+    client.open(url=u'/cwuser/myuser')
+    client.asserts.assertJS(js=u'$(\'#contentmain h1\').text() == "this resource does not exist"')
+    client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"')
+    client.asserts.assertJS(js=u'$(\'.searchMessage strong\').text() == "No result matching query"')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testfunc/test/windmill/test_edit_relation.py	Wed May 11 13:41:21 2011 +0200
@@ -0,0 +1,82 @@
+from cubicweb.devtools import DEFAULT_SOURCES
+LOGIN, PASSWORD = DEFAULT_SOURCES['admin'].values()
+
+# Generated by the windmill services transformer
+from windmill.authoring import WindmillTestClient
+
+
+def test_edit_relation():
+    client = WindmillTestClient(__name__)
+
+    client.open(url=u'/logout')
+    client.open(url=u'/')
+    client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
+    client.type(text=LOGIN, id=u'__login')
+    client.type(text=PASSWORD, id=u'__password')
+    client.execJS(js=u"$('#loginForm').submit()")
+    client.waits.forPageLoad(timeout=u'20000')
+    client.open(url=u'/add/Folder')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(timeout=u'8000', id=u'name-subject:A')
+    client.click(id=u'name-subject:A')
+    client.type(text=u'folder1', id=u'name-subject:A')
+    client.click(value=u'button_ok')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'add add Folder filed_under Folder object', timeout=u'8000')
+    client.click(link=u'add add Folder filed_under Folder object')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(timeout=u'8000', id=u'name-subject:A')
+    client.click(id=u'name-subject:A')
+    client.type(text=u'subfolder1', id=u'name-subject:A')
+    client.click(value=u'button_ok')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'more actions', timeout=u'8000')
+    client.click(link=u'more actions')
+    client.click(link=u'copy')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.type(text=u'folder2', id=u'name-subject:A')
+    client.click(value=u'button_ok')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'modify', timeout=u'8000')
+    client.click(link=u'modify')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(timeout=u'8000', id=u'footer')
+    client.click(link=u'x')
+    client.click(value=u'button_ok')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'add add Folder filed_under Folder object', timeout=u'8000')
+    client.click(link=u'add add Folder filed_under Folder object')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.type(text=u'subfolder2', id=u'name-subject:A')
+    client.click(value=u'button_ok')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'subfolder2', timeout=u'8000')
+    client.click(link=u'subfolder2')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'modify', timeout=u'8000')
+    client.click(link=u'modify')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(timeout=u'8000', id=u'footer')
+    client.click(link=u'x')
+    client.select(xpath=u'//select', index=u'1')
+    #client.execJQuery(jquery=u'("select").trigger(\'change\')') # BUGGY freeze UI..
+    client.execJS(js=u'$("select").trigger(\'change\')')
+    client.waits.sleep(milliseconds=u'2000')
+    client.select(jquery=u'(\'select:contains("Search")\')[0]', option=u'Search for folder')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'folder1')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(timeout=u'8000', value=u'button_ok')
+    client.click(value=u'button_ok')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertText(xpath=u'//h1', validator=u'subfolder2')
+    client.waits.forElement(link=u'folder_plural', timeout=u'8000')
+    client.click(link=u'folder_plural')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertText(jquery=u"('#contentmain div a')[0]", validator=u'folder1')
+    client.asserts.assertText(jquery=u"('#contentmain div a')[1]", validator=u'folder2')
+    client.asserts.assertText(jquery=u"('#contentmain div a')[2]", validator=u'subfolder1')
+    client.asserts.assertText(jquery=u"('#contentmain div a')[3]", validator=u'subfolder2')
+    client.click(link=u'subfolder2')
+    client.click(link=u'modify')
+    client.click(link=u'folder1')
--- a/web/test/jstests/ajax_url0.html	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<div id="ajaxroot">
-  <h1>Hello</h1>
-</div>
--- a/web/test/jstests/ajax_url1.html	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<div id="ajaxroot">
-  <div class="ajaxHtmlHead">
-    <script src="http://foo.js" type="text/javascript"> </script>
-  </div>
-  <h1>Hello</h1>
-</div>
--- a/web/test/jstests/ajax_url2.html	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<div id="ajaxroot">
-  <div class="ajaxHtmlHead">
-    <script src="http://foo.js" type="text/javascript"> </script>
-    <link rel="stylesheet" type="text/css" media="all" href="qunit.css" />
-  </div>
-  <h1>Hello</h1>
-</div>
--- a/web/test/jstests/ajaxresult.json	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-['foo', 'bar']
--- a/web/test/jstests/test_ajax.html	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<html>
-  <head>
-    <!-- dependencies -->
-    <script type="text/javascript" src="../../data/jquery.js"></script>
-    <script src="../../data/cubicweb.python.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.compat.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.dom.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.htmlhelpers.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.ajax.js" type="text/javascript"></script>
-    <!-- qunit files -->
-    <script type="text/javascript" src="../../../devtools/data/qunit.js"></script>
-    <link rel="stylesheet" type="text/css" media="all" href="../../../devtools/data/qunit.css" />
-    <!-- test suite -->
-    <script src="cwmock.js" type="text/javascript"></script>
-    <script src="test_ajax.js" type="text/javascript"></script>
-  </head>
-  <body>
-    <div id="main"> </div>
-    <h1 id="qunit-header">cubicweb.ajax.js functions tests</h1>
-    <h2 id="qunit-banner"></h2>
-    <ol id="qunit-tests">
-  </body>
-</html>
--- a/web/test/jstests/test_ajax.js	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-$(document).ready(function() {
-
-    module("ajax", {
-        setup: function() {
-          this.scriptsLength = $('head script[src]').length-1;
-          this.cssLength = $('head link[rel=stylesheet]').length-1;
-          // re-initialize cw loaded cache so that each tests run in a
-          // clean environment, have a lookt at _loadAjaxHtmlHead implementation
-          // in cubicweb.ajax.js for more information.
-          cw.loaded_src = [];
-          cw.loaded_href = [];
-        },
-        teardown: function() {
-          $('head script[src]:gt(' + this.scriptsLength + ')').remove();
-          $('head link[rel=stylesheet]:gt(' + this.cssLength + ')').remove();
-        }
-      });
-
-    function jsSources() {
-        return $.map($('head script[src]'), function(script) {
-            return script.getAttribute('src');
-        });
-    }
-
-    test('test simple h1 inclusion (ajax_url0.html)', function() {
-        expect(3);
-        equals(jQuery('#main').children().length, 0);
-        stop();
-        jQuery('#main').loadxhtml('/../ajax_url0.html', {
-            callback: function() {
-                equals(jQuery('#main').children().length, 1);
-                equals(jQuery('#main h1').html(), 'Hello');
-                start();
-            }
-        });
-    });
-
-    test('test simple html head inclusion (ajax_url1.html)', function() {
-        expect(6);
-        var scriptsIncluded = jsSources();
-        equals(jQuery.inArray('http://foo.js', scriptsIncluded), - 1);
-        stop();
-        jQuery('#main').loadxhtml('/../ajax_url1.html', {
-            callback: function() {
-                var origLength = scriptsIncluded.length;
-                scriptsIncluded = jsSources();
-                // check that foo.js has been *appended* to <head>
-                equals(scriptsIncluded.length, origLength + 1);
-                equals(scriptsIncluded[origLength].indexOf('http://foo.js'), 0);
-                // check that <div class="ajaxHtmlHead"> has been removed
-                equals(jQuery('#main').children().length, 1);
-                equals(jQuery('div.ajaxHtmlHead').length, 0);
-                equals(jQuery('#main h1').html(), 'Hello');
-                start();
-            }
-        });
-    });
-
-    test('test addCallback', function() {
-        expect(3);
-        equals(jQuery('#main').children().length, 0);
-        stop();
-        var d = jQuery('#main').loadxhtml('/../ajax_url0.html');
-        d.addCallback(function() {
-            equals(jQuery('#main').children().length, 1);
-            equals(jQuery('#main h1').html(), 'Hello');
-            start();
-        });
-    });
-
-    test('test callback after synchronous request', function() {
-        expect(1);
-        var deferred = new Deferred();
-        var result = jQuery.ajax({
-            url: './ajax_url0.html',
-            async: false,
-            beforeSend: function(xhr) {
-                deferred._req = xhr;
-            },
-            success: function(data, status) {
-                deferred.success(data);
-            }
-        });
-        stop();
-        deferred.addCallback(function() {
-            // add an assertion to ensure the callback is executed
-            ok(true, "callback is executed");
-            start();
-        });
-    });
-
-    test('test addCallback with parameters', function() {
-        expect(3);
-        equals(jQuery('#main').children().length, 0);
-        stop();
-        var d = jQuery('#main').loadxhtml('/../ajax_url0.html');
-        d.addCallback(function(data, req, arg1, arg2) {
-            equals(arg1, 'Hello');
-            equals(arg2, 'world');
-            start();
-        },
-        'Hello', 'world');
-    });
-
-    test('test callback after synchronous request with parameters', function() {
-        var deferred = new Deferred();
-        var result = jQuery.ajax({
-            url: '/../ajax_url0.html',
-            async: false,
-            beforeSend: function(xhr) {
-                deferred._req = xhr;
-            },
-            success: function(data, status) {
-                deferred.success(data);
-            }
-        });
-        deferred.addCallback(function(data, req, arg1, arg2) {
-            // add an assertion to ensure the callback is executed
-            ok(true, "callback is executed");
-            equals(arg1, 'Hello');
-            equals(arg2, 'world');
-        },
-        'Hello', 'world');
-    });
-
-  test('test addErrback', function() {
-        expect(1);
-        stop();
-        var d = jQuery('#main').loadxhtml('/../ajax_url0.html');
-        d.addCallback(function() {
-            // throw an exception to start errback chain
-            throw new Error();
-        });
-        d.addErrback(function() {
-            ok(true, "errback is executed");
-            start();
-        });
-    });
-
-    test('test callback / errback execution order', function() {
-        expect(4);
-        var counter = 0;
-        stop();
-        var d = jQuery('#main').loadxhtml('/../ajax_url0.html', {
-            callback: function() {
-                equals(++counter, 1); // should be executed first
-                start();
-            }
-        });
-        d.addCallback(function() {
-            equals(++counter, 2); // should be executed and break callback chain
-            throw new Error();
-        });
-        d.addCallback(function() {
-            // should not be executed since second callback raised an error
-            ok(false, "callback is executed");
-        });
-        d.addErrback(function() {
-            // should be executed after the second callback
-            equals(++counter, 3);
-        });
-        d.addErrback(function() {
-            // should be executed after the first errback
-            equals(++counter, 4);
-        });
-    });
-
-    test('test already included resources are ignored (ajax_url1.html)', function() {
-        expect(10);
-        var scriptsIncluded = jsSources();
-        // NOTE:
-        equals(jQuery.inArray('http://foo.js', scriptsIncluded), -1);
-        equals(jQuery('head link').length, 1);
-        /* use endswith because in pytest context we have an absolute path */
-        ok(jQuery('head link').attr('href').endswith('/qunit.css'));
-        stop();
-        jQuery('#main').loadxhtml('/../ajax_url1.html', {
-            callback: function() {
-                var origLength = scriptsIncluded.length;
-                scriptsIncluded = jsSources();
-                try {
-                    // check that foo.js has been inserted in <head>
-                    equals(scriptsIncluded.length, origLength + 1);
-                    equals(scriptsIncluded[origLength].indexOf('http://foo.js'), 0);
-                    // check that <div class="ajaxHtmlHead"> has been removed
-                    equals(jQuery('#main').children().length, 1);
-                    equals(jQuery('div.ajaxHtmlHead').length, 0);
-                    equals(jQuery('#main h1').html(), 'Hello');
-                    // qunit.css is not added twice
-                    equals(jQuery('head link').length, 1);
-                    /* use endswith because in pytest context we have an absolute path */
-                    ok(jQuery('head link').attr('href').endswith('/qunit.css'));
-                } finally {
-                    start();
-                }
-            }
-        });
-    });
-
-    test('test synchronous request loadRemote', function() {
-        var res = loadRemote('/../ajaxresult.json', {},
-        'GET', true);
-        same(res, ['foo', 'bar']);
-    });
-
-    test('test event on CubicWeb', function() {
-        expect(1);
-        stop();
-        var events = null;
-        jQuery(CubicWeb).bind('server-response', function() {
-            // check that server-response event on CubicWeb is triggered
-            events = 'CubicWeb';
-        });
-        jQuery('#main').loadxhtml('/../ajax_url0.html', {
-            callback: function() {
-                equals(events, 'CubicWeb');
-                start();
-            }
-        });
-    });
-
-    test('test event on node', function() {
-        expect(3);
-        stop();
-        var nodes = [];
-        jQuery('#main').bind('server-response', function() {
-            nodes.push('node');
-        });
-        jQuery(CubicWeb).bind('server-response', function() {
-            nodes.push('CubicWeb');
-        });
-        jQuery('#main').loadxhtml('/../ajax_url0.html', {
-            callback: function() {
-                equals(nodes.length, 2);
-                // check that server-response event on CubicWeb is triggered
-                // only once and event server-response on node is triggered
-                equals(nodes[0], 'CubicWeb');
-                equals(nodes[1], 'node');
-                start();
-            }
-        });
-    });
-});
-
--- a/web/test/jstests/test_htmlhelpers.html	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<html>
-  <head>
-    <script type="text/javascript" src="../../data/jquery.js"></script>
-    <script src="../../data/cubicweb.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.compat.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.python.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.htmlhelpers.js" type="text/javascript"></script>
-    <script type="text/javascript" src="qunit.js"></script>
-    <link rel="stylesheet" type="text/css" media="all" href="qunit.css" />
-    <script src="cwmock.js" type="text/javascript"></script>
-    <script src="test_htmlhelpers.js" type="text/javascript"></script>
-  </head>
-  <body>
-    <div id="main">
-    </div>
-    <h1 id="qunit-header">cubicweb.htmlhelpers.js functions tests</h1>
-    <h2 id="qunit-banner"></h2>
-    <h2 id="qunit-userAgent"></h2>
-    <ol id="qunit-tests">
-  </body>
-</html>
--- a/web/test/jstests/test_htmlhelpers.js	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-$(document).ready(function() {
-
-    module("module2", {
-      setup: function() {
-        $('#main').append('<select id="theselect" multiple="multiple" size="2">' +
-    			'</select>');
-      }
-    });
-
-    test("test first selected", function() {
-        $('#theselect').append('<option value="foo">foo</option>' +
-    			     '<option selected="selected" value="bar">bar</option>' +
-    			     '<option value="baz">baz</option>' +
-    			     '<option selected="selecetd"value="spam">spam</option>');
-        var selected = firstSelected(document.getElementById("theselect"));
-        equals(selected.value, 'bar');
-    });
-
-    test("test first selected 2", function() {
-        $('#theselect').append('<option value="foo">foo</option>' +
-    			     '<option value="bar">bar</option>' +
-    			     '<option value="baz">baz</option>' +
-    			     '<option value="spam">spam</option>');
-        var selected = firstSelected(document.getElementById("theselect"));
-        equals(selected, null);
-    });
-
-    module("visibilty");
-    test('toggleVisibility', function() {
-        $('#main').append('<div id="foo"></div>');
-        toggleVisibility('foo');
-        ok($('#foo').hasClass('hidden'), 'check hidden class is set');
-    });
-
-});
-
--- a/web/test/jstests/test_utils.html	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-<html>
-  <head>
-    <script type="text/javascript" src="../../data/jquery.js"></script>
-    <script src="../../data/jquery.corner.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.python.js" type="text/javascript"></script>
-    <script src="../../data/cubicweb.compat.js" type="text/javascript"></script>
-    <script src="utils.js" type="text/javascript"></script>
-    <script type="text/javascript" src="qunit.js"></script>
-    <link rel="stylesheet" type="text/css" media="all" href="qunit.css" />
-    <script src="cwmock.js" type="text/javascript"></script>
-    <script src="test_utils.js" type="text/javascript"></script>
-  </head>
-  <body>
-    <div id="main">
-    </div>
-    <h1 id="qunit-header">cw.utils functions tests</h1>
-    <h2 id="qunit-banner"></h2>
-    <h2 id="qunit-userAgent"></h2>
-    <ol id="qunit-tests">
-  </body>
-</html>
--- a/web/test/jstests/test_utils.js	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-$(document).ready(function() {
-
-  module("datetime");
-
-  test("test full datetime", function() {
-      equals(cw.utils.toISOTimestamp(new Date(1986, 3, 18, 10, 30, 0, 0)),
-	     '1986-04-18 10:30:00');
-  });
-
-  test("test only date", function() {
-      equals(cw.utils.toISOTimestamp(new Date(1986, 3, 18)), '1986-04-18 00:00:00');
-  });
-
-  test("test null", function() {
-      equals(cw.utils.toISOTimestamp(null), null);
-  });
-
-  module("parsing");
-  test("test basic number parsing", function() {
-      var d = strptime('2008/08/08', '%Y/%m/%d');
-      same(datetuple(d), [2008, 8, 8, 0, 0]);
-      d = strptime('2008/8/8', '%Y/%m/%d');
-      same(datetuple(d), [2008, 8, 8, 0, 0]);
-      d = strptime('8/8/8', '%Y/%m/%d');
-      same(datetuple(d), [8, 8, 8, 0, 0]);
-      d = strptime('0/8/8', '%Y/%m/%d');
-      same(datetuple(d), [0, 8, 8, 0, 0]);
-      d = strptime('-10/8/8', '%Y/%m/%d');
-      same(datetuple(d), [-10, 8, 8, 0, 0]);
-      d = strptime('-35000', '%Y');
-      same(datetuple(d), [-35000, 1, 1, 0, 0]);
-  });
-
-  test("test custom format parsing", function() {
-      var d = strptime('2008-08-08', '%Y-%m-%d');
-      same(datetuple(d), [2008, 8, 8, 0, 0]);
-      d = strptime('2008 - !  08: 08', '%Y - !  %m: %d');
-      same(datetuple(d), [2008, 8, 8, 0, 0]);
-      d = strptime('2008-08-08 12:14', '%Y-%m-%d %H:%M');
-      same(datetuple(d), [2008, 8, 8, 12, 14]);
-      d = strptime('2008-08-08 1:14', '%Y-%m-%d %H:%M');
-      same(datetuple(d), [2008, 8, 8, 1, 14]);
-      d = strptime('2008-08-08 01:14', '%Y-%m-%d %H:%M');
-      same(datetuple(d), [2008, 8, 8, 1, 14]);
-  });
-
-  module("sliceList");
-  test("test slicelist", function() {
-      var list = ['a', 'b', 'c', 'd', 'e', 'f'];
-      same(sliceList(list, 2),  ['c', 'd', 'e', 'f']);
-      same(sliceList(list, 2, -2), ['c', 'd']);
-      same(sliceList(list, -3), ['d', 'e', 'f']);
-      same(sliceList(list, 0, -2), ['a', 'b', 'c', 'd']);
-      same(sliceList(list),  list);
-  });
-
-  module("formContents", {
-    setup: function() {
-      $('#main').append('<form id="test-form"></form>');
-    }
-  });
-  // XXX test fckeditor
-  test("test formContents", function() {
-      $('#test-form').append('<input name="input-text" ' +
-			     'type="text" value="toto" />');
-      $('#test-form').append('<textarea rows="10" cols="30" '+
-			     'name="mytextarea">Hello World!</textarea> ');
-      $('#test-form').append('<input name="choice" type="radio" ' +
-			     'value="yes" />');
-      $('#test-form').append('<input name="choice" type="radio" ' +
-			     'value="no" checked="checked"/>');
-      $('#test-form').append('<input name="check" type="checkbox" ' +
-			     'value="yes" />');
-      $('#test-form').append('<input name="check" type="checkbox" ' +
-			     'value="no" checked="checked"/>');
-      $('#test-form').append('<select id="theselect" name="theselect" ' +
-			     'multiple="multiple" size="2"></select>');
-      $('#theselect').append('<option selected="selected" ' +
-			     'value="foo">foo</option>' +
-  			     '<option value="bar">bar</option>');
-      //Append an unchecked radio input : should not be in formContents list
-      $('#test-form').append('<input name="unchecked-choice" type="radio" ' +
-			     'value="one" />');
-      $('#test-form').append('<input name="unchecked-choice" type="radio" ' +
-			     'value="two"/>');
-      same(formContents($('#test-form')[0]), [
-	['input-text', 'mytextarea', 'choice', 'check', 'theselect'],
-	['toto', 'Hello World!', 'no', 'no', 'foo']
-      ]);
-  });
-});
-
--- a/web/test/jstests/utils.js	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-function datetuple(d) {
-    return [d.getFullYear(), d.getMonth()+1, d.getDate(),
-	    d.getHours(), d.getMinutes()];
-}
-
-function pprint(obj) {
-    print('{');
-    for(k in obj) {
-	print('  ' + k + ' = ' + obj[k]);
-    }
-    print('}');
-}
-
-function arrayrepr(array) {
-    return '[' + array.join(', ') + ']';
-}
-
-function assertArrayEquals(array1, array2) {
-    if (array1.length != array2.length) {
-	throw new crosscheck.AssertionFailure(array1.join(', ') + ' != ' + array2.join(', '));
-    }
-    for (var i=0; i<array1.length; i++) {
-	if (array1[i] != array2[i]) {
-
-	    throw new crosscheck.AssertionFailure(arrayrepr(array1) + ' and ' + arrayrepr(array2)
-						 + ' differs at index ' + i);
-	}
-    }
-}
--- a/web/test/test_jscript.py	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-from cubicweb.devtools.qunit import QUnitTestCase, unittest_main
-
-from os import path as osp
-
-
-class JScript(QUnitTestCase):
-
-    all_js_tests = (
-        ("jstests/test_utils.js", (
-            "../data/cubicweb.js",
-            "../data/cubicweb.compat.js",
-            "../data/cubicweb.python.js",
-            "jstests/utils.js",
-            ),
-         ),
-
-        ("jstests/test_htmlhelpers.js", (
-            "../data/cubicweb.js",
-            "../data/cubicweb.compat.js",
-            "../data/cubicweb.python.js",
-            "../data/cubicweb.htmlhelpers.js",
-            ),
-         ),
-
-        ("jstests/test_ajax.js", (
-            "../data/cubicweb.python.js",
-            "../data/cubicweb.js",
-            "../data/cubicweb.compat.js",
-            "../data/cubicweb.htmlhelpers.js",
-            "../data/cubicweb.ajax.js",
-            ), (
-            "jstests/ajax_url0.html",
-            "jstests/ajax_url1.html",
-            "jstests/ajax_url2.html",
-            "jstests/ajaxresult.json",
-            ),
-         ),
-    )
-
-
-if __name__ == '__main__':
-    unittest_main()
--- a/web/test/test_windmill.py	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-# Run all scenarii found in windmill directory
-from os.path import join, dirname
-from cubicweb.devtools.cwwindmill import (CubicWebWindmillUseCase,
-                                          unittest_main)
-
-class CubicWebWindmillUseCase(CubicWebWindmillUseCase):
-    #test_dir = join(dirname(__file__), "windmill/test_edit_relation.py")
-    pass
-
-
-if __name__ == '__main__':
-    unittest_main()
--- a/web/test/windmill/test_connexion.py	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-from cubicweb.devtools import DEFAULT_SOURCES
-LOGIN, PASSWORD = DEFAULT_SOURCES['admin'].values()
-
-# Generated by the windmill services transformer
-from windmill.authoring import WindmillTestClient
-
-def test_connect():
-    client = WindmillTestClient(__name__)
-
-    client.open(url=u'/')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
-    client.type(text=LOGIN, id=u'__login')
-    client.type(text=PASSWORD, id=u'__password')
-
-    client.execJS(js=u"$('#loginForm').submit()")
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.sleep(milliseconds=u'5000')
-    client.asserts.assertJS(js=u'$(\'.message\').text() == "welcome %s !"' % LOGIN)
-    client.open(url=u'/logout')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.open(url=u'/')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
-
-
-def test_wrong_connect():
-    client = WindmillTestClient(__name__)
-
-    client.open(url=u'/')
-    # XXX windmill wants to use its proxy internally on 403 :-(
-    #client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
-    #client.type(text=LOGIN, id=u'__login')
-    #client.type(text=u'novalidpassword', id=u'__password')
-    #client.click(value=u'log in')
-    client.open(url=u'/?__login=user&__password=nopassword')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.asserts.assertTextIn(validator=u'authentication failure', id=u'loginBox')
-    client.open(url=u'/')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
--- a/web/test/windmill/test_creation.py	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-from cubicweb.devtools import DEFAULT_SOURCES
-LOGIN, PASSWORD = DEFAULT_SOURCES['admin'].values()
-
-# Generated by the windmill services transformer
-from windmill.authoring import WindmillTestClient
-
-def test_creation():
-    client = WindmillTestClient(__name__)
-
-    client.open(url=u'/')
-    client.waits.forPageLoad(timeout=u'8000')
-    client.type(text=LOGIN, id=u'__login')
-    client.type(text=PASSWORD, id=u'__password')
-    client.click(value=u'log in')
-    client.waits.forPageLoad(timeout=u'20000')
-
-    # pre-condition
-    client.open(url=u'/cwuser/myuser')
-    client.asserts.assertJS(js=u'$(\'#contentmain h1\').text() == "this resource does not exist"')
-    client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"')
-    client.asserts.assertJS(js=u'$(\'.searchMessage strong\').text() == "No result matching query"')
-
-    client.open(url=u'/manage')
-    client.open(url=u'/add/CWUser')
-    client.type(text=u'myuser', id=u'login-subject:A')
-    client.type(text=u'myuser', id=u'upassword-subject:A')
-    client.type(text=u'myuser', name=u'upassword-subject-confirm:A')
-    client.type(text=u'myuser', id=u'firstname-subject:A')
-    client.select(option=u'managers', id=u'from_in_group-subject:A')
-    client.click(id=u'cwinoutadd')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.click(id=u'adduse_email:Alink')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.type(text=u'myuser@logilab.fr', id=u'address-subject:B')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.click(value=u'button_ok')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.sleep(milliseconds=u'5000')
-    client.asserts.assertJS(js=u'$(\'.message\').text() == "entity created"')
-    client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.asserts.assertJS(js=u'$(\'#contentmain h1\').text() == "myuser"')
-    client.waits.forPageLoad(timeout=u'8000')
-    client.open(url=u'/cwuser/myuser?vid=sameetypelist')
-    client.waits.forPageLoad(timeout=u'8000')
-    client.asserts.assertJS(js=u'$(\'#contentmain a\').text() == "myuser"')
-    client.open(url=u'/cwuser/myuser?vid=text')
-    client.waits.forPageLoad(timeout=u'8000')
-    client.asserts.assertJS(js=u'$(\'#contentmain\').text() == "\\nmyuser"')
-    client.open(url=u'/cwuser/myuser?vid=deleteconf')
-    client.waits.forElement(timeout=u'8000', value=u'button_delete')
-    client.click(value=u'button_delete')
-    client.waits.forPageLoad(timeout=u'8000')
-    client.open(url=u'/cwuser/myuser')
-    client.asserts.assertJS(js=u'$(\'#contentmain h1\').text() == "this resource does not exist"')
-    client.open(url=u'/?rql=Any U WHERE U is CWUser, U login "myuser"')
-    client.asserts.assertJS(js=u'$(\'.searchMessage strong\').text() == "No result matching query"')
-
--- a/web/test/windmill/test_edit_relation.py	Wed May 11 12:11:51 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-from cubicweb.devtools import DEFAULT_SOURCES
-LOGIN, PASSWORD = DEFAULT_SOURCES['admin'].values()
-
-# Generated by the windmill services transformer
-from windmill.authoring import WindmillTestClient
-
-
-def test_edit_relation():
-    client = WindmillTestClient(__name__)
-
-    client.open(url=u'/logout')
-    client.open(url=u'/')
-    client.asserts.assertJS(js=u"$('#loginForm').is(':visible')")
-    client.type(text=LOGIN, id=u'__login')
-    client.type(text=PASSWORD, id=u'__password')
-    client.execJS(js=u"$('#loginForm').submit()")
-    client.waits.forPageLoad(timeout=u'20000')
-    client.open(url=u'/add/Folder')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(timeout=u'8000', id=u'name-subject:A')
-    client.click(id=u'name-subject:A')
-    client.type(text=u'folder1', id=u'name-subject:A')
-    client.click(value=u'button_ok')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(link=u'add add Folder filed_under Folder object', timeout=u'8000')
-    client.click(link=u'add add Folder filed_under Folder object')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(timeout=u'8000', id=u'name-subject:A')
-    client.click(id=u'name-subject:A')
-    client.type(text=u'subfolder1', id=u'name-subject:A')
-    client.click(value=u'button_ok')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(link=u'more actions', timeout=u'8000')
-    client.click(link=u'more actions')
-    client.click(link=u'copy')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.type(text=u'folder2', id=u'name-subject:A')
-    client.click(value=u'button_ok')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(link=u'modify', timeout=u'8000')
-    client.click(link=u'modify')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(timeout=u'8000', id=u'footer')
-    client.click(link=u'x')
-    client.click(value=u'button_ok')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(link=u'add add Folder filed_under Folder object', timeout=u'8000')
-    client.click(link=u'add add Folder filed_under Folder object')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.type(text=u'subfolder2', id=u'name-subject:A')
-    client.click(value=u'button_ok')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(link=u'subfolder2', timeout=u'8000')
-    client.click(link=u'subfolder2')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(link=u'modify', timeout=u'8000')
-    client.click(link=u'modify')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(timeout=u'8000', id=u'footer')
-    client.click(link=u'x')
-    client.select(xpath=u'//select', index=u'1')
-    #client.execJQuery(jquery=u'("select").trigger(\'change\')') # BUGGY freeze UI..
-    client.execJS(js=u'$("select").trigger(\'change\')')
-    client.waits.sleep(milliseconds=u'2000')
-    client.select(jquery=u'(\'select:contains("Search")\')[0]', option=u'Search for folder')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.click(link=u'folder1')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.waits.forElement(timeout=u'8000', value=u'button_ok')
-    client.click(value=u'button_ok')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.asserts.assertText(xpath=u'//h1', validator=u'subfolder2')
-    client.waits.forElement(link=u'folder_plural', timeout=u'8000')
-    client.click(link=u'folder_plural')
-    client.waits.forPageLoad(timeout=u'20000')
-    client.asserts.assertText(jquery=u"('#contentmain div a')[0]", validator=u'folder1')
-    client.asserts.assertText(jquery=u"('#contentmain div a')[1]", validator=u'folder2')
-    client.asserts.assertText(jquery=u"('#contentmain div a')[2]", validator=u'subfolder1')
-    client.asserts.assertText(jquery=u"('#contentmain div a')[3]", validator=u'subfolder2')
-    client.click(link=u'subfolder2')
-    client.click(link=u'modify')
-    client.click(link=u'folder1')