devtools/repotest.py
changeset 10821 107b87bbbaa7
parent 10804 ee113e1e03de
equal deleted inserted replaced
10820:fef0ab4c4f94 10821:107b87bbbaa7
    55             queries, equeries = step[1], expected[1]
    55             queries, equeries = step[1], expected[1]
    56             self.assertEqual(len(queries), len(equeries),
    56             self.assertEqual(len(queries), len(equeries),
    57                               'expected %s queries, got %s' % (len(equeries), len(queries)))
    57                               'expected %s queries, got %s' % (len(equeries), len(queries)))
    58             for i, (rql, sol) in enumerate(queries):
    58             for i, (rql, sol) in enumerate(queries):
    59                 self.assertEqual(rql, equeries[i][0])
    59                 self.assertEqual(rql, equeries[i][0])
    60                 self.assertEqual(sorted(sol), sorted(equeries[i][1]))
    60                 self.assertEqual(sorted(sorted(x.items()) for x in sol), sorted(sorted(x.items()) for x in equeries[i][1]))
    61             idx = 2
    61             idx = 2
    62         else:
    62         else:
    63             idx = 1
    63             idx = 1
    64         self.assertEqual(step[idx:-1], expected[idx:-1],
    64         self.assertEqual(step[idx:-1], expected[idx:-1],
    65                           'expected step characteristic \n%s\n, got\n%s' % (expected[1:-1], step[1:-1]))
    65                           'expected step characteristic \n%s\n, got\n%s' % (expected[1:-1], step[1:-1]))
   315 from cubicweb.server.querier import ExecutionPlan
   315 from cubicweb.server.querier import ExecutionPlan
   316 _orig_check_permissions = ExecutionPlan._check_permissions
   316 _orig_check_permissions = ExecutionPlan._check_permissions
   317 
   317 
   318 def _check_permissions(*args, **kwargs):
   318 def _check_permissions(*args, **kwargs):
   319     res, restricted = _orig_check_permissions(*args, **kwargs)
   319     res, restricted = _orig_check_permissions(*args, **kwargs)
   320     res = DumbOrderedDict(sorted(res.items(), key=lambda x: x[1]))
   320     res = DumbOrderedDict(sorted(res.items(), key=lambda x: [y.items() for y in x[1]]))
   321     return res, restricted
   321     return res, restricted
   322 
   322 
   323 def _dummy_check_permissions(self, rqlst):
   323 def _dummy_check_permissions(self, rqlst):
   324     return {(): rqlst.solutions}, set()
   324     return {(): rqlst.solutions}, set()
   325 
   325