Skip to content
Snippets Groups Projects
Commit 9b510313 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Merge branch 'dev' into 'f-transaction-permissions'

# Conflicts:
#   tests/test_issues_server.py
parents 29bfa957 e1a6232b
No related branches found
No related tags found
1 merge request!56TST: issue caosdb-server#196.
Pipeline #35183 passed with warnings
...@@ -1254,3 +1254,53 @@ def test_196b(deny): ...@@ -1254,3 +1254,53 @@ def test_196b(deny):
# this should fail because the curator doesn't have TRANSACTION:INSERT:PROPERTY # this should fail because the curator doesn't have TRANSACTION:INSERT:PROPERTY
db.Property(name="TestProp2", datatype=db.TEXT).insert() db.Property(name="TestProp2", datatype=db.TEXT).insert()
assert cm.value.errors[0].msg == "You are not allowed to do this." assert cm.value.errors[0].msg == "You are not allowed to do this."
@pytest.mark.xfail(reason="fix needed")
@pytest.mark.parametrize("num", ["1e+23", "5e22", "2e-323"])
def test_143(num):
"""https://gitlab.com/caosdb/caosdb-server/-/issues/144"""
db.Property(name="scientific_notation", datatype=db.DOUBLE).insert()
db.RecordType(name="RT1").add_property("scientific_notation", value=num).insert()
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation={num}", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation='{num}'", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation=\"{num}\"", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation = {num}", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation = '{num}'", unique=True)
db.execute_query(f"FIND RECORDTYPE RT1 WITH scientific_notation = \"{num}\"", unique=True)
def test_144():
"""https://gitlab.com/caosdb/caosdb-server/-/issues/144"""
db.Property(name="scientific_notation", datatype=db.DOUBLE, value="1e23").insert()
value = db.execute_query("FIND PROPERTY scientific_notation", unique=True).value
assert str(value) == "1e+23"
assert isinstance(value, float)
assert value == 1e23
assert value == 1e+23
def test_166():
"""https://gitlab.com/caosdb/caosdb-server/-/issues/166"""
db.RecordType(name="exists").insert()
db.Property(name="exists_property", datatype=db.INTEGER).insert()
db.RecordType(name="RT1").add_parent("exists").insert()
db.RecordType(name="RT2").add_parent("exists").add_property("exists_property", 32453).insert()
with pytest.raises(TransactionError) as cm:
db.Record(name="RT3").add_parent("notexists").insert()
assert [e.msg for e in cm.value.errors] == ["Entity has unqualified parents."]
with pytest.raises(TransactionError) as cm:
db.Record(name="RT4").add_parent("exists").add_property("notexists", 234243).insert()
assert [e.msg for e in cm.value.errors] == ["Entity has unqualified properties."]
with pytest.raises(TransactionError) as cm:
db.Record(
name="RT5").add_parent("notexists").add_property(
"exists_property",
234243).insert()
assert [e.msg for e in cm.value.errors] == ["Entity has unqualified parents."]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment