diff options
| author | Dennis Fink | 2026-11-14 19:43:28 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-14 19:43:28 +0100 |
| commit | c74feda222745ab7cca8993df83d9ea5f9d07e5b (patch) | |
| tree | acc7bf9bd7223f9d685d6c2954c5c90d7a9e36f0 /tests/views/helpers.py | |
| parent | e52e554e2d033dd5ef8397617644e90e354f9560 (diff) | |
| download | webmentions-ssg-c74feda222745ab7cca8993df83d9ea5f9d07e5b.tar.gz webmentions-ssg-c74feda222745ab7cca8993df83d9ea5f9d07e5b.zip | |
refactor(core): use HTTPStatus consistently
Replace numeric HTTP response and assertion codes in views and tests
with `HTTPStatus` members so status handling is more descriptive and
consistent.
Diffstat (limited to '')
| -rw-r--r-- | tests/views/helpers.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/views/helpers.py b/tests/views/helpers.py index da98aa6..1fe1ed2 100644 --- a/tests/views/helpers.py +++ b/tests/views/helpers.py @@ -4,6 +4,7 @@ import uuid from datetime import UTC, datetime +from http import HTTPStatus from types import ModuleType from unittest.mock import Mock @@ -80,7 +81,7 @@ def create_sent_source(app: Flask) -> uuid.UUID: sent_revision=2, status=SentWebmentionStatus.SENT, endpoint="https://example.com/webmention", - response_status=202, + response_status=HTTPStatus.ACCEPTED, ), SentWebmention( target="https://example.com/a", @@ -91,7 +92,7 @@ def create_sent_source(app: Flask) -> uuid.UUID: status=SentWebmentionStatus.FAILED, failure_reason="Webmention endpoint returned HTTP 400", endpoint="https://example.com/webmention", - response_status=400, + response_status=HTTPStatus.BAD_REQUEST, ), ] ) @@ -173,7 +174,7 @@ def create_resendable_sent_webmention(app: Flask) -> tuple[uuid.UUID, uuid.UUID] status=SentWebmentionStatus.FAILED, failure_reason="Previous failure", endpoint="https://example.com/webmention", - response_status=500, + response_status=HTTPStatus.INTERNAL_SERVER_ERROR, status_url="https://example.com/webmention/status/123", ) source.sent_webmentions.append(webmention) @@ -202,7 +203,7 @@ def create_outgoing( active=True, desired_revision=1, status_url=status_url, - response_status=201 if status_url is not None else None, + response_status=HTTPStatus.CREATED if status_url is not None else None, ) source.sent_webmentions.append(mention) db.session.add(source) |
