test/unittest_rqlrewrite.py
branchstable
changeset 9170 e6fe77dbcfdf
parent 9168 0fb4b67bde58
child 9188 0677e03077fb
equal deleted inserted replaced
9169:544b22a3485b 9170:e6fe77dbcfdf
   329         self.assertEqual(rqlst.as_string(),
   329         self.assertEqual(rqlst.as_string(),
   330                          "Any EXIT WHERE C? subworkflow_exit EXIT, EXIT is SubWorkflowExitPoint, "
   330                          "Any EXIT WHERE C? subworkflow_exit EXIT, EXIT is SubWorkflowExitPoint, "
   331                          "EXISTS(A subworkflow_exit EXIT, A name 'hop', A is WorkflowTransition), "
   331                          "EXISTS(A subworkflow_exit EXIT, A name 'hop', A is WorkflowTransition), "
   332                          "C is WorkflowTransition")
   332                          "C is WorkflowTransition")
   333 
   333 
       
   334     def test_relation_non_optimization_2(self):
       
   335         """See #3024730"""
       
   336         # 'X inlined_note N' must not be shared with 'C inlined_note N'
       
   337         # previously inserted, else this may introduce duplicated results, as N
       
   338         # will then be shared by multiple EXISTS and so at SQL generation time,
       
   339         # the table will be in the FROM clause of the outermost query
       
   340         rqlst = parse('Any A,C WHERE A inlined_card C')
       
   341         rewrite(rqlst, {('A', 'X'): ('X inlined_card C, C inlined_note N, N owned_by U',),
       
   342                         ('C', 'X'): ('X inlined_note N, N owned_by U',)}, {})
       
   343         self.assertEqual(rqlst.as_string(),
       
   344                          'Any A,C WHERE A inlined_card C, D eid %(E)s, '
       
   345                          'EXISTS(C inlined_note B, B owned_by D, B is Note), '
       
   346                          'EXISTS(C inlined_note F, F owned_by D, F is Note), '
       
   347                          'A is Affaire, C is Card')
       
   348 
   334     def test_unsupported_constraint_1(self):
   349     def test_unsupported_constraint_1(self):
   335         # CWUser doesn't have require_permission
   350         # CWUser doesn't have require_permission
   336         trinfo_constraint = ('X wf_info_for Y, Y require_permission P, P name "read"')
   351         trinfo_constraint = ('X wf_info_for Y, Y require_permission P, P name "read"')
   337         rqlst = parse('Any U,T WHERE U is CWUser, T wf_info_for U')
   352         rqlst = parse('Any U,T WHERE U is CWUser, T wf_info_for U')
   338         self.assertRaises(Unauthorized, rewrite, rqlst, {('T', 'X'): (trinfo_constraint,)}, {})
   353         self.assertRaises(Unauthorized, rewrite, rqlst, {('T', 'X'): (trinfo_constraint,)}, {})