--- a/test/unittest_rqlrewrite.py Mon Sep 26 18:03:38 2011 +0200
+++ b/test/unittest_rqlrewrite.py Mon Sep 26 19:24:08 2011 +0200
@@ -21,9 +21,8 @@
from yams import BadSchemaDefinition
from rql import parse, nodes, RQLHelper
-from cubicweb import Unauthorized
+from cubicweb import Unauthorized, rqlrewrite
from cubicweb.schema import RRQLExpression, ERQLExpression
-from cubicweb.rqlrewrite import RQLRewriter
from cubicweb.devtools import repotest, TestServerConfiguration
@@ -62,9 +61,10 @@
@staticmethod
def simplify(mainrqlst, needcopy=False):
rqlhelper.simplify(rqlst, needcopy)
- rewriter = RQLRewriter(mock_object(vreg=FakeVReg, user=(mock_object(eid=1))))
+ rewriter = rqlrewrite.RQLRewriter(
+ mock_object(vreg=FakeVReg, user=(mock_object(eid=1))))
snippets = []
- for v, exprs in snippets_map.items():
+ for v, exprs in sorted(snippets_map.items()):
rqlexprs = [isinstance(snippet, basestring)
and mock_object(snippet_rqlst=parse('Any X WHERE '+snippet).children[0],
expression='Any X WHERE '+snippet)
@@ -210,11 +210,11 @@
}, {})
# XXX suboptimal
self.assertEqual(rqlst.as_string(),
- "Any C,A,R WITH A,R,C BEING "
- "(Any A,R,C WHERE A ref R, A? inlined_card C, "
- "(A is NULL) OR (EXISTS(A inlined_card B, B require_permission D, "
- "B is Card, D is CWPermission)), "
- "A is Affaire, C is Card, EXISTS(C require_permission E, E is CWPermission))")
+ "Any C,A,R WITH A,C,R BEING "
+ "(Any A,C,R WHERE A? inlined_card C, A ref R, "
+ "(A is NULL) OR (EXISTS(A inlined_card B, B require_permission D, "
+ "B is Card, D is CWPermission)), "
+ "A is Affaire, C is Card, EXISTS(C require_permission E, E is CWPermission))")
# def test_optional_var_inlined_has_perm(self):
# c1 = ('X require_permission P')