Refactor URL handling to use BASE_URL across the application and add base_url context processor
All checks were successful
Deploy to Server / deploy (push) Successful in 22s
All checks were successful
Deploy to Server / deploy (push) Successful in 22s
This commit is contained in:
parent
999ab368e2
commit
d4fd35769d
11 changed files with 250 additions and 167 deletions
25
core/tests/test_base_url.py
Normal file
25
core/tests/test_base_url.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.test import RequestFactory
|
||||
|
||||
from core.base_url import build_absolute_uri
|
||||
from core.base_url import get_current_site
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from config.tests.test_seo import WSGIRequest
|
||||
from core.base_url import _TTVDropsSite
|
||||
|
||||
|
||||
def test_build_absolute_uri_uses_base_url() -> None:
|
||||
"""Test that build_absolute_uri uses the base URL from settings."""
|
||||
request: WSGIRequest = RequestFactory().get("/test-path/")
|
||||
assert (
|
||||
build_absolute_uri(request=request)
|
||||
== "https://ttvdrops.lovinator.space/test-path/"
|
||||
)
|
||||
|
||||
|
||||
def test_get_current_site_from_base_url() -> None:
|
||||
"""Test that get_current_site returns the correct site based on the base URL."""
|
||||
site: _TTVDropsSite = get_current_site(None)
|
||||
assert site.domain == "ttvdrops.lovinator.space"
|
||||
Loading…
Add table
Add a link
Reference in a new issue