|
1 # copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
|
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
|
3 # |
|
4 # This file is part of CubicWeb. |
|
5 # |
|
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
|
7 # terms of the GNU Lesser General Public License as published by the Free |
|
8 # Software Foundation, either version 2.1 of the License, or (at your option) |
|
9 # any later version. |
|
10 # |
|
11 # CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
|
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
|
14 # details. |
|
15 # |
|
16 # You should have received a copy of the GNU Lesser General Public License along |
|
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
|
18 """cubicweb.server.hooks.syncschema unit and functional tests""" |
|
19 |
|
20 from logilab.common.testlib import unittest_main |
|
21 |
|
22 from yams.constraints import BoundaryConstraint |
|
23 from cubicweb import ValidationError, Binary |
|
24 from cubicweb.schema import META_RTYPES |
|
25 from cubicweb.devtools import startpgcluster, stoppgcluster, PostgresApptestConfiguration |
|
26 from cubicweb.devtools.testlib import CubicWebTC |
|
27 from cubicweb.server.sqlutils import SQL_PREFIX |
|
28 from cubicweb.devtools.repotest import schema_eids_idx |
|
29 |
|
30 |
|
31 def setUpModule(): |
|
32 startpgcluster(__file__) |
|
33 |
|
34 |
|
35 def tearDownModule(*args): |
|
36 stoppgcluster(__file__) |
|
37 del SchemaModificationHooksTC.schema_eids |
|
38 |
|
39 |
|
40 class SchemaModificationHooksTC(CubicWebTC): |
|
41 configcls = PostgresApptestConfiguration |
|
42 |
|
43 def setUp(self): |
|
44 super(SchemaModificationHooksTC, self).setUp() |
|
45 self.repo.set_schema(self.repo.deserialize_schema(), resetvreg=False) |
|
46 self.__class__.schema_eids = schema_eids_idx(self.repo.schema) |
|
47 |
|
48 def index_exists(self, cnx, etype, attr, unique=False): |
|
49 dbhelper = self.repo.system_source.dbhelper |
|
50 sqlcursor = cnx.cnxset.cu |
|
51 return dbhelper.index_exists(sqlcursor, |
|
52 SQL_PREFIX + etype, |
|
53 SQL_PREFIX + attr, |
|
54 unique=unique) |
|
55 |
|
56 def _set_perms(self, cnx, eid): |
|
57 cnx.execute('SET X read_permission G WHERE X eid %(x)s, G is CWGroup', |
|
58 {'x': eid}) |
|
59 cnx.execute('SET X add_permission G WHERE X eid %(x)s, G is CWGroup, ' |
|
60 'G name "managers"', {'x': eid}) |
|
61 cnx.execute('SET X delete_permission G WHERE X eid %(x)s, G is CWGroup, ' |
|
62 'G name "owners"', {'x': eid}) |
|
63 |
|
64 def _set_attr_perms(self, cnx, eid): |
|
65 cnx.execute('SET X read_permission G WHERE X eid %(x)s, G is CWGroup', |
|
66 {'x': eid}) |
|
67 cnx.execute('SET X update_permission G WHERE X eid %(x)s, G is CWGroup, G name "managers"', |
|
68 {'x': eid}) |
|
69 |
|
70 def test_base(self): |
|
71 with self.admin_access.repo_cnx() as cnx: |
|
72 schema = self.repo.schema |
|
73 self.assertFalse(schema.has_entity('Societe2')) |
|
74 self.assertFalse(schema.has_entity('concerne2')) |
|
75 # schema should be update on insertion (after commit) |
|
76 eeid = cnx.execute('INSERT CWEType X: X name "Societe2", ' |
|
77 'X description "", X final FALSE')[0][0] |
|
78 self._set_perms(cnx, eeid) |
|
79 cnx.execute('INSERT CWRType X: X name "concerne2", X description "", ' |
|
80 'X final FALSE, X symmetric FALSE') |
|
81 self.assertFalse(schema.has_entity('Societe2')) |
|
82 self.assertFalse(schema.has_entity('concerne2')) |
|
83 # have to commit before adding definition relations |
|
84 cnx.commit() |
|
85 self.assertTrue(schema.has_entity('Societe2')) |
|
86 self.assertTrue(schema.has_relation('concerne2')) |
|
87 attreid = cnx.execute('INSERT CWAttribute X: X cardinality "11", ' |
|
88 'X defaultval %(default)s, X indexed TRUE, ' |
|
89 'X relation_type RT, X from_entity E, X to_entity F ' |
|
90 'WHERE RT name "name", E name "Societe2", ' |
|
91 'F name "String"', |
|
92 {'default': Binary.zpickle('noname')})[0][0] |
|
93 self._set_attr_perms(cnx, attreid) |
|
94 concerne2_rdef_eid = cnx.execute( |
|
95 'INSERT CWRelation X: X cardinality "**", X relation_type RT, ' |
|
96 'X from_entity E, X to_entity E ' |
|
97 'WHERE RT name "concerne2", E name "Societe2"')[0][0] |
|
98 self._set_perms(cnx, concerne2_rdef_eid) |
|
99 self.assertNotIn('name', schema['Societe2'].subject_relations()) |
|
100 self.assertNotIn('concerne2', schema['Societe2'].subject_relations()) |
|
101 self.assertFalse(self.index_exists(cnx, 'Societe2', 'name')) |
|
102 cnx.commit() |
|
103 self.assertIn('name', schema['Societe2'].subject_relations()) |
|
104 self.assertIn('concerne2', schema['Societe2'].subject_relations()) |
|
105 self.assertTrue(self.index_exists(cnx, 'Societe2', 'name')) |
|
106 # now we should be able to insert and query Societe2 |
|
107 s2eid = cnx.execute('INSERT Societe2 X: X name "logilab"')[0][0] |
|
108 cnx.execute('Societe2 X WHERE X name "logilab"') |
|
109 cnx.execute('SET X concerne2 X WHERE X name "logilab"') |
|
110 rset = cnx.execute('Any X WHERE X concerne2 Y') |
|
111 self.assertEqual(rset.rows, [[s2eid]]) |
|
112 # check that when a relation definition is deleted, existing relations are deleted |
|
113 rdefeid = cnx.execute('INSERT CWRelation X: X cardinality "**", X relation_type RT, ' |
|
114 ' X from_entity E, X to_entity E ' |
|
115 'WHERE RT name "concerne2", E name "CWUser"')[0][0] |
|
116 self._set_perms(cnx, rdefeid) |
|
117 cnx.commit() |
|
118 cnx.execute('DELETE CWRelation X WHERE X eid %(x)s', {'x': concerne2_rdef_eid}) |
|
119 cnx.commit() |
|
120 self.assertIn('concerne2', schema['CWUser'].subject_relations()) |
|
121 self.assertNotIn('concerne2', schema['Societe2'].subject_relations()) |
|
122 self.assertFalse(cnx.execute('Any X WHERE X concerne2 Y')) |
|
123 # schema should be cleaned on delete (after commit) |
|
124 cnx.execute('DELETE CWEType X WHERE X name "Societe2"') |
|
125 cnx.execute('DELETE CWRType X WHERE X name "concerne2"') |
|
126 self.assertTrue(self.index_exists(cnx, 'Societe2', 'name')) |
|
127 self.assertTrue(schema.has_entity('Societe2')) |
|
128 self.assertTrue(schema.has_relation('concerne2')) |
|
129 cnx.commit() |
|
130 self.assertFalse(self.index_exists(cnx, 'Societe2', 'name')) |
|
131 self.assertFalse(schema.has_entity('Societe2')) |
|
132 self.assertFalse(schema.has_entity('concerne2')) |
|
133 self.assertNotIn('concerne2', schema['CWUser'].subject_relations()) |
|
134 |
|
135 def test_metartype_with_nordefs(self): |
|
136 with self.admin_access.repo_cnx() as cnx: |
|
137 META_RTYPES.add('custom_meta') |
|
138 cnx.execute('INSERT CWRType X: X name "custom_meta", X description "", ' |
|
139 'X final FALSE, X symmetric FALSE') |
|
140 cnx.commit() |
|
141 eeid = cnx.execute('INSERT CWEType X: X name "NEWEtype", ' |
|
142 'X description "", X final FALSE')[0][0] |
|
143 self._set_perms(cnx, eeid) |
|
144 cnx.commit() |
|
145 META_RTYPES.remove('custom_meta') |
|
146 |
|
147 def test_metartype_with_somerdefs(self): |
|
148 with self.admin_access.repo_cnx() as cnx: |
|
149 META_RTYPES.add('custom_meta') |
|
150 cnx.execute('INSERT CWRType X: X name "custom_meta", X description "", ' |
|
151 'X final FALSE, X symmetric FALSE') |
|
152 cnx.commit() |
|
153 rdefeid = cnx.execute('INSERT CWRelation X: X cardinality "**", X relation_type RT, ' |
|
154 ' X from_entity E, X to_entity E ' |
|
155 'WHERE RT name "custom_meta", E name "CWUser"')[0][0] |
|
156 self._set_perms(cnx, rdefeid) |
|
157 cnx.commit() |
|
158 eeid = cnx.execute('INSERT CWEType X: X name "NEWEtype", ' |
|
159 'X description "", X final FALSE')[0][0] |
|
160 self._set_perms(cnx, eeid) |
|
161 cnx.commit() |
|
162 META_RTYPES.remove('custom_meta') |
|
163 |
|
164 def test_is_instance_of_insertions(self): |
|
165 with self.admin_access.repo_cnx() as cnx: |
|
166 seid = cnx.execute('INSERT Transition T: T name "subdiv"')[0][0] |
|
167 is_etypes = [etype for etype, in cnx.execute('Any ETN WHERE X eid %s, ' |
|
168 'X is ET, ET name ETN' % seid)] |
|
169 self.assertEqual(is_etypes, ['Transition']) |
|
170 instanceof_etypes = [etype |
|
171 for etype, in cnx.execute('Any ETN WHERE X eid %s, ' |
|
172 'X is_instance_of ET, ET name ETN' |
|
173 % seid)] |
|
174 self.assertEqual(sorted(instanceof_etypes), ['BaseTransition', 'Transition']) |
|
175 snames = [name for name, in cnx.execute('Any N WHERE S is BaseTransition, S name N')] |
|
176 self.assertNotIn('subdiv', snames) |
|
177 snames = [name for name, in cnx.execute('Any N WHERE S is_instance_of BaseTransition, ' |
|
178 'S name N')] |
|
179 self.assertIn('subdiv', snames) |
|
180 |
|
181 |
|
182 def test_perms_synchronization_1(self): |
|
183 with self.admin_access.repo_cnx() as cnx: |
|
184 schema = self.repo.schema |
|
185 self.assertEqual(schema['CWUser'].get_groups('read'), set(('managers', 'users'))) |
|
186 self.assertTrue(cnx.execute('Any X, Y WHERE X is CWEType, X name "CWUser", ' |
|
187 'Y is CWGroup, Y name "users"')[0]) |
|
188 cnx.execute('DELETE X read_permission Y WHERE X is CWEType, X name "CWUser", Y name "users"') |
|
189 self.assertEqual(schema['CWUser'].get_groups('read'), set(('managers', 'users', ))) |
|
190 cnx.commit() |
|
191 self.assertEqual(schema['CWUser'].get_groups('read'), set(('managers',))) |
|
192 cnx.execute('SET X read_permission Y WHERE X is CWEType, ' |
|
193 'X name "CWUser", Y name "users"') |
|
194 cnx.commit() |
|
195 self.assertEqual(schema['CWUser'].get_groups('read'), |
|
196 set(('managers', 'users',))) |
|
197 |
|
198 def test_perms_synchronization_2(self): |
|
199 with self.admin_access.repo_cnx() as cnx: |
|
200 schema = self.repo.schema['in_group'].rdefs[('CWUser', 'CWGroup')] |
|
201 self.assertEqual(schema.get_groups('read'), |
|
202 set(('managers', 'users', 'guests'))) |
|
203 cnx.execute('DELETE X read_permission Y WHERE X relation_type RT, ' |
|
204 'RT name "in_group", Y name "guests"') |
|
205 self.assertEqual(schema.get_groups('read'), |
|
206 set(('managers', 'users', 'guests'))) |
|
207 cnx.commit() |
|
208 self.assertEqual(schema.get_groups('read'), |
|
209 set(('managers', 'users'))) |
|
210 cnx.execute('SET X read_permission Y WHERE X relation_type RT, ' |
|
211 'RT name "in_group", Y name "guests"') |
|
212 self.assertEqual(schema.get_groups('read'), |
|
213 set(('managers', 'users'))) |
|
214 cnx.commit() |
|
215 self.assertEqual(schema.get_groups('read'), |
|
216 set(('managers', 'users', 'guests'))) |
|
217 |
|
218 def test_nonregr_user_edit_itself(self): |
|
219 with self.admin_access.repo_cnx() as cnx: |
|
220 ueid = cnx.user.eid |
|
221 groupeids = [eid for eid, in cnx.execute('CWGroup G WHERE G name ' |
|
222 'in ("managers", "users")')] |
|
223 cnx.execute('DELETE X in_group Y WHERE X eid %s' % ueid) |
|
224 cnx.execute('SET X surname "toto" WHERE X eid %s' % ueid) |
|
225 cnx.execute('SET X in_group Y WHERE X eid %s, Y name "managers"' % ueid) |
|
226 cnx.commit() |
|
227 eeid = cnx.execute('Any X WHERE X is CWEType, X name "CWEType"')[0][0] |
|
228 cnx.execute('DELETE X read_permission Y WHERE X eid %s' % eeid) |
|
229 cnx.execute('SET X final FALSE WHERE X eid %s' % eeid) |
|
230 cnx.execute('SET X read_permission Y WHERE X eid %s, Y eid in (%s, %s)' |
|
231 % (eeid, groupeids[0], groupeids[1])) |
|
232 cnx.commit() |
|
233 cnx.execute('Any X WHERE X is CWEType, X name "CWEType"') |
|
234 |
|
235 # schema modification hooks tests ######################################### |
|
236 |
|
237 def test_uninline_relation(self): |
|
238 with self.admin_access.repo_cnx() as cnx: |
|
239 try: |
|
240 self.assertTrue(self.schema['state_of'].inlined) |
|
241 cnx.execute('SET X inlined FALSE WHERE X name "state_of"') |
|
242 self.assertTrue(self.schema['state_of'].inlined) |
|
243 cnx.commit() |
|
244 self.assertFalse(self.schema['state_of'].inlined) |
|
245 self.assertFalse(self.index_exists(cnx, 'State', 'state_of')) |
|
246 rset = cnx.execute('Any X, Y WHERE X state_of Y') |
|
247 self.assertEqual(len(rset), 2) # user states |
|
248 finally: |
|
249 cnx.execute('SET X inlined TRUE WHERE X name "state_of"') |
|
250 self.assertFalse(self.schema['state_of'].inlined) |
|
251 cnx.commit() |
|
252 self.assertTrue(self.schema['state_of'].inlined) |
|
253 self.assertTrue(self.index_exists(cnx, 'State', 'state_of')) |
|
254 rset = cnx.execute('Any X, Y WHERE X state_of Y') |
|
255 self.assertEqual(len(rset), 2) |
|
256 |
|
257 def test_indexed_change(self): |
|
258 with self.admin_access.repo_cnx() as cnx: |
|
259 try: |
|
260 cnx.execute('SET X indexed FALSE WHERE X relation_type R, R name "name"') |
|
261 self.assertTrue(self.schema['name'].rdef('Workflow', 'String').indexed) |
|
262 self.assertTrue(self.index_exists(cnx, 'Workflow', 'name')) |
|
263 cnx.commit() |
|
264 self.assertFalse(self.schema['name'].rdef('Workflow', 'String').indexed) |
|
265 self.assertFalse(self.index_exists(cnx, 'Workflow', 'name')) |
|
266 finally: |
|
267 cnx.execute('SET X indexed TRUE WHERE X relation_type R, R name "name"') |
|
268 self.assertFalse(self.schema['name'].rdef('Workflow', 'String').indexed) |
|
269 self.assertFalse(self.index_exists(cnx, 'Workflow', 'name')) |
|
270 cnx.commit() |
|
271 self.assertTrue(self.schema['name'].rdef('Workflow', 'String').indexed) |
|
272 self.assertTrue(self.index_exists(cnx, 'Workflow', 'name')) |
|
273 |
|
274 def test_unique_change(self): |
|
275 with self.admin_access.repo_cnx() as cnx: |
|
276 try: |
|
277 eid = cnx.execute('INSERT CWConstraint X: X cstrtype CT, DEF constrained_by X ' |
|
278 'WHERE CT name "UniqueConstraint", DEF relation_type RT, ' |
|
279 'DEF from_entity E, RT name "name", ' |
|
280 'E name "Workflow"').rows[0][0] |
|
281 self.assertFalse(self.schema['Workflow'].has_unique_values('name')) |
|
282 self.assertFalse(self.index_exists(cnx, 'Workflow', 'name', unique=True)) |
|
283 cnx.commit() |
|
284 self.assertTrue(self.schema['Workflow'].has_unique_values('name')) |
|
285 self.assertTrue(self.index_exists(cnx, 'Workflow', 'name', unique=True)) |
|
286 finally: |
|
287 cnx.execute('DELETE CWConstraint C WHERE C eid %(eid)s', {'eid': eid}) |
|
288 cnx.commit() |
|
289 self.assertFalse(self.schema['Workflow'].has_unique_values('name')) |
|
290 self.assertFalse(self.index_exists(cnx, 'Workflow', 'name', unique=True)) |
|
291 |
|
292 def test_required_change_1(self): |
|
293 with self.admin_access.repo_cnx() as cnx: |
|
294 cnx.execute('SET DEF cardinality "?1" ' |
|
295 'WHERE DEF relation_type RT, DEF from_entity E,' |
|
296 'RT name "title", E name "Bookmark"') |
|
297 cnx.commit() |
|
298 # should now be able to add bookmark without title |
|
299 cnx.execute('INSERT Bookmark X: X path "/view"') |
|
300 cnx.commit() |
|
301 |
|
302 def test_required_change_2(self): |
|
303 with self.admin_access.repo_cnx() as cnx: |
|
304 cnx.execute('SET DEF cardinality "11" ' |
|
305 'WHERE DEF relation_type RT, DEF from_entity E,' |
|
306 'RT name "surname", E name "CWUser"') |
|
307 cnx.execute('SET U surname "Doe" WHERE U surname NULL') |
|
308 cnx.commit() |
|
309 # should not be able anymore to add cwuser without surname |
|
310 self.assertRaises(ValidationError, self.create_user, cnx, "toto") |
|
311 cnx.rollback() |
|
312 cnx.execute('SET DEF cardinality "?1" ' |
|
313 'WHERE DEF relation_type RT, DEF from_entity E,' |
|
314 'RT name "surname", E name "CWUser"') |
|
315 cnx.commit() |
|
316 |
|
317 def test_add_attribute_to_base_class(self): |
|
318 with self.admin_access.repo_cnx() as cnx: |
|
319 attreid = cnx.execute('INSERT CWAttribute X: X cardinality "11", X defaultval %(default)s, ' |
|
320 'X indexed TRUE, X relation_type RT, X from_entity E, X to_entity F ' |
|
321 'WHERE RT name "messageid", E name "BaseTransition", F name "String"', |
|
322 {'default': Binary.zpickle('noname')})[0][0] |
|
323 assert cnx.execute('SET X read_permission Y WHERE X eid %(x)s, Y name "managers"', |
|
324 {'x': attreid}) |
|
325 cnx.commit() |
|
326 self.schema.rebuild_infered_relations() |
|
327 self.assertIn('Transition', self.schema['messageid'].subjects()) |
|
328 self.assertIn('WorkflowTransition', self.schema['messageid'].subjects()) |
|
329 cnx.execute('Any X WHERE X is_instance_of BaseTransition, X messageid "hop"') |
|
330 |
|
331 def test_change_fulltextindexed(self): |
|
332 with self.admin_access.repo_cnx() as cnx: |
|
333 target = cnx.create_entity(u'Email', messageid=u'1234', |
|
334 subject=u'rick.roll@dance.com') |
|
335 cnx.commit() |
|
336 rset = cnx.execute('Any X WHERE X has_text "rick.roll"') |
|
337 self.assertIn(target.eid, [item[0] for item in rset]) |
|
338 assert cnx.execute('SET A fulltextindexed FALSE ' |
|
339 'WHERE E is CWEType, E name "Email", A is CWAttribute,' |
|
340 'A from_entity E, A relation_type R, R name "subject"') |
|
341 cnx.commit() |
|
342 rset = cnx.execute('Any X WHERE X has_text "rick.roll"') |
|
343 self.assertFalse(rset) |
|
344 assert cnx.execute('SET A fulltextindexed TRUE ' |
|
345 'WHERE A from_entity E, A relation_type R, ' |
|
346 'E name "Email", R name "subject"') |
|
347 cnx.commit() |
|
348 rset = cnx.execute('Any X WHERE X has_text "rick.roll"') |
|
349 self.assertIn(target.eid, [item[0] for item in rset]) |
|
350 |
|
351 def test_change_fulltext_container(self): |
|
352 with self.admin_access.repo_cnx() as cnx: |
|
353 target = cnx.create_entity(u'EmailAddress', address=u'rick.roll@dance.com') |
|
354 target.cw_set(reverse_use_email=cnx.user) |
|
355 cnx.commit() |
|
356 rset = cnx.execute('Any X WHERE X has_text "rick.roll"') |
|
357 self.assertIn(cnx.user.eid, [item[0] for item in rset]) |
|
358 assert cnx.execute('SET R fulltext_container NULL ' |
|
359 'WHERE R name "use_email"') |
|
360 cnx.commit() |
|
361 rset = cnx.execute('Any X WHERE X has_text "rick.roll"') |
|
362 self.assertIn(target.eid, [item[0] for item in rset]) |
|
363 assert cnx.execute('SET R fulltext_container "subject" ' |
|
364 'WHERE R name "use_email"') |
|
365 cnx.commit() |
|
366 rset = cnx.execute('Any X WHERE X has_text "rick.roll"') |
|
367 self.assertIn(cnx.user.eid, [item[0] for item in rset]) |
|
368 |
|
369 def test_update_constraint(self): |
|
370 with self.admin_access.repo_cnx() as cnx: |
|
371 rdef = self.schema['Transition'].rdef('type') |
|
372 cstr = rdef.constraint_by_type('StaticVocabularyConstraint') |
|
373 if not getattr(cstr, 'eid', None): |
|
374 # bug in schema reloading, constraint's eid not restored |
|
375 self.skipTest('start me alone') |
|
376 cnx.execute('SET X value %(v)s WHERE X eid %(x)s', |
|
377 {'x': cstr.eid, 'v': u"u'normal', u'auto', u'new'"}) |
|
378 cnx.execute('INSERT CWConstraint X: X value %(value)s, X cstrtype CT, ' |
|
379 'EDEF constrained_by X WHERE CT name %(ct)s, EDEF eid %(x)s', |
|
380 {'ct': 'SizeConstraint', 'value': u'max=10', 'x': rdef.eid}) |
|
381 cnx.commit() |
|
382 cstr = rdef.constraint_by_type('StaticVocabularyConstraint') |
|
383 self.assertEqual(cstr.values, (u'normal', u'auto', u'new')) |
|
384 cnx.execute('INSERT Transition T: T name "hop", T type "new"') |
|
385 |
|
386 def test_add_constraint(self): |
|
387 with self.admin_access.repo_cnx() as cnx: |
|
388 rdef = self.schema['EmailPart'].rdef('ordernum') |
|
389 cstr = BoundaryConstraint('>=', 0) |
|
390 cnx.execute('INSERT CWConstraint X: X value %(v)s, X cstrtype CT, ' |
|
391 'EDEF constrained_by X WHERE CT name %(ct)s, EDEF eid %(x)s', |
|
392 {'ct': cstr.__class__.__name__, 'v': cstr.serialize(), 'x': rdef.eid}) |
|
393 cnx.commit() |
|
394 cstr2 = rdef.constraint_by_type('BoundaryConstraint') |
|
395 self.assertEqual(cstr, cstr2) |
|
396 cstr3 = BoundaryConstraint('<=', 1000) |
|
397 cnx.execute('INSERT CWConstraint X: X value %(v)s, X cstrtype CT, ' |
|
398 'EDEF constrained_by X WHERE CT name %(ct)s, EDEF eid %(x)s', |
|
399 {'ct': cstr3.__class__.__name__, 'v': cstr3.serialize(), 'x': rdef.eid}) |
|
400 cnx.commit() |
|
401 self.assertCountEqual(rdef.constraints, [cstr, cstr3]) |
|
402 |
|
403 |
|
404 if __name__ == '__main__': |
|
405 unittest_main() |