Blackened test_app.py
This commit is contained in:
parent
c831937b05
commit
d7d7a8cc8d
1 changed files with 4 additions and 6 deletions
|
|
@ -23,23 +23,21 @@ def test_microscope_creation():
|
|||
def test_openapi_valid():
|
||||
assert validate_spec(labthing.spec)
|
||||
|
||||
|
||||
def test_thing_description_valid():
|
||||
# TODO: it would be nice to put this into LabThings
|
||||
# First load the schema from file and check it validates
|
||||
schema_fname = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"w3c_td_schema.json"
|
||||
)
|
||||
schema_fname = os.path.join(os.path.dirname(__file__), "w3c_td_schema.json")
|
||||
schema = json.load(open(schema_fname, "r"))
|
||||
jsonschema.Draft7Validator.check_schema(schema)
|
||||
|
||||
# Build a TD dictionary
|
||||
with labthing.app.test_request_context():
|
||||
td_dict = labthing.thing_description.to_dict()
|
||||
td_dict = labthing.thing_description.to_dict()
|
||||
|
||||
# Allow our LabThingsJSONEncoder to encode the RD
|
||||
td_json = encode_json(td_dict)
|
||||
# Decode the JSON back into a primitive dictionary
|
||||
td_json_dict = json.loads(td_json)
|
||||
# Validate
|
||||
jsonschema.validate(instance=td_json_dict, schema=schema)
|
||||
jsonschema.validate(instance=td_json_dict, schema=schema)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue