From 3daec7f23ba2cc04dbf04e494d11cdf444699c01 Mon Sep 17 00:00:00 2001 From: Daniel <daniel@harvey> Date: Tue, 18 Aug 2020 09:29:40 +0200 Subject: [PATCH] TEST: Test for mysql-backend issue 21 --- tests/test_issues_mysqlbackend.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_issues_mysqlbackend.py b/tests/test_issues_mysqlbackend.py index 214a5c3..0ccf0ee 100644 --- a/tests/test_issues_mysqlbackend.py +++ b/tests/test_issues_mysqlbackend.py @@ -25,6 +25,8 @@ import caosdb as db +from nose.tools import with_setup + def setup_module(): try: @@ -66,3 +68,25 @@ def test_issue_18(): C1 = db.Entity(name="C").retrieve() pids = [p.id for p in C1.parents] assert len(set(pids)) == len(pids), "Duplicate parents." + + +@with_setup(setup, teardown) +def test_issue_21(): + """Removing the last child in an inheritance chain of 4 failed with versioning. + + Tests for https://gitlab.com/caosdb/caosdb-mysqlbackend/-/issues/21 + """ + A = db.RecordType(name="A") + B = db.RecordType(name="B") + C = db.RecordType(name="C") + rec = db.RecordType(name="rec") + + A.add_parent(B) + B.add_parent(C) + rec.add_parent(A) + + cont = db.Container() + cont.extend([A, B, C, rec]) + cont.insert() + + rec.delete() -- GitLab