"""TS-07 — the typed transport exceptions assert message format + field values."""

from __future__ import annotations

from mgf.http import IntegrityError
from mgf.http.exceptions import HttpTransportError


def test_http_transport_error_fields_and_message() -> None:
    e = HttpTransportError(
        url="https://api.example.com/x", cause_summary="ConnectTimeout", attempts=3
    )
    assert e.url == "https://api.example.com/x"
    assert e.cause_summary == "ConnectTimeout"
    assert e.attempts == 3
    assert "ConnectTimeout" in str(e)


def test_integrity_error_fields_and_message() -> None:
    e = IntegrityError(url="https://h/f", algorithm="sha256", expected="aa", actual="bb")
    assert (e.algorithm, e.expected, e.actual) == ("sha256", "aa", "bb")
    assert isinstance(e, HttpTransportError)
    msg = str(e)
    assert "sha256" in msg and "aa" in msg and "bb" in msg
