mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-08 20:39:08 +00:00
Added leading zeros in track_number.Fixed issue #592
This commit is contained in:
@@ -18,7 +18,6 @@ class TestGenius:
|
||||
assert track.base_url == "https://genius.com"
|
||||
|
||||
def test_get_lyrics(self, track, monkeypatch):
|
||||
|
||||
def mocked_urlopen(url, timeout=None):
|
||||
class DummyHTTPResponse:
|
||||
def read(self):
|
||||
@@ -30,7 +29,6 @@ class TestGenius:
|
||||
assert track.get_lyrics() == "amazing lyrics!"
|
||||
|
||||
def test_lyrics_not_found_error(self, track, monkeypatch):
|
||||
|
||||
def mocked_urlopen(url, timeout=None):
|
||||
raise urllib.request.HTTPError("", "", "", "", "")
|
||||
|
||||
|
||||
@@ -15,17 +15,21 @@ class TestLyricWikia:
|
||||
# `LyricWikia` class uses the 3rd party method `lyricwikia.get_lyrics`
|
||||
# internally and there is no need to test a 3rd party library as they
|
||||
# have their own implementation of tests.
|
||||
monkeypatch.setattr("lyricwikia.get_lyrics", lambda a, b, c, d: "awesome lyrics!")
|
||||
monkeypatch.setattr(
|
||||
"lyricwikia.get_lyrics", lambda a, b, c, d: "awesome lyrics!"
|
||||
)
|
||||
track = LyricWikia("Lyricwikia", "Lyricwikia")
|
||||
assert track.get_lyrics() == "awesome lyrics!"
|
||||
|
||||
def test_lyrics_not_found_error(self, monkeypatch):
|
||||
|
||||
def lyricwikia_lyrics_not_found(msg):
|
||||
raise lyricwikia.LyricsNotFound(msg)
|
||||
|
||||
# Wrap `lyricwikia.LyricsNotFound` with `exceptions.LyricsNotFound` error.
|
||||
monkeypatch.setattr("lyricwikia.get_lyrics", lambda a, b, c, d: lyricwikia_lyrics_not_found("Nope, no lyrics."))
|
||||
monkeypatch.setattr(
|
||||
"lyricwikia.get_lyrics",
|
||||
lambda a, b, c, d: lyricwikia_lyrics_not_found("Nope, no lyrics."),
|
||||
)
|
||||
track = LyricWikia("Lyricwikia", "Lyricwikia")
|
||||
with pytest.raises(exceptions.LyricsNotFound):
|
||||
track.get_lyrics()
|
||||
|
||||
Reference in New Issue
Block a user