[tests] fix for schema lists

This commit is contained in:
Maxime Alves LIRMM 2021-12-08 16:45:00 +01:00
parent d5f39a7929
commit 048c9f1bab
2 changed files with 13 additions and 9 deletions

View File

@ -75,12 +75,14 @@ class TestDomain(TestCase):
client = TestClient(halfapi.application) client = TestClient(halfapi.application)
r = client.get('/') r = client.get('/')
assert r.status_code == 200 assert r.status_code == 200
d_r = r.json() schemas = r.json()
assert isinstance(d_r, dict) assert isinstance(schemas, list)
assert 'openapi' in d_r for schema in schemas:
assert 'info' in d_r assert isinstance(schema, dict)
assert 'paths' in d_r assert 'openapi' in schema
assert 'domain' in d_r assert 'info' in schema
assert 'paths' in schema
assert 'domain' in schema
r = client.get('/halfapi/acls') r = client.get('/halfapi/acls')
assert r.status_code == 200 assert r.status_code == 200

View File

@ -26,9 +26,11 @@ def test_routes(application_debug):
r = c.get('/halfapi/error/500') r = c.get('/halfapi/error/500')
assert r.status_code == 500 assert r.status_code == 500
r = c.get('/') r = c.get('/')
d_r = r.json() schemas = r.json()
assert isinstance(d_r, dict) assert isinstance(schemas, list)
assert API_SCHEMA.validate(d_r) for schema in schemas:
assert isinstance(schema, dict)
assert API_SCHEMA.validate(schema)
""" """
TODO: Find a way to test exception raising TODO: Find a way to test exception raising