From e93154089eca4fbe031644677bcc94962804d05d Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Tue, 9 Jun 2020 15:10:15 +0200
Subject: [PATCH] TST: refactor tests for new _parse_value implementation

---
 tests/test_boolean.py    | 10 +++++-----
 tests/test_xmlparsing.py |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/test_boolean.py b/tests/test_boolean.py
index 00b0f68..fc6cfd2 100644
--- a/tests/test_boolean.py
+++ b/tests/test_boolean.py
@@ -99,14 +99,14 @@ def test_record():
         assert_equal(
             rec1.get_property("SimpleBooleanProperty").datatype,
             h.BOOLEAN)
-        assert_equal(rec1.get_property("SimpleBooleanProperty").value, "TRUE")
+        assert_equal(rec1.get_property("SimpleBooleanProperty").value, True)
 
         rec1c = h.Record(id=rec1.id).retrieve()
         assert_true(rec1c.is_valid())
         assert_equal(rec1c.get_property(
             "SimpleBooleanProperty").datatype, h.BOOLEAN)
         assert_equal(rec1c.get_property(
-            "SimpleBooleanProperty").value, "TRUE")
+            "SimpleBooleanProperty").value, True)
 
         rec2 = h.Record(name="SimpleRecord2").add_parent(
             rt).add_property(p, value=True).insert()
@@ -114,18 +114,18 @@ def test_record():
         assert_equal(
             rec2.get_property("SimpleBooleanProperty").datatype,
             h.BOOLEAN)
-        assert_equal(rec2.get_property("SimpleBooleanProperty").value, "TRUE")
+        assert_equal(rec2.get_property("SimpleBooleanProperty").value, True)
 
         rec2c = h.Record(id=rec2.id).retrieve()
         assert_true(rec2c.is_valid())
         assert_equal(rec2c.get_property(
             "SimpleBooleanProperty").datatype, h.BOOLEAN)
         assert_equal(rec2c.get_property(
-            "SimpleBooleanProperty").value, "TRUE")
+            "SimpleBooleanProperty").value, True)
 
         rec3 = h.Record(
             name="SimpleRecord3").add_parent(rt).add_property(
-            p, value="BLABLA")
+            p.name, value="BLABLA")
         assert_raises(EntityError, rec3.insert)
 
         assert_false(rec3.is_valid())
diff --git a/tests/test_xmlparsing.py b/tests/test_xmlparsing.py
index 9b91aae..e387f25 100644
--- a/tests/test_xmlparsing.py
+++ b/tests/test_xmlparsing.py
@@ -35,6 +35,7 @@ def test_parse_xml():
     from caosdb.common.models import Parent
     from caosdb.common.models import Property
     from caosdb.common.models import Message
+    from caosdb import INTEGER
 
     # define test file xml
     tmp_name = 'filename'
@@ -68,15 +69,16 @@ def test_parse_xml():
     tmp_prop_id = "103"
     tmp_prop_desc = "prop desc"
     tmp_prop_unit = "meter"
-    tmp_prop_exp = 9
     tmp_prop_value = 10
     tmp_prop_imp = "recommended"
+    tmp_prop_dtype = INTEGER
     prop = etree.Element("Property")
     prop.set("id", str(tmp_prop_id))
     prop.set("importance", str(tmp_prop_imp))
     prop.set("name", str(tmp_prop_name))
     prop.set("description", str(tmp_prop_desc))
     prop.set("unit", str(tmp_prop_unit))
+    prop.set("datatype", tmp_prop_dtype)
     prop.text = str(tmp_prop_value)
     elem.append(prop)
 
@@ -88,8 +90,6 @@ def test_parse_xml():
     elem.append(msg)
 
     xml = etree.tostring(elem, pretty_print=True)
-    print("========= Testing =========")
-    print(xml)
     filerec = parse_xml(xml)
 
     assert isinstance(filerec, File)
-- 
GitLab