Add Redis configuration, integrate Celery, and sort fields in models
All checks were successful
Deploy to Server / deploy (push) Successful in 49s
All checks were successful
Deploy to Server / deploy (push) Successful in 49s
This commit is contained in:
parent
ef2010464c
commit
d99579ed2b
15 changed files with 451 additions and 253 deletions
|
|
@ -1,9 +1,14 @@
|
|||
import importlib
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from django.urls import resolve
|
||||
from django.urls import reverse
|
||||
|
||||
from config.urls import urlpatterns
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterable
|
||||
from types import ModuleType
|
||||
|
|
@ -50,3 +55,43 @@ def test_debug_tools_not_present_while_testing() -> None:
|
|||
patterns = list(_pattern_strings(mod))
|
||||
assert not any("silk" in p for p in patterns)
|
||||
assert not any("__debug__" in p or "debug" in p for p in patterns)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url_name",
|
||||
[
|
||||
"sitemap",
|
||||
"sitemap-static",
|
||||
"sitemap-twitch-channels",
|
||||
"sitemap-twitch-drops",
|
||||
"sitemap-twitch-others",
|
||||
"sitemap-kick",
|
||||
"sitemap-youtube",
|
||||
],
|
||||
)
|
||||
def test_static_sitemap_urls(url_name: str) -> None:
|
||||
"""Test that static sitemap URLs resolve correctly."""
|
||||
url: str = reverse(url_name)
|
||||
resolved_view: str = resolve(url).view_name
|
||||
assert resolved_view == url_name
|
||||
|
||||
|
||||
def test_app_url_inclusion() -> None:
|
||||
"""Test that app-specific URLs are included in urlpatterns."""
|
||||
assert any("core.urls" in str(pattern) for pattern in urlpatterns)
|
||||
assert any("twitch.urls" in str(pattern) for pattern in urlpatterns)
|
||||
assert any("kick.urls" in str(pattern) for pattern in urlpatterns)
|
||||
assert any("youtube.urls" in str(pattern) for pattern in urlpatterns)
|
||||
|
||||
|
||||
def test_media_serving_in_development() -> None:
|
||||
"""Test that media URLs are served in development mode."""
|
||||
if settings.DEBUG:
|
||||
assert any("MEDIA_URL" in str(pattern) for pattern in urlpatterns)
|
||||
|
||||
|
||||
def test_debug_toolbar_and_silk_urls() -> None:
|
||||
"""Test that debug toolbar and Silk URLs are included when appropriate."""
|
||||
if not settings.TESTING:
|
||||
assert any("silk.urls" in str(pattern) for pattern in urlpatterns)
|
||||
assert any("debug_toolbar" in str(pattern) for pattern in urlpatterns)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue