From b307817bdc56d8adf2711c679188da9d7ad72ed6 Mon Sep 17 00:00:00 2001
From: Alexander Schlemmer <a.schlemmer@indiscale.com>
Date: Wed, 22 May 2024 14:55:32 +0200
Subject: [PATCH] TST: added match strings to checks for errors

---
 unittests/test_sync_node.py | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/unittests/test_sync_node.py b/unittests/test_sync_node.py
index 171af8fc..85266789 100644
--- a/unittests/test_sync_node.py
+++ b/unittests/test_sync_node.py
@@ -171,30 +171,37 @@ def test_sync_node():
     # merge with conflicting information
     # ----------------------------------
     sn_a = SyncNode(db.Record(id=102))
-    with pytest.raises(ValueError):
+    with pytest.raises(ValueError, match="Trying to update"):
         sn_a.update(SyncNode(db.Record(id=101)))
 
     sn_a = SyncNode(db.Record(name='102'))
-    with pytest.raises(ValueError):
+    with pytest.raises(ValueError, match="Trying to update"):
         sn_a.update(SyncNode(db.Record(name='101')))
 
     sn_a = SyncNode(db.Record(name='102'))
-    with pytest.raises(ValueError):
+    with pytest.raises(ValueError, match="Trying to update"):
         sn_a.update(SyncNode(db.File(name='102')))
 
     sn_a = SyncNode(db.Record(description='102'))
-    with pytest.raises(ValueError):
+    with pytest.raises(ValueError, match="Trying to update"):
         sn_a.update(SyncNode(db.Record(description='101')))
 
     sn_a = SyncNode(db.File(path='102'))
-    with pytest.raises(ValueError):
+    with pytest.raises(ValueError, match="Trying to update"):
         sn_a.update(SyncNode(db.File(path='101')))
 
     sn_a = SyncNode(db.File(path='102'))
     sn_a.identifiable = Identifiable(name='a')
-    sn_b.identifiable = Identifiable(name='b')
+    # sn_b.identifiable = Identifiable(name='b')
     sn_b = SyncNode(db.File(path='101'))
-    with pytest.raises(ValueError):
+    with pytest.raises(ValueError, match="Trying to update"):
+        sn_a.update(sn_b)
+
+    sn_a = SyncNode(db.File(path='102'))
+    sn_a.identifiable = Identifiable(name='a')
+    sn_b = SyncNode(db.File(path='101'))
+    sn_b.identifiable = Identifiable(name='b')
+    with pytest.raises(ValueError, match="identifiable"):
         sn_a.update(sn_b)
 
 
-- 
GitLab