[undo/test] if we try to delete an entity referenced by an inline relation, we fail
authorJulien Cristau <julien.cristau@logilab.fr>
Fri, 16 Jan 2015 11:17:53 +0100
changeset 10207 5ec5d17b5e5b
parent 10206 0ecd61f4bd37
child 10208 249126034c0e
[undo/test] if we try to delete an entity referenced by an inline relation, we fail
server/test/unittest_undo.py
--- a/server/test/unittest_undo.py	Fri Jan 16 10:56:30 2015 +0100
+++ b/server/test/unittest_undo.py	Fri Jan 16 11:17:53 2015 +0100
@@ -375,6 +375,17 @@
             p.cw_clear_all_caches()
             self.assertFalse(p.fiche)
 
+    def test_undo_inline_rel_delete_ko(self):
+        with self.admin_access.client_cnx() as cnx:
+            c = cnx.create_entity('Card', title=u'hop', content=u'hop')
+            txuuid = cnx.commit()
+            p = cnx.create_entity('Personne', nom=u'louis', fiche=c)
+            cnx.commit()
+            integrityerror = self.repo.sources_by_uri['system'].dbhelper.dbapi_module.IntegrityError
+            with self.assertRaises(integrityerror):
+                cnx.undo_transaction(txuuid)
+
+
     def test_undo_inline_rel_add_ko(self):
         """Undo add relation  Personne (?) fiche (?) Card