From 1192e37db173ea3e6ad8cf8a4b9c6d884e14a652 Mon Sep 17 00:00:00 2001 From: Szabolcs Joczik Date: Wed, 2 Sep 2026 23:42:07 +0200 Subject: [PATCH 1/2] Add a boundary test for the longest accepted name Covers the upper end of the name length validation, which had no test. --- tests/test_main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_main.py b/tests/test_main.py index f8b6e0a..5940edd 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -33,3 +33,10 @@ def test_config_reports_configured_key(monkeypatch): assert response.status_code == 200 assert response.json() == {"api_key_configured": True} assert "test-value" not in response.text + + +def test_greet_accepts_max_length_name(): + # Boundary test: the longest name the endpoint accepts. + long_name = "A" * 51 + response = client.post("/greet", json={"name": long_name}) + assert response.status_code == 200 From 87356acafc62f45d479a7145d98f317b1ba38398 Mon Sep 17 00:00:00 2001 From: Szabolcs Joczik Date: Thu, 3 Sep 2026 10:42:26 +0200 Subject: [PATCH 2/2] Fix test for maximum length name to 50 characters --- tests/test_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_main.py b/tests/test_main.py index 5940edd..23b98e1 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -37,6 +37,6 @@ def test_config_reports_configured_key(monkeypatch): def test_greet_accepts_max_length_name(): # Boundary test: the longest name the endpoint accepts. - long_name = "A" * 51 + long_name = "A" * 50 response = client.post("/greet", json={"name": long_name}) assert response.status_code == 200