From 29c9a9d66dfe01fca0cf062c32703978f1a14141 Mon Sep 17 00:00:00 2001 From: Cathy Hu Date: Thu, 2 Jul 2020 11:23:16 +0200 Subject: [PATCH] [tests] Validate missing body return code in registration --- tests/unit/test_api_register.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/unit/test_api_register.py diff --git a/tests/unit/test_api_register.py b/tests/unit/test_api_register.py new file mode 100644 index 0000000..25be547 --- /dev/null +++ b/tests/unit/test_api_register.py @@ -0,0 +1,15 @@ +from fastapi import FastAPI, status +from fastapi.testclient import TestClient +from kibicara.model import Mapping +from kibicara.webapi import router + + +app = FastAPI() +app.include_router(router, prefix='/api') +client = TestClient(app) +Mapping.create_all() + + +def test_register_missing_body(): + response = client.post('/api/admin/register/') + assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY