diff options
| author | Dennis Fink | 2026-11-15 21:18:19 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-15 21:18:19 +0100 |
| commit | 9b00526ab79257b65cedd71595848f09ecf84279 (patch) | |
| tree | f9dfc5c0934499d47499bf083bd864f72947958c /tests/tasks/test_extension.py | |
| parent | 509d93b2976e353d29441a7a7b7e78ca466dc4fd (diff) | |
| download | webmentions-ssg-9b00526ab79257b65cedd71595848f09ecf84279.tar.gz webmentions-ssg-9b00526ab79257b65cedd71595848f09ecf84279.zip | |
refactor(core)!: clarify Webmention domain terminology
Rename ambiguous models, statuses, task modules, fields, and helpers so
names reflect source documents, verification, endpoint discovery, and
delivery state.
Migrate persisted status values and database identifiers without losing
existing Webmention data.
BREAKING CHANGE: persisted status values and database schema names have
changed, and several public Python names have been renamed.
Diffstat (limited to 'tests/tasks/test_extension.py')
| -rw-r--r-- | tests/tasks/test_extension.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/tasks/test_extension.py b/tests/tasks/test_extension.py index 323353e..adbad09 100644 --- a/tests/tasks/test_extension.py +++ b/tests/tasks/test_extension.py @@ -11,18 +11,18 @@ import pytest from flask import Flask, current_app, has_app_context from huey import crontab -from webmentions_ssg.tasks.extension import Huey +from webmentions_ssg.tasks.extension import FlaskHuey def test_init_without_app() -> None: - huey = Huey() + huey = FlaskHuey() assert huey.app is None with pytest.raises(RuntimeError, match="Huey has not been initialized"): _ = huey.huey def test_init_with_app(app: Flask) -> None: - huey = Huey(app) + huey = FlaskHuey(app) assert huey.app is app assert huey.huey.name == app.import_name assert huey.huey.results is True @@ -42,7 +42,7 @@ def test_init_app_uses_huey_configuration(app: Flask) -> None: "immediate": False, } - huey = Huey() + huey = FlaskHuey() huey.init_app(app) assert huey.huey.name == "custom-name" @@ -56,12 +56,14 @@ def test_huey_url_takes_precedence_over_huey_configuration(app: Flask) -> None: app.config["HUEY"] = {"url": "blackhole://"} app.config["HUEY_URL"] = "memory://" - huey = Huey(app) + huey = FlaskHuey(app) assert type(huey.huey).__name__ == "MemoryHuey" -def task_decorator(huey: Huey, periodic: bool) -> Callable[[Callable[..., Any]], Any]: +def task_decorator( + huey: FlaskHuey, periodic: bool +) -> Callable[[Callable[..., Any]], Any]: if periodic: return huey.periodic_task(crontab(minute="*")) @@ -70,7 +72,7 @@ def task_decorator(huey: Huey, periodic: bool) -> Callable[[Callable[..., Any]], @pytest.mark.parametrize("periodic", [False, True], ids=["task", "periodic-task"]) def test_task_runs_in_app_context(app: Flask, periodic: bool) -> None: - huey = Huey(app) + huey = FlaskHuey(app) @task_decorator(huey, periodic) def add(a: int, b: int) -> int: @@ -82,7 +84,7 @@ def test_task_runs_in_app_context(app: Flask, periodic: bool) -> None: @pytest.mark.parametrize("periodic", [False, True], ids=["task", "periodic-task"]) def test_task_raises_without_app(app: Flask, periodic: bool) -> None: - huey = Huey(app) + huey = FlaskHuey(app) @task_decorator(huey, periodic) def task() -> None: @@ -100,7 +102,7 @@ def test_task_declaration_before_init_and_rebind_after_init(periodic: bool) -> N :param periodic: Pytest fixture providing the periodic-task test function. """ - queue = Huey() + queue = FlaskHuey() observed_apps: list[str] = [] @task_decorator(queue, periodic) @@ -138,7 +140,7 @@ def test_task_declaration_before_init_and_rebind_after_init(periodic: bool) -> N def test_multiple_deferred_tasks_registered_on_initialization() -> None: - queue = Huey() + queue = FlaskHuey() @queue.task(retries=2, retry_delay=50) def first(value: int) -> int: @@ -157,7 +159,7 @@ def test_multiple_deferred_tasks_registered_on_initialization() -> None: def test_getattr_delegates_to_huey(app: Flask) -> None: - huey = Huey(app) + huey = FlaskHuey(app) assert huey.immediate is True @@ -221,7 +223,7 @@ def test_backend_from_url( monkeypatch.setattr(huey_package, backend_name, backend_class) - actual_class, actual_storage_kwargs = Huey.backend_from_url(url) + actual_class, actual_storage_kwargs = FlaskHuey.backend_from_url(url) assert actual_class is backend_class assert actual_storage_kwargs == storage_kwargs @@ -254,4 +256,4 @@ def test_backend_from_url( ) def test_backend_from_url_rejects_invalid_url(url: str, message: str) -> None: with pytest.raises(RuntimeError, match=re.escape(message)): - Huey.backend_from_url(url) + FlaskHuey.backend_from_url(url) |
