--- a/web/test/unittest_views_basetemplates.py Wed Jun 02 12:59:13 2010 +0200
+++ b/web/test/unittest_views_basetemplates.py Wed Jun 02 12:59:37 2010 +0200
@@ -36,4 +36,5 @@
self.assertEquals(self._login_labels(), ['login', 'password'])
if __name__ == '__main__':
+ from logilab.common.testlib import unittest_main
unittest_main()
--- a/web/test/unittest_views_navigation.py Wed Jun 02 12:59:13 2010 +0200
+++ b/web/test/unittest_views_navigation.py Wed Jun 02 12:59:37 2010 +0200
@@ -15,14 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""cubicweb.web.views.navigation unit tests
-
-"""
+"""cubicweb.web.views.navigation unit tests"""
from logilab.common.testlib import unittest_main, mock_object
+
from cubicweb.devtools.testlib import CubicWebTC
-
-from cubicweb.web.views.navigation import PageNavigation, SortedNavigation
+from cubicweb.web.views.navigation import (PageNavigation, SortedNavigation,
+ PageNavigationSelect)
from cubicweb.web.views.ibreadcrumbs import BreadCrumbEntityVComponent
BreadCrumbEntityVComponent.visible = True
@@ -41,15 +40,24 @@
def test_navigation_selection_ordered(self):
req = self.request()
- rset = self.execute('Any X,N ORDERBY N WHERE X name N')
- navcomp = self.vreg['components'].select('navigation', req, rset=rset)
+ rset = self.execute('Any X,N ORDERBY N LIMIT 40 WHERE X name N')
+ navcomp = self.vreg['components'].select('navigation', req, rset=rset, page_size=20)
self.assertIsInstance(navcomp, SortedNavigation)
req.set_search_state('W:X:Y:Z')
- navcomp = self.vreg['components'].select('navigation', req, rset=rset)
+ navcomp = self.vreg['components'].select('navigation', req, rset=rset, page_size=20)
self.assertIsInstance(navcomp, SortedNavigation)
req.set_search_state('normal')
html = navcomp.render()
+ def test_navigation_selection_large_rset(self):
+ req = self.request()
+ rset = self.execute('Any X,N LIMIT 120 WHERE X name N')
+ navcomp = self.vreg['components'].select('navigation', req, rset=rset, page_size=20)
+ self.assertIsInstance(navcomp, PageNavigationSelect)
+ rset = self.execute('Any X,N ORDERBY N LIMIT 120 WHERE X name N')
+ navcomp = self.vreg['components'].select('navigation', req, rset=rset, page_size=20)
+ self.assertIsInstance(navcomp, PageNavigationSelect)
+
def test_navigation_selection_not_enough(self):
req = self.request()
rset = self.execute('Any X,N LIMIT 10 WHERE X name N')
--- a/web/test/unittest_views_searchrestriction.py Wed Jun 02 12:59:13 2010 +0200
+++ b/web/test/unittest_views_searchrestriction.py Wed Jun 02 12:59:37 2010 +0200
@@ -48,17 +48,17 @@
def test_1(self):
self.assertEquals(self._generate(self.select, 'in_state', 'subject', 'name'),
"DISTINCT Any A,C ORDERBY C WHERE B in_group P, P name 'managers', "
- "B in_state A, A name C, B is CWUser")
+ "B in_state A, B is CWUser, A name C")
def test_2(self):
self.assertEquals(self._generate(self.select, 'tags', 'object', 'name'),
"DISTINCT Any A,C ORDERBY C WHERE B in_group P, P name 'managers', "
- "A tags B, A name C, B is CWUser")
+ "A tags B, B is CWUser, A name C")
def test_3(self):
self.assertEquals(self._generate(self.select, 'created_by', 'subject', 'login'),
"DISTINCT Any A,C ORDERBY C WHERE B in_group P, P name 'managers', "
- "B created_by A, A login C, B is CWUser")
+ "B created_by A, B is CWUser, A login C")
def test_4(self):
self.assertEquals(self._generate(self.parse('Any X WHERE X is CWUser'), 'created_by', 'subject', 'login'),
@@ -73,7 +73,7 @@
'V in_state VS, VS name "published", T created_by U')
self.assertEquals(self._generate(select, 'created_by', 'subject', 'login'),
"DISTINCT Any A,B ORDERBY B WHERE T created_by U, "
- "T created_by A, A login B, T is Bookmark")
+ "T created_by A, T is Bookmark, A login B")
def test_nonregr2(self):
#'DISTINCT Any X,TMP,N WHERE P name TMP, X version_of P, P is Project, X is Version, not X in_state S,S name "published", X num N ORDERBY TMP,N'