From 048c9f1bab71e404d88e8b376a1fa3a6f11a01fd Mon Sep 17 00:00:00 2001 From: Maxime Alves LIRMM Date: Wed, 8 Dec 2021 16:45:00 +0100 Subject: [PATCH] [tests] fix for schema lists --- halfapi/testing/test_domain.py | 14 ++++++++------ tests/test_debug_routes.py | 8 +++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/halfapi/testing/test_domain.py b/halfapi/testing/test_domain.py index 4a1682b..34397c8 100644 --- a/halfapi/testing/test_domain.py +++ b/halfapi/testing/test_domain.py @@ -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 diff --git a/tests/test_debug_routes.py b/tests/test_debug_routes.py index 41d30dc..7dfe46f 100644 --- a/tests/test_debug_routes.py +++ b/tests/test_debug_routes.py @@ -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