author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 15 Apr 2010 18:47:37 +0200 | |
changeset 5297 | cc747dcef851 |
parent 5174 | 78438ad513ca |
child 5423 | e15abfdcce38 |
permissions | -rw-r--r-- |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
1 |
from logilab.common.testlib import TestCase, unittest_main |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
2 |
|
4689
4eb1f4490538
[test] skipping versions checking during test is enough, no need for monkey patch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4681
diff
changeset
|
3 |
from cubicweb import ValidationError |
4eb1f4490538
[test] skipping versions checking during test is enough, no need for monkey patch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4681
diff
changeset
|
4 |
from cubicweb.devtools.testlib import CubicWebTC |
4eb1f4490538
[test] skipping versions checking during test is enough, no need for monkey patch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4681
diff
changeset
|
5 |
from cubicweb.server.sqlutils import SQL_PREFIX |
4766
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
6 |
from cubicweb.devtools.repotest import schema_eids_idx, restore_schema_eids_idx |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
7 |
|
4766
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
8 |
def teardown_module(*args): |
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
9 |
del SchemaModificationHooksTC.schema_eids |
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
10 |
|
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
11 |
class SchemaModificationHooksTC(CubicWebTC): |
4691
ae468fae9965
[test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4689
diff
changeset
|
12 |
reset_schema = True |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
13 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
14 |
@classmethod |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
15 |
def init_config(cls, config): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
16 |
super(SchemaModificationHooksTC, cls).init_config(config) |
4691
ae468fae9965
[test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4689
diff
changeset
|
17 |
# we have to read schema from the database to get eid for schema entities |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
18 |
config._cubes = None |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
19 |
cls.repo.fill_schema() |
4766
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
20 |
cls.schema_eids = schema_eids_idx(cls.repo.schema) |
4691
ae468fae9965
[test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4689
diff
changeset
|
21 |
|
ae468fae9965
[test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4689
diff
changeset
|
22 |
@classmethod |
ae468fae9965
[test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4689
diff
changeset
|
23 |
def _refresh_repo(cls): |
ae468fae9965
[test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4689
diff
changeset
|
24 |
super(SchemaModificationHooksTC, cls)._refresh_repo() |
4766
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
25 |
restore_schema_eids_idx(cls.repo.schema, cls.schema_eids) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
26 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
27 |
def index_exists(self, etype, attr, unique=False): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
28 |
self.session.set_pool() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
29 |
dbhelper = self.session.pool.source('system').dbhelper |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
30 |
sqlcursor = self.session.pool['system'] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
31 |
return dbhelper.index_exists(sqlcursor, SQL_PREFIX + etype, SQL_PREFIX + attr, unique=unique) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
32 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
33 |
def _set_perms(self, eid): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
34 |
self.execute('SET X read_permission G WHERE X eid %(x)s, G is CWGroup', |
5174
78438ad513ca
#759035: Automate addition of eid cachekey in RQL analysis
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4984
diff
changeset
|
35 |
{'x': eid}) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
36 |
self.execute('SET X add_permission G WHERE X eid %(x)s, G is CWGroup, G name "managers"', |
5174
78438ad513ca
#759035: Automate addition of eid cachekey in RQL analysis
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4984
diff
changeset
|
37 |
{'x': eid}) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
38 |
self.execute('SET X delete_permission G WHERE X eid %(x)s, G is CWGroup, G name "owners"', |
5174
78438ad513ca
#759035: Automate addition of eid cachekey in RQL analysis
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4984
diff
changeset
|
39 |
{'x': eid}) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
40 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
41 |
def _set_attr_perms(self, eid): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
42 |
self.execute('SET X read_permission G WHERE X eid %(x)s, G is CWGroup', |
5174
78438ad513ca
#759035: Automate addition of eid cachekey in RQL analysis
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4984
diff
changeset
|
43 |
{'x': eid}) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
44 |
self.execute('SET X update_permission G WHERE X eid %(x)s, G is CWGroup, G name "managers"', |
5174
78438ad513ca
#759035: Automate addition of eid cachekey in RQL analysis
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4984
diff
changeset
|
45 |
{'x': eid}) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
46 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
47 |
def test_base(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
48 |
schema = self.repo.schema |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
49 |
self.session.set_pool() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
50 |
dbhelper = self.session.pool.source('system').dbhelper |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
51 |
sqlcursor = self.session.pool['system'] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
52 |
self.failIf(schema.has_entity('Societe2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
53 |
self.failIf(schema.has_entity('concerne2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
54 |
# schema should be update on insertion (after commit) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
55 |
eeid = self.execute('INSERT CWEType X: X name "Societe2", X description "", X final FALSE')[0][0] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
56 |
self._set_perms(eeid) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
57 |
self.execute('INSERT CWRType X: X name "concerne2", X description "", X final FALSE, X symmetric FALSE') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
58 |
self.failIf(schema.has_entity('Societe2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
59 |
self.failIf(schema.has_entity('concerne2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
60 |
# have to commit before adding definition relations |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
61 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
62 |
self.failUnless(schema.has_entity('Societe2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
63 |
self.failUnless(schema.has_relation('concerne2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
64 |
attreid = self.execute('INSERT CWAttribute X: X cardinality "11", X defaultval "noname", ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
65 |
' X indexed TRUE, X relation_type RT, X from_entity E, X to_entity F ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
66 |
'WHERE RT name "name", E name "Societe2", F name "String"')[0][0] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
67 |
self._set_attr_perms(attreid) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
68 |
concerne2_rdef_eid = self.execute( |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
69 |
'INSERT CWRelation X: X cardinality "**", X relation_type RT, X from_entity E, X to_entity E ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
70 |
'WHERE RT name "concerne2", E name "Societe2"')[0][0] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
71 |
self._set_perms(concerne2_rdef_eid) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
72 |
self.failIf('name' in schema['Societe2'].subject_relations()) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
73 |
self.failIf('concerne2' in schema['Societe2'].subject_relations()) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
74 |
self.failIf(self.index_exists('Societe2', 'name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
75 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
76 |
self.failUnless('name' in schema['Societe2'].subject_relations()) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
77 |
self.failUnless('concerne2' in schema['Societe2'].subject_relations()) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
78 |
self.failUnless(self.index_exists('Societe2', 'name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
79 |
# now we should be able to insert and query Societe2 |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
80 |
s2eid = self.execute('INSERT Societe2 X: X name "logilab"')[0][0] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
81 |
self.execute('Societe2 X WHERE X name "logilab"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
82 |
self.execute('SET X concerne2 X WHERE X name "logilab"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
83 |
rset = self.execute('Any X WHERE X concerne2 Y') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
84 |
self.assertEquals(rset.rows, [[s2eid]]) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
85 |
# check that when a relation definition is deleted, existing relations are deleted |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
86 |
rdefeid = self.execute('INSERT CWRelation X: X cardinality "**", X relation_type RT, ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
87 |
' X from_entity E, X to_entity E ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
88 |
'WHERE RT name "concerne2", E name "CWUser"')[0][0] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
89 |
self._set_perms(rdefeid) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
90 |
self.commit() |
5174
78438ad513ca
#759035: Automate addition of eid cachekey in RQL analysis
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4984
diff
changeset
|
91 |
self.execute('DELETE CWRelation X WHERE X eid %(x)s', {'x': concerne2_rdef_eid}) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
92 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
93 |
self.failUnless('concerne2' in schema['CWUser'].subject_relations()) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
94 |
self.failIf('concerne2' in schema['Societe2'].subject_relations()) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
95 |
self.failIf(self.execute('Any X WHERE X concerne2 Y')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
96 |
# schema should be cleaned on delete (after commit) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
97 |
self.execute('DELETE CWEType X WHERE X name "Societe2"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
98 |
self.execute('DELETE CWRType X WHERE X name "concerne2"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
99 |
self.failUnless(self.index_exists('Societe2', 'name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
100 |
self.failUnless(schema.has_entity('Societe2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
101 |
self.failUnless(schema.has_relation('concerne2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
102 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
103 |
self.failIf(self.index_exists('Societe2', 'name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
104 |
self.failIf(schema.has_entity('Societe2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
105 |
self.failIf(schema.has_entity('concerne2')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
106 |
self.failIf('concerne2' in schema['CWUser'].subject_relations()) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
107 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
108 |
def test_is_instance_of_insertions(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
109 |
seid = self.execute('INSERT Transition T: T name "subdiv"')[0][0] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
110 |
is_etypes = [etype for etype, in self.execute('Any ETN WHERE X eid %s, X is ET, ET name ETN' % seid)] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
111 |
self.assertEquals(is_etypes, ['Transition']) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
112 |
instanceof_etypes = [etype for etype, in self.execute('Any ETN WHERE X eid %s, X is_instance_of ET, ET name ETN' % seid)] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
113 |
self.assertEquals(sorted(instanceof_etypes), ['BaseTransition', 'Transition']) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
114 |
snames = [name for name, in self.execute('Any N WHERE S is BaseTransition, S name N')] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
115 |
self.failIf('subdiv' in snames) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
116 |
snames = [name for name, in self.execute('Any N WHERE S is_instance_of BaseTransition, S name N')] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
117 |
self.failUnless('subdiv' in snames) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
118 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
119 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
120 |
def test_perms_synchronization_1(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
121 |
schema = self.repo.schema |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
122 |
self.assertEquals(schema['CWUser'].get_groups('read'), set(('managers', 'users'))) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
123 |
self.failUnless(self.execute('Any X, Y WHERE X is CWEType, X name "CWUser", Y is CWGroup, Y name "users"')[0]) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
124 |
self.execute('DELETE X read_permission Y WHERE X is CWEType, X name "CWUser", Y name "users"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
125 |
self.assertEquals(schema['CWUser'].get_groups('read'), set(('managers', 'users', ))) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
126 |
self.commit() |
4681
5f72584ab1d7
[test] cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4667
diff
changeset
|
127 |
self.assertEquals(schema['CWUser'].get_groups('read'), set(('managers',))) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
128 |
self.execute('SET X read_permission Y WHERE X is CWEType, X name "CWUser", Y name "users"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
129 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
130 |
self.assertEquals(schema['CWUser'].get_groups('read'), set(('managers', 'users',))) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
131 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
132 |
def test_perms_synchronization_2(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
133 |
schema = self.repo.schema['in_group'].rdefs[('CWUser', 'CWGroup')] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
134 |
self.assertEquals(schema.get_groups('read'), set(('managers', 'users', 'guests'))) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
135 |
self.execute('DELETE X read_permission Y WHERE X relation_type RT, RT name "in_group", Y name "guests"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
136 |
self.assertEquals(schema.get_groups('read'), set(('managers', 'users', 'guests'))) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
137 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
138 |
self.assertEquals(schema.get_groups('read'), set(('managers', 'users'))) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
139 |
self.execute('SET X read_permission Y WHERE X relation_type RT, RT name "in_group", Y name "guests"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
140 |
self.assertEquals(schema.get_groups('read'), set(('managers', 'users'))) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
141 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
142 |
self.assertEquals(schema.get_groups('read'), set(('managers', 'users', 'guests'))) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
143 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
144 |
def test_nonregr_user_edit_itself(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
145 |
ueid = self.session.user.eid |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
146 |
groupeids = [eid for eid, in self.execute('CWGroup G WHERE G name in ("managers", "users")')] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
147 |
self.execute('DELETE X in_group Y WHERE X eid %s' % ueid) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
148 |
self.execute('SET X surname "toto" WHERE X eid %s' % ueid) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
149 |
self.execute('SET X in_group Y WHERE X eid %s, Y name "managers"' % ueid) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
150 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
151 |
eeid = self.execute('Any X WHERE X is CWEType, X name "CWEType"')[0][0] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
152 |
self.execute('DELETE X read_permission Y WHERE X eid %s' % eeid) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
153 |
self.execute('SET X final FALSE WHERE X eid %s' % eeid) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
154 |
self.execute('SET X read_permission Y WHERE X eid %s, Y eid in (%s, %s)' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
155 |
% (eeid, groupeids[0], groupeids[1])) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
156 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
157 |
self.execute('Any X WHERE X is CWEType, X name "CWEType"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
158 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
159 |
# schema modification hooks tests ######################################### |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
160 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
161 |
def test_uninline_relation(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
162 |
self.session.set_pool() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
163 |
dbhelper = self.session.pool.source('system').dbhelper |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
164 |
sqlcursor = self.session.pool['system'] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
165 |
self.failUnless(self.schema['state_of'].inlined) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
166 |
try: |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
167 |
self.execute('SET X inlined FALSE WHERE X name "state_of"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
168 |
self.failUnless(self.schema['state_of'].inlined) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
169 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
170 |
self.failIf(self.schema['state_of'].inlined) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
171 |
self.failIf(self.index_exists('State', 'state_of')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
172 |
rset = self.execute('Any X, Y WHERE X state_of Y') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
173 |
self.assertEquals(len(rset), 2) # user states |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
174 |
finally: |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
175 |
self.execute('SET X inlined TRUE WHERE X name "state_of"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
176 |
self.failIf(self.schema['state_of'].inlined) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
177 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
178 |
self.failUnless(self.schema['state_of'].inlined) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
179 |
self.failUnless(self.index_exists('State', 'state_of')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
180 |
rset = self.execute('Any X, Y WHERE X state_of Y') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
181 |
self.assertEquals(len(rset), 2) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
182 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
183 |
def test_indexed_change(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
184 |
self.session.set_pool() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
185 |
dbhelper = self.session.pool.source('system').dbhelper |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
186 |
sqlcursor = self.session.pool['system'] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
187 |
try: |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
188 |
self.execute('SET X indexed FALSE WHERE X relation_type R, R name "name"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
189 |
self.failUnless(self.schema['name'].rdef('Workflow', 'String').indexed) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
190 |
self.failUnless(self.index_exists('Workflow', 'name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
191 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
192 |
self.failIf(self.schema['name'].rdef('Workflow', 'String').indexed) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
193 |
self.failIf(self.index_exists('Workflow', 'name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
194 |
finally: |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
195 |
self.execute('SET X indexed TRUE WHERE X relation_type R, R name "name"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
196 |
self.failIf(self.schema['name'].rdef('Workflow', 'String').indexed) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
197 |
self.failIf(self.index_exists('Workflow', 'name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
198 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
199 |
self.failUnless(self.schema['name'].rdef('Workflow', 'String').indexed) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
200 |
self.failUnless(self.index_exists('Workflow', 'name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
201 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
202 |
def test_unique_change(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
203 |
self.session.set_pool() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
204 |
dbhelper = self.session.pool.source('system').dbhelper |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
205 |
sqlcursor = self.session.pool['system'] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
206 |
try: |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
207 |
self.execute('INSERT CWConstraint X: X cstrtype CT, DEF constrained_by X ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
208 |
'WHERE CT name "UniqueConstraint", DEF relation_type RT, DEF from_entity E,' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
209 |
'RT name "name", E name "Workflow"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
210 |
self.failIf(self.schema['Workflow'].has_unique_values('name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
211 |
self.failIf(self.index_exists('Workflow', 'name', unique=True)) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
212 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
213 |
self.failUnless(self.schema['Workflow'].has_unique_values('name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
214 |
self.failUnless(self.index_exists('Workflow', 'name', unique=True)) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
215 |
finally: |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
216 |
self.execute('DELETE DEF constrained_by X WHERE X cstrtype CT, ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
217 |
'CT name "UniqueConstraint", DEF relation_type RT, DEF from_entity E,' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
218 |
'RT name "name", E name "Workflow"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
219 |
self.failUnless(self.schema['Workflow'].has_unique_values('name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
220 |
self.failUnless(self.index_exists('Workflow', 'name', unique=True)) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
221 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
222 |
self.failIf(self.schema['Workflow'].has_unique_values('name')) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
223 |
self.failIf(self.index_exists('Workflow', 'name', unique=True)) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
224 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
225 |
def test_required_change_1(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
226 |
self.execute('SET DEF cardinality "?1" ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
227 |
'WHERE DEF relation_type RT, DEF from_entity E,' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
228 |
'RT name "title", E name "Bookmark"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
229 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
230 |
# should now be able to add bookmark without title |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
231 |
self.execute('INSERT Bookmark X: X path "/view"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
232 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
233 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
234 |
def test_required_change_2(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
235 |
self.execute('SET DEF cardinality "11" ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
236 |
'WHERE DEF relation_type RT, DEF from_entity E,' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
237 |
'RT name "surname", E name "CWUser"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
238 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
239 |
# should not be able anymore to add cwuser without surname |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
240 |
self.assertRaises(ValidationError, self.create_user, "toto") |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
241 |
self.execute('SET DEF cardinality "?1" ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
242 |
'WHERE DEF relation_type RT, DEF from_entity E,' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
243 |
'RT name "surname", E name "CWUser"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
244 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
245 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
246 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
247 |
def test_add_attribute_to_base_class(self): |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
248 |
attreid = self.execute('INSERT CWAttribute X: X cardinality "11", X defaultval "noname", X indexed TRUE, X relation_type RT, X from_entity E, X to_entity F ' |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
249 |
'WHERE RT name "messageid", E name "BaseTransition", F name "String"')[0][0] |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
250 |
assert self.execute('SET X read_permission Y WHERE X eid %(x)s, Y name "managers"', |
5174
78438ad513ca
#759035: Automate addition of eid cachekey in RQL analysis
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4984
diff
changeset
|
251 |
{'x': attreid}) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
252 |
self.commit() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
253 |
self.schema.rebuild_infered_relations() |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
254 |
self.failUnless('Transition' in self.schema['messageid'].subjects()) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
255 |
self.failUnless('WorkflowTransition' in self.schema['messageid'].subjects()) |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
256 |
self.execute('Any X WHERE X is_instance_of BaseTransition, X messageid "hop"') |
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
257 |
|
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
258 |
def test_change_fulltextindexed(self): |
4826
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
259 |
req = self.request() |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
260 |
target = req.create_entity(u'Email', messageid=u'1234', |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
261 |
subject=u'rick.roll@dance.com') |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
262 |
self.commit() |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
263 |
rset = req.execute('Any X WHERE X has_text "rick.roll"') |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
264 |
self.assertIn(target.eid, [item[0] for item in rset]) |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
265 |
assert req.execute('SET A fulltextindexed FALSE ' |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
266 |
'WHERE E is CWEType, E name "Email", A is CWAttribute,' |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
267 |
'A from_entity E, A relation_type R, R name "subject"') |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
268 |
self.commit() |
4840 | 269 |
rset = req.execute('Any X WHERE X has_text "rick.roll"') |
4826
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
270 |
self.failIf(rset) |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
271 |
assert req.execute('SET A fulltextindexed TRUE ' |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
272 |
'WHERE A from_entity E, A relation_type R, ' |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
273 |
'E name "Email", R name "subject"') |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
274 |
self.commit() |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
275 |
rset = req.execute('Any X WHERE X has_text "rick.roll"') |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
276 |
self.assertIn(target.eid, [item[0] for item in rset]) |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
277 |
|
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
278 |
def test_change_fulltext_container(self): |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
279 |
req = self.request() |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
280 |
target = req.create_entity(u'EmailAddress', address=u'rick.roll@dance.com') |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
281 |
target.set_relations(reverse_use_email=req.user) |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
282 |
self.commit() |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
283 |
rset = req.execute('Any X WHERE X has_text "rick.roll"') |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
284 |
self.assertIn(req.user.eid, [item[0] for item in rset]) |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
285 |
assert self.execute('SET R fulltext_container NULL ' |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
286 |
'WHERE R name "use_email"') |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
287 |
self.commit() |
4840 | 288 |
rset = self.execute('Any X WHERE X has_text "rick.roll"') |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
289 |
self.assertIn(target.eid, [item[0] for item in rset]) |
4826
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
290 |
assert self.execute('SET R fulltext_container "subject" ' |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
291 |
'WHERE R name "use_email"') |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
292 |
self.commit() |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
293 |
rset = req.execute('Any X WHERE X has_text "rick.roll"') |
7eba168407c3
[schema hook] fulltext_container is a relation *type* property. Test and fix (+ more fti properties change testing)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4691
diff
changeset
|
294 |
self.assertIn(req.user.eid, [item[0] for item in rset]) |
4667
6c8eccb1b695
[fix] Apply fulltextindexed change in the actual index
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
295 |
|
4927
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
296 |
def test_update_constraint(self): |
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
297 |
rdef = self.schema['Transition'].rdef('type') |
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
298 |
cstr = rdef.constraint_by_type('StaticVocabularyConstraint') |
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
299 |
if not getattr(cstr, 'eid', None): |
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
300 |
self.skip('start me alone') # bug in schema reloading, constraint's eid not restored |
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
301 |
self.execute('SET X value %(v)s WHERE X eid %(x)s', |
5174
78438ad513ca
#759035: Automate addition of eid cachekey in RQL analysis
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4984
diff
changeset
|
302 |
{'x': cstr.eid, 'v': u"u'normal', u'auto', u'new'"}) |
4927
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
303 |
self.execute('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, EDEF constrained_by X ' |
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
304 |
'WHERE CT name %(ct)s, EDEF eid %(x)s', |
5174
78438ad513ca
#759035: Automate addition of eid cachekey in RQL analysis
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4984
diff
changeset
|
305 |
{'ct': 'SizeConstraint', 'value': u'max=10', 'x': rdef.eid}) |
4927
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
306 |
self.commit() |
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
307 |
cstr = rdef.constraint_by_type('StaticVocabularyConstraint') |
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
308 |
self.assertEquals(cstr.values, (u'normal', u'auto', u'new')) |
19fd1952ad63
[schema sync] test and fix bug when updating multiple constraint for the same rdef in the same transaction
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4840
diff
changeset
|
309 |
self.execute('INSERT Transition T: T name "hop", T type "new"') |
4968
79d80cfaab6f
missing unittest_main
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4927
diff
changeset
|
310 |
|
79d80cfaab6f
missing unittest_main
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4927
diff
changeset
|
311 |
if __name__ == '__main__': |
79d80cfaab6f
missing unittest_main
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4927
diff
changeset
|
312 |
unittest_main() |