111 self.assertEqual(rconcerne.get_groups('delete'), set(('managers',))) |
111 self.assertEqual(rconcerne.get_groups('delete'), set(('managers',))) |
112 self.assertEqual(rconcerne.get_groups('add'), set(('managers', ))) |
112 self.assertEqual(rconcerne.get_groups('add'), set(('managers', ))) |
113 rconcerne.set_groups('read', ('managers',)) |
113 rconcerne.set_groups('read', ('managers',)) |
114 self.assertEqual(rconcerne.get_groups('read'), set(('managers',))) |
114 self.assertEqual(rconcerne.get_groups('read'), set(('managers',))) |
115 self.assertEqual([str(e) for e in rconcerne.get_rqlexprs('add')], |
115 self.assertEqual([str(e) for e in rconcerne.get_rqlexprs('add')], |
116 ['Any S WHERE U has_update_permission S, S eid %(s)s, U eid %(u)s']) |
116 ['Any S,U WHERE U has_update_permission S, S eid %(s)s, U eid %(u)s']) |
117 |
117 |
118 def test_erqlexpression(self): |
118 def test_erqlexpression(self): |
119 self.assertRaises(RQLSyntaxError, ERQLExpression, '1') |
119 self.assertRaises(RQLSyntaxError, ERQLExpression, '1') |
120 expr = ERQLExpression('X travaille S, S owned_by U') |
120 expr = ERQLExpression('X travaille S, S owned_by U') |
121 self.assertEquals(str(expr), 'Any X WHERE X travaille S, S owned_by U, X eid %(x)s, U eid %(u)s') |
121 self.assertEquals(str(expr), 'Any X WHERE X travaille S, S owned_by U, X eid %(x)s, U eid %(u)s') |
122 |
122 |
123 def test_rrqlexpression(self): |
123 def test_rrqlexpression(self): |
124 self.assertRaises(Exception, RRQLExpression, '1') |
124 self.assertRaises(Exception, RRQLExpression, '1') |
125 self.assertRaises(RQLSyntaxError, RRQLExpression, 'O X Y') |
125 self.assertRaises(RQLSyntaxError, RRQLExpression, 'O X Y') |
126 expr = RRQLExpression('U has_update_permission O') |
126 expr = RRQLExpression('U has_update_permission O') |
127 self.assertEquals(str(expr), 'Any O WHERE U has_update_permission O, O eid %(o)s, U eid %(u)s') |
127 self.assertEquals(str(expr), 'Any O,U WHERE U has_update_permission O, O eid %(o)s, U eid %(u)s') |
128 |
128 |
129 loader = CubicWebSchemaLoader() |
129 loader = CubicWebSchemaLoader() |
130 config = TestConfiguration('data') |
130 config = TestConfiguration('data') |
131 config.bootstrap_cubes() |
131 config.bootstrap_cubes() |
132 |
132 |