[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)
r = client.get('/')
assert r.status_code == 200
d_r = r.json()
assert isinstance(d_r, dict)
assert 'openapi' in d_r
assert 'info' in d_r
assert 'paths' in d_r
assert 'domain' in d_r
schemas = r.json()
assert isinstance(schemas, list)
for schema in schemas:
assert isinstance(schema, dict)
assert 'openapi' in schema
assert 'info' in schema
assert 'paths' in schema
assert 'domain' in schema
r = client.get('/halfapi/acls')
assert r.status_code == 200

View File

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