test/unittest_predicates.py
branchstable
changeset 9152 b0155bfd4e17
parent 8866 64f24ecad177
child 9582 46ed25d38fe2
equal deleted inserted replaced
9011:810a05fba1a4 9152:b0155bfd4e17
   201                                  'HAVING DAY(XD)=DAY(YD)').children[0]
   201                                  'HAVING DAY(XD)=DAY(YD)').children[0]
   202         score = selector(None, req, rset=1,
   202         score = selector(None, req, rset=1,
   203                          select=select, filtered_variable=select.defined_vars['X'])
   203                          select=select, filtered_variable=select.defined_vars['X'])
   204         self.assertEqual(score, 1)
   204         self.assertEqual(score, 1)
   205 
   205 
       
   206     def test_ambiguous(self):
       
   207         # Ambiguous relations are :
       
   208         # (Service, fabrique_par, Personne) and (Produit, fabrique_par, Usine)
       
   209         # There used to be a crash here with a bad rdef choice in the strict
       
   210         # checking case.
       
   211         selector = relation_possible('fabrique_par', role='object',
       
   212                                      target_etype='Personne', strict=True)
       
   213         req = self.request()
       
   214         usine = req.create_entity('Usine', lieu=u'here')
       
   215         score = selector(None, req, rset=usine.as_rset())
       
   216         self.assertEqual(0, score)
   206 
   217 
   207 class MatchUserGroupsTC(CubicWebTC):
   218 class MatchUserGroupsTC(CubicWebTC):
   208     def test_owners_group(self):
   219     def test_owners_group(self):
   209         """tests usage of 'owners' group with match_user_group"""
   220         """tests usage of 'owners' group with match_user_group"""
   210         class SomeAction(action.Action):
   221         class SomeAction(action.Action):