60 self.assertRaises(ValidationError, |
60 self.assertRaises(ValidationError, |
61 self.commit) |
61 self.commit) |
62 |
62 |
63 def test_delete_if_singlecard1(self): |
63 def test_delete_if_singlecard1(self): |
64 self.assertEquals(self.repo.schema['in_state'].inlined, False) |
64 self.assertEquals(self.repo.schema['in_state'].inlined, False) |
65 ueid, = self.execute('INSERT CWUser X: X login "toto", X upassword "hop", X in_group Y, X in_state S ' |
65 ueid = self.create_user('toto') |
66 'WHERE Y name "users", S name "activated"')[0] |
|
67 self.commit() |
66 self.commit() |
68 self.execute('SET X in_state S WHERE S name "deactivated", X eid %(x)s', {'x': ueid}) |
67 self.execute('SET X in_state S WHERE S name "deactivated", X eid %(x)s', {'x': ueid}) |
69 rset = self.execute('Any S WHERE X in_state S, X eid %(x)s', {'x': ueid}) |
68 rset = self.execute('Any S WHERE X in_state S, X eid %(x)s', {'x': ueid}) |
70 self.assertEquals(len(rset), 1) |
69 self.assertEquals(len(rset), 1) |
|
70 self.commit() |
71 self.assertRaises(Exception, self.execute, 'SET X in_state S WHERE S name "deactivated", X eid %s' % ueid) |
71 self.assertRaises(Exception, self.execute, 'SET X in_state S WHERE S name "deactivated", X eid %s' % ueid) |
72 rset2 = self.execute('Any S WHERE X in_state S, X eid %(x)s', {'x': ueid}) |
72 rset2 = self.execute('Any S WHERE X in_state S, X eid %(x)s', {'x': ueid}) |
73 self.assertEquals(rset.rows, rset2.rows) |
73 self.assertEquals(rset.rows, rset2.rows) |
74 |
74 |
75 def test_inlined(self): |
75 def test_inlined(self): |
249 |
249 |
250 def setUp(self): |
250 def setUp(self): |
251 if not hasattr(self, '_repo'): |
251 if not hasattr(self, '_repo'): |
252 # first initialization |
252 # first initialization |
253 repo = self.repo # set by the RepositoryBasedTC metaclass |
253 repo = self.repo # set by the RepositoryBasedTC metaclass |
254 # force to read schema from the database |
254 # force to read schema from the database to get proper eid set on schema instances |
255 repo.config._cubes = None |
255 repo.config._cubes = None |
256 repo.fill_schema() |
256 repo.fill_schema() |
257 RepositoryBasedTC.setUp(self) |
257 RepositoryBasedTC.setUp(self) |
258 |
258 |
259 def index_exists(self, etype, attr, unique=False): |
259 def index_exists(self, etype, attr, unique=False): |