some test fixes tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 18 Feb 2009 10:27:09 +0100
branchtls-sprint
changeset 764 9de67b681624
parent 763 db18ecbed8f6
child 765 8fda14081686
some test fixes
selectors.py
web/test/unittest_viewselector.py
--- a/selectors.py	Wed Feb 18 10:22:08 2009 +0100
+++ b/selectors.py	Wed Feb 18 10:27:09 2009 +0100
@@ -770,7 +770,8 @@
         
     def score(self, req, rset, row, col):
         try:
-            return len(req.execute(self.rql, {'x': eid, 'u': req.user.eid}, 'x'))
+            return len(req.execute(self.rql, {'x': rset[row][col],
+                                              'u': req.user.eid}, 'x'))
         except Unauthorized:
             return 0
 
@@ -800,7 +801,8 @@
     :param scorefunc: callable expected to take an entity as argument and to
                       return a score >= 0 
     """
-    def __init__(self, scorefunc):
+    def __init__(self, scorefunc, once_is_enough=False):
+        super(EntitySelector, self).__init__(once_is_enough)
         self.score_entity = scorefunc
 
 
--- a/web/test/unittest_viewselector.py	Wed Feb 18 10:22:08 2009 +0100
+++ b/web/test/unittest_viewselector.py	Wed Feb 18 10:27:09 2009 +0100
@@ -411,7 +411,7 @@
         class SomeAction(Action):
             id = 'yo'
             category = 'foo'
-            __select__ = match_user_groups('owners'),
+            __select__ = match_user_groups('owners')
         self.vreg.register_vobject_class(SomeAction)
         self.failUnless(SomeAction in self.vreg['actions']['yo'], self.vreg['actions'])
         try:
@@ -436,7 +436,7 @@
 
 from cubicweb.web.action import Action
 
-class EETypeRQLAction(EntityAction):
+class EETypeRQLAction(Action):
     id = 'testaction'
     __select__ = implements('EEType') & rql_condition('X name "EEType"')
     title = 'bla'