from typing import TYPE_CHECKING from django.test import RequestFactory from django.test import TestCase from django.test.utils import override_settings from django.urls import reverse from core.views import _build_base_url if TYPE_CHECKING: from django.test.client import _MonkeyPatchedWSGIResponse @override_settings(ALLOWED_HOSTS=["example.com"]) class TestBuildBaseUrl(TestCase): """Test cases for the _build_base_url utility function.""" def setUp(self) -> None: """Set up the test case with a request factory.""" self.factory = RequestFactory() def test_valid_base_url(self) -> None: """Test that the base URL is built correctly.""" base_url: str = _build_base_url() assert base_url == "https://ttvdrops.lovinator.space" class TestSitemapViews(TestCase): """Test cases for sitemap views.""" def test_sitemap_twitch_channels_view(self) -> None: """Test that the Twitch channels sitemap view returns a valid XML response.""" response: _MonkeyPatchedWSGIResponse = self.client.get( reverse("sitemap-twitch-channels"), ) assert response.status_code == 200 assert " None: """Test that the Twitch drops sitemap view returns a valid XML response.""" response: _MonkeyPatchedWSGIResponse = self.client.get( reverse("sitemap-twitch-drops"), ) assert response.status_code == 200 assert "