[Cubicweb] qunit tests

David Douard david.douard at logilab.fr
Fri Mar 14 23:06:33 CET 2014

Hi list,

I've been digging a bit why the qunit (javascript) tests fails in cw for a while. And the answer seems to be: CORS! yup

So I've tried to patch a bit the $CW/devtools/qunit.py file with something like:

diff --git a/devtools/qunit.py b/devtools/qunit.py
--- a/devtools/qunit.py
+++ b/devtools/qunit.py
@@ -116,6 +116,8 @@
     def setUp(self):
         super(QUnitTestCase, self).setUp()
+        self.vreg.config['access-control-allow-origin'] = '*'
+        self.vreg.config['access-control-allow-methods'] = ['GET','POST']
         self.test_queue = Queue()
         class MyQUnitResultController(QUnitResultController):
             tc = self

I've done this on 3.17 (the branch I was on in my dev environment when I started this task, but it does not matter for this problem), in which I grafted the recently added patches to support CORS in CW (pushed this morning on 3.19 branch).

I've made progress doing so, but I'm stuck by a javascript code doing an ajax request, which is preflighed by firefox (a headless firefox is launched to run these javascript tests)... and doing an OPTIONS HTTP request on a URL like file://path/to/file.html does not works so well.

As a consequence, these tests should be more heavily modified to make use of the started CW server to serve each and every http or javascript file. This would also have the advantage of not requiring a temporary directory anymore for these tests. Not sure how to make this for now, but I may try to do so in the next few days. Stay tuned!



Directeur du département Outils & Systèmes

+33 1 45 32 03 12	 david.douard at logilab.fr
+33 1 83 64 25 26	 http://www.logilab.fr/id/david.douard

Formations - http://www.logilab.fr/formations
Développements - http://www.logilab.fr/services
Gestion de connaissances - http://www.cubicweb.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: david_douard.vcf
Type: text/x-vcard
Size: 302 bytes
Desc: not available
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20140314/32bf8f2d/attachment-0272.vcf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20140314/32bf8f2d/attachment-0270.sig>

More information about the Cubicweb mailing list