From 097a2a5cb5dfceea67d8305f69ac8878f65464f5 Mon Sep 17 00:00:00 2001
From: Alexander Schlemmer <alexander@mail-schlemmer.de>
Date: Thu, 3 Mar 2022 10:00:23 +0100
Subject: [PATCH] ENH: made getters and setters specific to files inacessible
 for other roles

---
 unittests/test_high_level_api.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/unittests/test_high_level_api.py b/unittests/test_high_level_api.py
index ae169b3c..c94fd8aa 100644
--- a/unittests/test_high_level_api.py
+++ b/unittests/test_high_level_api.py
@@ -270,7 +270,15 @@ def test_empty():
 
     rconv = convert_to_entity(obj)
     assert len(rconv.properties) == 0
-    
+
+def test_wrong_entity_for_file():
+    r = db.Record()
+    r.path = "test.dat"
+    r.file = "/local/path/test.dat"
+    assert r.path == "test.dat"
+    assert r.file == "/local/path/test.dat"
+    with pytest.raises(RuntimeError):
+        obj = convert_to_python_object(r)
 
 def test_files():
     # empty file:
@@ -290,3 +298,6 @@ def test_files():
     assert r.path == "test.dat"
     assert r.file == "/local/path/test.dat"
     assert isinstance(obj, CaosDBPythonFile)
+
+    assert obj.path == "test.dat"
+    assert obj.file == "/local/path/test.dat"
-- 
GitLab