diff --git a/unittests/test_json_schema_exporter.py b/unittests/test_json_schema_exporter.py index 3a0729dded527367c8841f1bf697cb7925f77941..ee81fed068e5ecfff6fa1ed29226c6fb61c4b1b2 100644 --- a/unittests/test_json_schema_exporter.py +++ b/unittests/test_json_schema_exporter.py @@ -22,6 +22,8 @@ import linkahead as db +from pytest import raises + from caosadvancedtools.json_schema_exporter import recordtype_to_json_schema as rtjs @@ -51,3 +53,48 @@ def test_empty_rt(): assert "description" in schema["properties"] assert schema["properties"]["name"]["type"] == "string" assert schema["properties"]["description"]["type"] == "string" + + +def test_rt_with_scalar_props(): + + pass + + +def test_rt_with_list_props(): + + pass + + +def test_rt_with_references(): + """References and lists of references will come later, so test if the errors + are thrown correctly. + + """ + + rt = db.RecordType() + rt.add_property(name="RefProp", datatype=db.REFERENCE) + + with raises(NotImplementedError): + + rtjs(rt) + + rt = db.RecordType() + rt.add_property(name="RefProp", datatype="OtherType") + + with raises(NotImplementedError): + + rtjs(rt) + + rt = db.RecordType() + rt.add_property(name="RefProp", datatype=db.LIST(db.REFERENCE)) + + with raises(NotImplementedError): + + rtjs(rt) + + rt = db.RecordType() + rt.add_property(name="RefProp", datatype=db.LIST("OtherType")) + + with raises(NotImplementedError): + + rtjs(rt)