This commit is contained in:
parent
d4fd35769d
commit
06c0af7009
6 changed files with 100 additions and 49 deletions
|
|
@ -1,3 +1,5 @@
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.test import RequestFactory
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
|
@ -5,6 +7,9 @@ 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):
|
||||
|
|
@ -16,7 +21,7 @@ class TestBuildBaseUrl(TestCase):
|
|||
|
||||
def test_valid_base_url(self) -> None:
|
||||
"""Test that the base URL is built correctly."""
|
||||
base_url = _build_base_url()
|
||||
base_url: str = _build_base_url()
|
||||
assert base_url == "https://ttvdrops.lovinator.space"
|
||||
|
||||
|
||||
|
|
@ -25,12 +30,16 @@ class TestSitemapViews(TestCase):
|
|||
|
||||
def test_sitemap_twitch_channels_view(self) -> None:
|
||||
"""Test that the Twitch channels sitemap view returns a valid XML response."""
|
||||
response = self.client.get(reverse("sitemap-twitch-channels"))
|
||||
response: _MonkeyPatchedWSGIResponse = self.client.get(
|
||||
reverse("sitemap-twitch-channels"),
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert "<urlset" in response.content.decode()
|
||||
|
||||
def test_sitemap_twitch_drops_view(self) -> None:
|
||||
"""Test that the Twitch drops sitemap view returns a valid XML response."""
|
||||
response = self.client.get(reverse("sitemap-twitch-drops"))
|
||||
response: _MonkeyPatchedWSGIResponse = self.client.get(
|
||||
reverse("sitemap-twitch-drops"),
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert "<urlset" in response.content.decode()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue