From 871095db757dc4375ff5d5ca372ed6754ada0e61 Mon Sep 17 00:00:00 2001 From: Ilya Bogin Date: Tue, 30 Jun 2026 11:11:05 +0300 Subject: [PATCH] test(e2e): accept 422 alongside 404 for unfetchable page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fetch backend now rejects a dead page with a 422 ("Unprocessable entity") instead of a 404 ("Not found") depending on how far the upstream fetch got. Both are valid "this page can't be fetched" outcomes, so test_dead_page now accepts either error string instead of pinning the exact one — the CLI contract (exit code 1 + structured error) is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/e2e/test_fetch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/e2e/test_fetch.py b/tests/e2e/test_fetch.py index d743510..4fd8c33 100644 --- a/tests/e2e/test_fetch.py +++ b/tests/e2e/test_fetch.py @@ -37,7 +37,10 @@ def test_dead_page(kn): res = kn("fetch", "https://example.com/nonexistent-xyz-12345") assert res.code == 1 data = res.yaml() - assert data["error"] == "Not found" + # The backend rejects an unfetchable page with either a 404 ("Not found") + # or a 422 ("Unprocessable entity") depending on how far upstream got — + # both are valid "this page can't be fetched" outcomes. + assert data["error"] in ("Not found", "Unprocessable entity") def test_invalid_key_on_fetch(kn):