import httpx

from abuseipdb.exceptions import UnprocessableContentError


def test_http_error_exposes_structured_metadata() -> None:
    response = httpx.Response(422, request=httpx.Request("POST", "https://example.test/report"))
    error = UnprocessableContentError("bad input", response=response, detail="Invalid IP")
    assert str(error) == "bad input"
    assert error.status_code == 422
    assert error.detail == "Invalid IP"
    assert error.response is response
