from sqgen_risk.exceptions import APIError, AuthenticationError


def test_api_error() -> None:
    """Test APIError exception."""
    error = APIError(status_code=404, message="Resource not found")

    assert error.status_code == 404
    assert str(error) == "Resource not found (status: 404)"


def test_api_error_default_message() -> None:
    """Test APIError with default message."""
    error = APIError(status_code=500)

    assert error.status_code == 500
    assert str(error) == "API request failed (status: 500)"


def test_authentication_error() -> None:
    """Test AuthenticationError exception."""
    error = AuthenticationError(message="Invalid credentials")

    assert error.status_code == 401
    assert str(error) == "Invalid credentials (status: 401)"


def test_authentication_error_default_message() -> None:
    """Test AuthenticationError with default message."""
    error = AuthenticationError()

    assert error.status_code == 401
    assert str(error) == "Authentication failed (status: 401)"
