fix get_charts, add get_explore (#797)
* get_charts: move to a new class * get_charts: update * get_explore: init
This commit is contained in:
parent
7f42e8d5f0
commit
f6295e50be
6 changed files with 247 additions and 128 deletions
8
tests/mixins/test_charts.py
Normal file
8
tests/mixins/test_charts.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
class TestCharts:
|
||||
def test_get_charts(self, yt, yt_oauth):
|
||||
charts = yt_oauth.get_charts()
|
||||
assert len(charts) >= 3
|
||||
charts = yt.get_charts(country="US")
|
||||
assert len(charts) == 4 # countries, videos, genres, artists
|
||||
charts = yt.get_charts(country="BE")
|
||||
assert len(charts) == 3 # countries, videos, artists
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
import pytest
|
||||
|
||||
|
||||
class TestExplore:
|
||||
def test_get_mood_playlists(self, yt):
|
||||
categories = yt.get_mood_categories()
|
||||
|
|
@ -10,12 +7,25 @@ class TestExplore:
|
|||
playlists = yt.get_mood_playlists(categories[cat][0]["params"])
|
||||
assert len(playlists) > 0
|
||||
|
||||
@pytest.mark.skip(reason="disabled for now due to #787")
|
||||
def test_get_charts(self, yt, yt_oauth):
|
||||
charts = yt_oauth.get_charts()
|
||||
# songs section appears to be removed currently (US)
|
||||
assert len(charts) >= 3
|
||||
charts = yt.get_charts(country="US")
|
||||
assert len(charts) == 5
|
||||
charts = yt.get_charts(country="BE")
|
||||
assert len(charts) == 4
|
||||
def test_get_explore(self, yt, yt_oauth):
|
||||
assert len(yt.get_explore()) == 5
|
||||
|
||||
explore = yt_oauth.get_explore()
|
||||
assert len(explore) >= 5
|
||||
|
||||
assert all(item["audioPlaylistId"].startswith("OLA") for item in explore["new_releases"])
|
||||
|
||||
# check top_songs if present
|
||||
assert all(item["videoId"] for item in explore.get("top_songs", {"items": []})["items"])
|
||||
|
||||
assert all(
|
||||
item["videoId"] and all(artist["id"] for artist in item["artists"])
|
||||
for item in explore["trending"]["items"]
|
||||
)
|
||||
|
||||
assert all(item["videoId"] for item in explore["trending"]["items"])
|
||||
|
||||
assert all(
|
||||
item["duration"] and item["podcast"]["id"] and item["podcast"]["name"]
|
||||
for item in explore["top_episodes"]
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue