[test] fix broken tests and minor cleanups stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 23 Sep 2010 10:46:59 +0200
branchstable
changeset 6315 8ca3ee849bee
parent 6314 b233cc448bdd
child 6316 51aa84c40a71
[test] fix broken tests and minor cleanups
devtools/__init__.py
devtools/httptest.py
devtools/test/unittest_httptest.py
web/test/unittest_urlpublisher.py
web/test/unittest_views_editforms.py
--- a/devtools/__init__.py	Thu Sep 23 10:46:38 2010 +0200
+++ b/devtools/__init__.py	Thu Sep 23 10:46:59 2010 +0200
@@ -15,9 +15,8 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-"""Test tools for cubicweb
+"""Test tools for cubicweb"""
 
-"""
 __docformat__ = "restructuredtext en"
 
 import os
--- a/devtools/httptest.py	Thu Sep 23 10:46:38 2010 +0200
+++ b/devtools/httptest.py	Thu Sep 23 10:46:59 2010 +0200
@@ -141,6 +141,7 @@
                                 (user, passwd))
         assert response.status == httplib.SEE_OTHER, response.status
         self._ident_cookie = response.getheader('Set-Cookie')
+        assert self._ident_cookie
         return True
 
     def web_logout(self, user='admin', pwd=None):
--- a/devtools/test/unittest_httptest.py	Thu Sep 23 10:46:38 2010 +0200
+++ b/devtools/test/unittest_httptest.py	Thu Sep 23 10:46:59 2010 +0200
@@ -38,11 +38,11 @@
         # login
         self.web_login(self.admlogin, self.admpassword)
         response = self.web_get()
-        self.assertEquals(response.status, httplib.OK)
+        self.assertEquals(response.status, httplib.OK, response.body)
         # logout
         self.web_logout()
         response = self.web_get()
-        self.assertEquals(response.status, httplib.FORBIDDEN)
+        self.assertEquals(response.status, httplib.FORBIDDEN, response.body)
 
 
 
--- a/web/test/unittest_urlpublisher.py	Thu Sep 23 10:46:38 2010 +0200
+++ b/web/test/unittest_urlpublisher.py	Thu Sep 23 10:46:59 2010 +0200
@@ -16,9 +16,7 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-"""Unit tests for url publishing service
-
-"""
+"""Unit tests for url publishing service"""
 
 import re
 
@@ -69,29 +67,29 @@
         self.assertEquals(ctrl, 'view')
         self.assertEquals(len(rset), 1)
         self.assertEquals(rset.description[0][0], 'CWUser')
-        self.assertEquals(rset.printable_rql(), 'Any X WHERE X is CWUser, X login "admin"')
+        self.assertEquals(rset.printable_rql(), 'Any X,AA,AB,AC,AD WHERE X login "admin", X is CWUser, X login AA, X firstname AB, X surname AC, X modification_date AD')
         ctrl, rset = self.process('cwuser/admin')
         self.assertEquals(ctrl, 'view')
         self.assertEquals(len(rset), 1)
         self.assertEquals(rset.description[0][0], 'CWUser')
-        self.assertEquals(rset.printable_rql(), 'Any X WHERE X is CWUser, X login "admin"')
+        self.assertEquals(rset.printable_rql(), 'Any X,AA,AB,AC,AD WHERE X login "admin", X is CWUser, X login AA, X firstname AB, X surname AC, X modification_date AD')
         ctrl, rset = self.process('cwuser/eid/%s'%rset[0][0])
         self.assertEquals(ctrl, 'view')
         self.assertEquals(len(rset), 1)
         self.assertEquals(rset.description[0][0], 'CWUser')
-        self.assertEquals(rset.printable_rql(), 'Any X WHERE X is CWUser, X eid 5')
+        self.assertEquals(rset.printable_rql(), 'Any X,AA,AB,AC,AD WHERE X eid 5, X is CWUser, X login AA, X firstname AB, X surname AC, X modification_date AD')
         # test non-ascii paths
         ctrl, rset = self.process('CWUser/login/%C3%BFsa%C3%BFe')
         self.assertEquals(ctrl, 'view')
         self.assertEquals(len(rset), 1)
         self.assertEquals(rset.description[0][0], 'CWUser')
-        self.assertEquals(rset.printable_rql(), u'Any X WHERE X is CWUser, X login "ÿsaÿe"')
+        self.assertEquals(rset.printable_rql(), u'Any X,AA,AB,AC,AD WHERE X login "\xffsa\xffe", X is CWUser, X login AA, X firstname AB, X surname AC, X modification_date AD')
         # test quoted paths
         ctrl, rset = self.process('BlogEntry/title/hell%27o')
         self.assertEquals(ctrl, 'view')
         self.assertEquals(len(rset), 1)
         self.assertEquals(rset.description[0][0], 'BlogEntry')
-        self.assertEquals(rset.printable_rql(), u'Any X WHERE X is BlogEntry, X title "hell\'o"')
+        self.assertEquals(rset.printable_rql(), u'Any X,AA,AB,AC WHERE X title "hell\'o", X is BlogEntry, X creation_date AA, X title AB, X modification_date AC')
         # errors
         self.assertRaises(NotFound, self.process, 'CWUser/eid/30000')
         self.assertRaises(NotFound, self.process, 'Workcases')
--- a/web/test/unittest_views_editforms.py	Thu Sep 23 10:46:38 2010 +0200
+++ b/web/test/unittest_views_editforms.py	Thu Sep 23 10:46:59 2010 +0200
@@ -127,7 +127,8 @@
                                ])
         self.assertListEquals(rbc(e, 'main', 'relations'),
                               [('travaille', 'subject'),
-                               ('connait', 'object')
+                               ('manager', 'object'),
+                               ('connait', 'object'),
                                ])
         self.assertListEquals(rbc(e, 'main', 'hidden'),
                               [])