generated from john/python-template
This commit is contained in:
@@ -4,6 +4,8 @@ import pytest
|
||||
|
||||
from transcription.errors import AppError
|
||||
from transcription.errors import ErrorCategory
|
||||
from transcription.errors import build_error_envelope
|
||||
from transcription.errors import canonical_error_category
|
||||
from transcription.errors import classify_unexpected_error
|
||||
from transcription.errors import new_error_id
|
||||
|
||||
@@ -44,3 +46,14 @@ class TestAppErrorHelpers:
|
||||
assert "boom" in err.message
|
||||
assert err.suggestion
|
||||
assert err.error_id
|
||||
|
||||
def test_envelope_categories_use_canonical_contract_values(self):
|
||||
"""API/UI envelope categories are normalized to canonical short identifiers."""
|
||||
validation = AppError("x", category=ErrorCategory.USER_INPUT)
|
||||
timeout = AppError("x", category=ErrorCategory.INFRA_TRANSIENT)
|
||||
internal = AppError("x", category=ErrorCategory.INTERNAL_UNEXPECTED)
|
||||
|
||||
assert canonical_error_category(validation) == "validation"
|
||||
assert canonical_error_category(timeout) == "timeout"
|
||||
assert canonical_error_category(internal) == "internal"
|
||||
assert build_error_envelope(validation).category == "validation"
|
||||
|
||||
Reference in New Issue
Block a user