# HG changeset patch # User Sylvain Thénault # Date 1285231619 -7200 # Node ID 8ca3ee849bee8d8c57a693da9ed2c12db3361f5c # Parent b233cc448bdd2b8d50314a5e17aaae99102741dc [test] fix broken tests and minor cleanups diff -r b233cc448bdd -r 8ca3ee849bee devtools/__init__.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 . -"""Test tools for cubicweb +"""Test tools for cubicweb""" -""" __docformat__ = "restructuredtext en" import os diff -r b233cc448bdd -r 8ca3ee849bee devtools/httptest.py --- 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): diff -r b233cc448bdd -r 8ca3ee849bee devtools/test/unittest_httptest.py --- 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) diff -r b233cc448bdd -r 8ca3ee849bee web/test/unittest_urlpublisher.py --- 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 . -"""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') diff -r b233cc448bdd -r 8ca3ee849bee web/test/unittest_views_editforms.py --- 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'), [])