mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Add more basic tests
This commit is contained in:
@@ -2,14 +2,34 @@
|
||||
|
||||
import spotdl
|
||||
|
||||
raw_song = "http://open.spotify.com/track/2e0jnySVkYF1pvBlpoNX1Y"
|
||||
raw_song = 'http://open.spotify.com/track/2e0jnySVkYF1pvBlpoNX1Y'
|
||||
|
||||
def test_spotify():
|
||||
expected_title = "David André Østby - Tilbake (SAEVIK Remix)"
|
||||
def test_spotify_title():
|
||||
expect_title = 'David André Østby - Tilbake (SAEVIK Remix)'
|
||||
title = spotdl.generate_songname(raw_song)
|
||||
assert title == expected_title
|
||||
assert title == expect_title
|
||||
|
||||
def test_youtube_url():
|
||||
expect_url = 'youtube.com/watch?v=zkD4smbefbc'
|
||||
url = spotdl.generate_youtube_url(raw_song)
|
||||
assert url == expect_url
|
||||
|
||||
def test_youtube_title():
|
||||
expected_url = "youtube.com/watch?v=zkD4smbefbc"
|
||||
url = spotdl.generate_youtube_url(raw_song)
|
||||
assert url == expected_url
|
||||
expect_title = 'Tilbake (SAEVIK Remix) [Feat. Marie Hognestad] - David André Østby'
|
||||
content = spotdl.go_pafy(raw_song)
|
||||
title = spotdl.get_youtube_title(content)
|
||||
assert title == expect_title
|
||||
|
||||
def test_check_exists():
|
||||
expect_check = False
|
||||
content = spotdl.go_pafy(raw_song)
|
||||
music_file = spotdl.misc.generate_filename(content.title)
|
||||
music_file = spotdl.misc.fix_decoding(music_file)
|
||||
check = spotdl.check_exists(music_file, raw_song)
|
||||
assert check == expect_check
|
||||
|
||||
def test_download():
|
||||
expect_download = True
|
||||
content = spotdl.go_pafy(raw_song)
|
||||
download = download_song(content)
|
||||
assert download == expect_download
|
||||
|
||||
Reference in New Issue
Block a user