Add YouTube
This commit is contained in:
parent
ea242955d9
commit
5bdee66207
12 changed files with 214 additions and 1 deletions
0
youtube/tests/__init__.py
Normal file
0
youtube/tests/__init__.py
Normal file
49
youtube/tests/test_youtube.py
Normal file
49
youtube/tests/test_youtube.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.test.client import _MonkeyPatchedWSGIResponse
|
||||
|
||||
|
||||
class YouTubeIndexViewTest(TestCase):
|
||||
"""Tests for the YouTube drops channels index page."""
|
||||
|
||||
def test_index_returns_200(self) -> None:
|
||||
"""The YouTube index page should return HTTP 200."""
|
||||
response: _MonkeyPatchedWSGIResponse = self.client.get(reverse("youtube:index"))
|
||||
assert response.status_code == 200
|
||||
|
||||
def test_index_displays_known_channels(self) -> None:
|
||||
"""The page should include key known channels from the partner list."""
|
||||
response: _MonkeyPatchedWSGIResponse = self.client.get(reverse("youtube:index"))
|
||||
content: str = response.content.decode()
|
||||
|
||||
assert "YouTube Drops Channels" in content
|
||||
assert "Call of Duty" in content
|
||||
assert "PlayOverwatch" in content
|
||||
assert "Hearthstone" in content
|
||||
assert "Fortnite" in content
|
||||
assert "Riot Games" in content
|
||||
assert "Ubisoft" in content
|
||||
|
||||
def test_index_includes_partner_urls(self) -> None:
|
||||
"""The page should render partner channel links from the source list."""
|
||||
response: _MonkeyPatchedWSGIResponse = self.client.get(reverse("youtube:index"))
|
||||
content: str = response.content.decode()
|
||||
|
||||
assert "https://www.youtube.com/channel/UCbLIqv9Puhyp9_ZjVtfOy7w" in content
|
||||
assert "https://www.youtube.com/user/epicfortnite" in content
|
||||
assert "https://www.youtube.com/lolesports" in content
|
||||
|
||||
def test_index_groups_partners_alphabetically(self) -> None:
|
||||
"""Partner sections should render grouped and in alphabetical order."""
|
||||
response: _MonkeyPatchedWSGIResponse = self.client.get(reverse("youtube:index"))
|
||||
content: str = response.content.decode()
|
||||
|
||||
assert "<h2>Activision (Call of Duty)</h2>" in content
|
||||
assert "<h2>Battle.net / Blizzard</h2>" in content
|
||||
assert content.index("<h2>Activision (Call of Duty)</h2>") < content.index(
|
||||
"<h2>Battle.net / Blizzard</h2>",
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue