49 with self.admin_access.repo_cnx() as cnx: |
49 with self.admin_access.repo_cnx() as cnx: |
50 cnx.execute('INSERT Societe S: S nom "Logilab", S type "SSLL", S cp "75013"') |
50 cnx.execute('INSERT Societe S: S nom "Logilab", S type "SSLL", S cp "75013"') |
51 with self.assertRaises(ValidationError) as wraperr: |
51 with self.assertRaises(ValidationError) as wraperr: |
52 cnx.execute('INSERT Societe S: S nom "Logilab", S type "SSLL", S cp "75013"') |
52 cnx.execute('INSERT Societe S: S nom "Logilab", S type "SSLL", S cp "75013"') |
53 self.assertEqual( |
53 self.assertEqual( |
54 {'cp': u'cp is part of violated unicity constraint', |
54 {'cp': u'%(KEY-rtype)s is part of violated unicity constraint', |
55 'nom': u'nom is part of violated unicity constraint', |
55 'nom': u'%(KEY-rtype)s is part of violated unicity constraint', |
56 'type': u'type is part of violated unicity constraint', |
56 'type': u'%(KEY-rtype)s is part of violated unicity constraint', |
57 'unicity constraint': u'some relations violate a unicity constraint'}, |
57 '': u'some relations violate a unicity constraint'}, |
58 wraperr.exception.args[1]) |
58 wraperr.exception.args[1]) |
59 |
59 |
60 def test_unique_together_schema(self): |
60 def test_unique_together_schema(self): |
61 person = self.repo.schema.eschema('Personne') |
61 person = self.repo.schema.eschema('Personne') |
62 self.assertEqual(len(person._unique_together), 1) |
62 self.assertEqual(len(person._unique_together), 1) |
390 c = cnx.create_entity('Card', title=u'Carte') |
390 c = cnx.create_entity('Card', title=u'Carte') |
391 cnx.create_entity('Personne', nom=u'Vincent', fiche=c) |
391 cnx.create_entity('Personne', nom=u'Vincent', fiche=c) |
392 cnx.create_entity('Personne', nom=u'Florent', fiche=c) |
392 cnx.create_entity('Personne', nom=u'Florent', fiche=c) |
393 cnx.commit() |
393 cnx.commit() |
394 self.assertEqual(len(c.reverse_fiche), 1) |
394 self.assertEqual(len(c.reverse_fiche), 1) |
|
395 |
|
396 def test_delete_computed_relation_nonregr(self): |
|
397 with self.admin_access.repo_cnx() as cnx: |
|
398 c = cnx.create_entity('Personne', nom=u'Adam', login_user=cnx.user.eid) |
|
399 cnx.commit() |
|
400 c.cw_delete() |
|
401 cnx.commit() |
395 |
402 |
396 def test_cw_set_in_before_update(self): |
403 def test_cw_set_in_before_update(self): |
397 # local hook |
404 # local hook |
398 class DummyBeforeHook(Hook): |
405 class DummyBeforeHook(Hook): |
399 __regid__ = 'dummy-before-hook' |
406 __regid__ = 'dummy-before-hook' |