From be944ac98e015244d108a065f3d63bb7b5a03a1d Mon Sep 17 00:00:00 2001 From: Georg K Date: Tue, 22 Nov 2022 17:28:30 +0300 Subject: [PATCH] fix: pass tests --- tests/test_oas/test_view.py | 84 ++++++++++++++----------------------- 1 file changed, 32 insertions(+), 52 deletions(-) diff --git a/tests/test_oas/test_view.py b/tests/test_oas/test_view.py index c30267b..e8d6506 100644 --- a/tests/test_oas/test_view.py +++ b/tests/test_oas/test_view.py @@ -128,6 +128,14 @@ async def test_generated_oas_should_have_components_schemas(generated_oas): "title": "Color", "type": "string", }, + 'Error': { + 'properties': { + 'code': {'title': 'Code', 'type': 'integer'}, + 'text': {'title': 'Text', 'type': 'string'}}, + 'required': ['code', 'text'], + 'title': 'Error', + 'type': 'object' + }, 'Lang': { 'description': 'An enumeration.', 'enum': ['en', 'fr'], @@ -143,6 +151,20 @@ async def test_generated_oas_should_have_components_schemas(generated_oas): "title": "Toy", "type": "object", }, + 'Pet': { + 'properties': { + 'id': {'title': 'Id', 'type': 'integer'}, + 'name': {'title': 'Name', 'type': 'string'}, + 'toys': { + 'items': {'$ref': '#/components/schemas/Toy'}, + 'title': 'Toys', + 'type': 'array' + } + }, + 'required': ['id', 'toys'], + 'title': 'Pet', + 'type': 'object' + } } @@ -191,20 +213,7 @@ async def test_pets_route_should_have_get_method(generated_oas): "content": { "application/json": { "schema": { - "items": { - "properties": { - "id": {"title": "Id", "type": "integer"}, - "name": {"title": "Name", "type": "string"}, - "toys": { - "items": {"$ref": "#/components/schemas/Toy"}, - "title": "Toys", - "type": "array", - }, - }, - "required": ["id", "toys"], - "title": "Pet", - "type": "object", - }, + "items": {'$ref': '#/components/schemas/Pet'}, "type": "array", } } @@ -242,20 +251,7 @@ async def test_pets_route_should_have_post_method(generated_oas): "description": "", "content": { "application/json": { - "schema": { - "properties": { - "id": {"title": "Id", "type": "integer"}, - "name": {"title": "Name", "type": "string"}, - "toys": { - "items": {"$ref": "#/components/schemas/Toy"}, - "title": "Toys", - "type": "array", - }, - }, - "required": ["id", "toys"], - "title": "Pet", - "type": "object", - } + "schema": {'$ref': '#/components/schemas/Pet'} } }, } @@ -314,30 +310,14 @@ async def test_pets_id_route_should_have_get_method(generated_oas): }, }, ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "id": {"title": "Id", "type": "integer"}, - "name": {"title": "Name", "type": "string"}, - "toys": { - "items": {"$ref": "#/components/schemas/Toy"}, - "title": "Toys", - "type": "array", - }, - }, - "required": ["id", "toys"], - "title": "Pet", - "type": "object", - } - } - }, - }, - "404": {"description": "", "content": {}}, - }, + 'responses': { + '200': {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Pet'}}}, + 'description': ''}, + '400': {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Error'}}}, + 'description': ''}, + '404': {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Error'}}}, + 'description': ''} + } }