negative-only-http-status-assertion
HTTP test assertion only excludes a server error instead of identifying the intended response.
Why
Authentication, routing, validation, and domain failures can all replace the intended response while a negative-only status assertion remains green.
Fix
Assert the intended exact status and the relevant domain payload or side effect. When the explicit contract is only that a fuzz, chaos, smoke, or crash-regression request avoids a server exception, suppress SARJ408 on that assertion with a concise reason.
Examples
def test_invalid_payload(client): response = client.post("/items", json={}) assert response.status_code != 500def test_invalid_payload(client): response = client.post("/items", json={}) assert response.status_code == 422 assert response.json()["detail"]