Skip to content
Snippets Groups Projects
Commit 3fa0ec7b authored by florian's avatar florian
Browse files

TST: Test list of references

parent 8f55d34c
No related branches found
No related tags found
2 merge requests!89ENH: JsonSchemaExporter accepts do_not_create parameter.,!81F schema export references
Pipeline #42743 failed
......@@ -321,10 +321,27 @@ def test_rt_with_references():
assert "OtherTextProp" in props
assert props["OtherTextProp"]["type"] == "string"
rt = db.RecordType()
rt.add_property(name="RefProp", datatype=db.LIST(db.REFERENCE))
rt = db.RecordType(name="TestType", description="Some description")
rt.add_property(name="RefProp", datatype=db.LIST(db.REFERENCE),
description="I'm a list of references.")
schema = rtjs(rt)
assert schema["title"] == rt.name
assert schema["description"] == rt.description
assert "RefProp" in schema["properties"]
ref_prop = schema["properties"]["RefProp"]
assert ref_prop["type"] == "array"
assert "description" in ref_prop
assert ref_prop["description"] == "I'm a list of references."
assert "items" in ref_prop
items = ref_prop["items"]
assert "enum" in items
assert isinstance(items["enum"], list)
assert len(items["enum"]) == len(
db.execute_query("SELECT name, id FROM RECORD")) + len(
db.execute_query("SELECT name, id FROM FILE"))
assert "oneOf" not in items
assert "description" not in items
rt = db.RecordType()
rt.add_property(name="RefProp", datatype=db.LIST("OtherType"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment