Skip to content
Snippets Groups Projects

F xfail server 181

Open Timm Fitschen requested to merge f-xfail-server-181 into dev
1 file
+ 54
0
Compare changes
  • Side-by-side
  • Inline
@@ -1134,3 +1134,57 @@ def test_135():
r1 = db.Record().add_parent("TestRT1").insert()
r2 = db.Record().add_parent("TestRT1").add_property("TestProp", r1).insert()
assert len(db.execute_query("FIND ENTITY WHICH IS REFERENCED BY A TestRT1 AS TestProp")) == 1
@pytest.mark.xfail(reason="Fix https://gitlab.com/caosdb/caosdb-server/-/issues/181")
def test_181():
"""Upper-case "From" in transistion throws NullPointerException."""
def setup_state_machine():
db.RecordType("State").insert()
db.RecordType("StateModel").insert()
db.RecordType("Transition").insert()
db.Property(name="From", datatype="State").insert() # this is the bug:
db.Property(name="to", datatype="State").insert()
db.Property(name="initial", datatype="State").insert()
db.Property(name="final", datatype="State").insert()
def create_transition(name, fro, to):
db.Record(name).add_parent("Transition").add_property(
"From", fro).add_property("to", to).insert()
def create_state_model(name, transitions, initial, final):
m = db.Record(name)
m.add_parent("StateModel")
m.add_property("Transition",
datatype=db.LIST("Transition"),
value=transitions)
m.add_property("initial", initial)
m.add_property("final", final)
m.insert()
setup_state_machine()
# two states
db.Record("S1").add_parent("State").insert()
db.Record("S2").add_parent("State").insert()
# three transitions
create_transition("t11", "S1", "S1")
create_transition("t12", "S1", "S2")
create_transition("t21", "S2", "S1")
create_state_model("Model1", ["t11", "t12", "t21"], "S1", "S1")
# stateful record type
rt = db.RecordType("TestRT")
rt.state = db.State(model="Model1", name="S1")
rt.insert()
# record inherits the state from the record type.
rec = db.Record().add_parent("TestRT")
rec.insert()
assert rec.state == db.State(model="Model1", name="S1")
# now try to update the record without changing the state.
p = db.Property("p1", datatype=db.TEXT).insert()
rec.add_property(p, value="val1").update()
Loading