Commit b3ebf52b authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][invalid_database] Build error string the same as jsonschema

This allows to build the error message as expected with both
Python 2 and 3.
parent 7270d058
Pipeline #19322 passed with stage
in 20 minutes and 13 seconds
......@@ -34,10 +34,11 @@ from . import prefix
def doit(filename, error_msg):
database = Database(prefix, filename)
assert database.errors
found = False
for msg in database.errors:
print(msg, error_msg)
if msg.find(error_msg) != -1:
found = True
......@@ -51,40 +52,40 @@ def test_load_invalid_database():
doit('invalid/1', 'invalid JSON code')
def test_load_database_without_protocols_list():
doit('missing_protocols/1', "'protocols' is a required property")
doit('missing_protocols/1', "%r is a required property" % u'protocols')
def test_load_database_with_empty_protocols_list():
doit('empty_protocols/1', "/protocols: [] is too short")
def test_load_database_with_missing_protocol_name():
doit('missing_protocol_name/1', "/protocols/0: 'name' is a required property")
doit('missing_protocol_name/1', "/protocols/0: %r is a required property" % u'name')
def test_load_database_with_mixed_protocol_names():
doit('mixed_protocol_names/1', "None is not of type 'string'")
doit('mixed_protocol_names/1', "None is not of type %r" % u'string')
def test_load_database_with_same_protocol_names():
doit('same_protocol_names/1', "found different protocols with the same name:")
def test_load_database_with_missing_protocol_sets():
doit('missing_protocol_sets/1', "'sets' is a required property")
doit('missing_protocol_sets/1', "%r is a required property" % u'sets')
def test_load_database_with_empty_protocol_sets():
doit('empty_protocol_sets/1', 'rule: /properties/protocols/items/properties/sets/minItems')
def test_load_database_with_missing_set_name():
doit('missing_set_name/1', "'name' is a required property")
doit('missing_set_name/1', "%r is a required property" % u'name')
def test_load_database_with_mixed_set_names():
doit('mixed_set_names/1', "name: None is not of type 'string'")
doit('mixed_set_names/1', "name: None is not of type %r" % u'string')
def test_load_database_with_same_set_names():
doit('same_set_names/1', "found different sets with the same name")
def test_load_database_with_missing_set_view():
doit('missing_set_view/1', "'view' is a required property")
doit('missing_set_view/1', "%r is a required property" % u'view')
def test_load_database_with_missing_set_outputs_list():
doit('missing_set_outputs/1', "'outputs' is a required property")
doit('missing_set_outputs/1', "%r is a required property" % u'outputs')
def test_load_database_with_empty_set_outputs_list():
doit('empty_set_outputs/1', 'outputs: OrderedDict() does not have enough properties')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment