From 93356a6871896a72cbd8880a51edc49d625d0012 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Sat, 21 Nov 2026 17:52:22 -0500 Subject: [PATCH] test(r30/CR-07): verify handle_zoom_error clamps non-4xx/5xx to 502 - Add parametrized test_zoom_api_error_clamps_non_4xx_5xx_status_to_502 for 302, 399, and 600 - Confirm DELETE during payment_processing is already covered by dedicated test_delete_during_payment_processing_returns_409_and_preserves_row --- tests/test_app.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_app.py b/tests/test_app.py index 437dc8d..abea9ad 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -815,6 +815,19 @@ def test_zoom_api_error_status_passthrough_returns_401(client, monkeypatch): assert resp.get_json()["zoom_status"] == 401 +@pytest.mark.parametrize("raw_status", [302, 399, 600]) +def test_zoom_api_error_clamps_non_4xx_5xx_status_to_502(client, monkeypatch, raw_status): + test_client, _ = client + monkeypatch.setattr( + zoom.requests, + "post", + lambda url, **kwargs: FakeResponse(raw_status, {"reason": "Unexpected upstream status"}), + ) + resp = test_client.post("/api/zoom/verify-credentials", json=SAMPLE_CREDS) + assert resp.status_code == 502 + assert resp.get_json()["zoom_status"] == raw_status + + def test_zoom_request_exception_returns_502(client, monkeypatch): test_client, _ = client