diff options
| author | Dennis Fink | 2026-11-12 22:44:25 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-12 22:44:25 +0100 |
| commit | 1db6b47f88dde5538efa433328987c70eab74d70 (patch) | |
| tree | 1231cc03e603f8b22f5c35a51475d3acc4694621 /tests | |
| parent | c7993952c585b66acad5275e39dbf91cf662b975 (diff) | |
| download | webmentions-ssg-1db6b47f88dde5538efa433328987c70eab74d70.tar.gz webmentions-ssg-1db6b47f88dde5538efa433328987c70eab74d70.zip | |
fix(core): validate Redis Huey URL schemes
Parse Redis backend flavours explicitly so supported combinations
preserve the correct redis or rediss scheme while malformed or unknown
variants fail fast.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tasks/test_extension.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/tasks/test_extension.py b/tests/tasks/test_extension.py index 5e9cdfa..19f1191 100644 --- a/tests/tasks/test_extension.py +++ b/tests/tasks/test_extension.py @@ -2,6 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause +import re from collections.abc import Callable from typing import Any @@ -122,6 +123,11 @@ def test_getattr_delegates_to_huey(app: Flask) -> None: "PriorityRedisExpireHuey", {"url": "redis://localhost:6379/0"}, ), + ( + "rediss+priority+expire://localhost:6379/0", + "PriorityRedisExpireHuey", + {"url": "rediss://localhost:6379/0"}, + ), ("sqlite:///var/huey.db", "SqliteHuey", {"filename": "var/huey.db"}), ("file:///var/huey-queue", "FileHuey", {"path": "var/huey-queue"}), ( @@ -168,8 +174,15 @@ def test_backend_from_url( ), ("file:///", "File Huey URL must include a directory path"), ("amqp://localhost", "Unsupported HUEY_URL scheme: 'amqp'"), + ("redis+typo://localhost", "Unsupported HUEY_URL scheme: 'redis+typo'"), + ( + "rediss+priority+typo://localhost", + "Unsupported HUEY_URL scheme: 'rediss+priority+typo'", + ), + ("redis+://localhost", "Unsupported HUEY_URL scheme: 'redis+'"), + ("redisish://localhost", "Unsupported HUEY_URL scheme: 'redisish'"), ], ) def test_backend_from_url_rejects_invalid_url(url: str, message: str) -> None: - with pytest.raises(RuntimeError, match=message): + with pytest.raises(RuntimeError, match=re.escape(message)): Huey.backend_from_url(url) |
