From ac2c51631ca058ba069f716fc0750c9495da1c12 Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Thu, 24 Nov 2022 16:59:31 +0100
Subject: [PATCH] TST: Add unittest for merge conflict

---
 unittests/test_issues.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/unittests/test_issues.py b/unittests/test_issues.py
index 40f50c8e..9393d712 100644
--- a/unittests/test_issues.py
+++ b/unittests/test_issues.py
@@ -99,12 +99,21 @@ def test_issue_39():
     # a1 (has id) references b1 (has no id)
     a1 = db.Record(name="A", id=101).add_parent(name="RT_A")
     b1 = db.Record(name="B").add_parent(name="RT_B")
+    a1.add_property(name="RT_B", value=b1)
 
     # a2 (no id) references b2 (has id)
     a2 = db.Record(name="A").add_parent(name="RT_A")
     b2 = db.Record(name="B", id=102).add_parent(name="RT_B")
+    a2.add_property(name="RT_B", value=b2)
 
     flat_list = [b2, a2, a1, b1]
 
+    # the two records with ids exist remotely
+    crawler.add_to_remote_existing_cache(a1)
+    crawler.add_to_remote_existing_cache(b2)
+
+    # this would result in a merge conflict before
     ins, ups = crawler.split_into_inserts_and_updates(flat_list)
     print(ins)
+    print(ups)
+    assert False
-- 
GitLab