mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Fix tests
This commit is contained in:
@@ -258,7 +258,7 @@ def remove_duplicates(tracks):
|
|||||||
def content_available(url):
|
def content_available(url):
|
||||||
try:
|
try:
|
||||||
response = urllib.request.urlopen(url)
|
response = urllib.request.urlopen(url)
|
||||||
except HTTPError:
|
except urllib.request.HTTPError:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return response.getcode() < 300
|
return response.getcode() < 300
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ class TestMethodCalls:
|
|||||||
|
|
||||||
def test_pafy_getbestthumb(self, content_fixture):
|
def test_pafy_getbestthumb(self, content_fixture):
|
||||||
thumbnail = patcher._getbestthumb(content_fixture)
|
thumbnail = patcher._getbestthumb(content_fixture)
|
||||||
assert thumbnail == "https://i.ytimg.com/vi/3nQNiWdeH2Q/maxresdefault.jpg"
|
assert thumbnail == "https://i.ytimg.com/vi/3nQNiWdeH2Q/hqdefault.jpg"
|
||||||
|
|
||||||
def test_pafy_getbestthumb_without_ytdl(self, content_fixture):
|
def test_pafy_getbestthumb_without_ytdl(self, content_fixture):
|
||||||
content_fixture._ydl_info["thumbnails"][0]["url"] = None
|
content_fixture._ydl_info["thumbnails"][0]["url"] = None
|
||||||
thumbnail = patcher._getbestthumb(content_fixture)
|
thumbnail = patcher._getbestthumb(content_fixture)
|
||||||
assert thumbnail == "https://i.ytimg.com/vi/3nQNiWdeH2Q/maxresdefault.jpg"
|
assert thumbnail == "https://i.ytimg.com/vi/3nQNiWdeH2Q/sddefault.jpg"
|
||||||
|
|
||||||
|
|
||||||
def test_pafy_content_available(self):
|
def test_pafy_content_available(self):
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class TestFetchAlbumsFromArtist:
|
|||||||
return albums
|
return albums
|
||||||
|
|
||||||
def test_len(self, albums_from_artist_fixture):
|
def test_len(self, albums_from_artist_fixture):
|
||||||
assert len(albums_from_artist_fixture) == 53
|
assert len(albums_from_artist_fixture) == 54
|
||||||
|
|
||||||
def test_zeroth_album_name(self, albums_from_artist_fixture):
|
def test_zeroth_album_name(self, albums_from_artist_fixture):
|
||||||
assert albums_from_artist_fixture[0]["name"] == "Revolution Radio"
|
assert albums_from_artist_fixture[0]["name"] == "Revolution Radio"
|
||||||
|
|||||||
Reference in New Issue
Block a user