From 3fb4d18db8d57bf5f6c5fb8916c79927658b6cca Mon Sep 17 00:00:00 2001 From: Ivan Golikov Date: Mon, 6 Jan 2025 17:27:20 +0100 Subject: [PATCH] Test empty secret is not accepted --- tests/integration/test_api.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/integration/test_api.py b/tests/integration/test_api.py index 22303b2..9d5f161 100644 --- a/tests/integration/test_api.py +++ b/tests/integration/test_api.py @@ -3,6 +3,13 @@ from fastapi.testclient import TestClient from tests.factories import SecretFactory +def test_empty_secret_is_not_accepted(client: TestClient): + response = client.post("/secret", json={"data": ""}) + + assert response.status_code == 422 + assert "data" in response.text + + def test_store_secret_returns_key(client: TestClient): response = client.post("/secret", json=dict(SecretFactory().build()))