Skip to content

Commit

Permalink
add proper testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
krishsharma0413 committed Dec 30, 2023
1 parent 097e25e commit faf4617
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/test_spotify_fetch_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def test_spotify_playlist_fetch_one():
"track_url": None,
"playlist_num": 1,
"spotify_id": "2GpBrAoCwt48fxjgjlzMd4",
'tempo': 74.656,
} == songs[0]


Expand All @@ -53,6 +54,7 @@ def test_spotify_playlist_fetch_more():
"year": "2012",
"playlist_num": 1,
"spotify_id": "4rzfv0JLZfVhOhbSQ8o5jZ",
'tempo': 135.016,
},
{
"album": "Wellness & Dreaming Source",
Expand All @@ -66,6 +68,7 @@ def test_spotify_playlist_fetch_more():
"playlist_num": 2,
"track_url": None,
"spotify_id": "5o3jMYOSbaVz3tkgwhELSV",
'tempo': 137.805,
},
{
"album": "This Is Happening",
Expand All @@ -79,6 +82,7 @@ def test_spotify_playlist_fetch_more():
"year": "2010",
"playlist_num": 3,
"spotify_id": "4Cy0NHJ8Gh0xMdwyM9RkQm",
'tempo': 134.99,
},
{
"album": "Glenn Horiuchi Trio / Gelenn Horiuchi Quartet: Mercy / Jump Start "
Expand All @@ -94,6 +98,7 @@ def test_spotify_playlist_fetch_more():
"track_url": None,
"playlist_num": 4,
"spotify_id": "6hvFrZNocdt2FcKGCSY5NI",
'tempo': 114.767,
},
{
"album": "All The Best (Spanish Version)",
Expand All @@ -107,6 +112,7 @@ def test_spotify_playlist_fetch_more():
"year": "2007",
"playlist_num": 5,
"spotify_id": "2E2znCPaS8anQe21GLxcvJ",
'tempo': 122.318,
},
] == songs

Expand All @@ -128,6 +134,7 @@ def test_spotify_track_fetch_one():
"track_url": None,
"playlist_num": 1,
"spotify_id": "2GpBrAoCwt48fxjgjlzMd4",
'tempo': 74.656,
} == songs[0]


Expand All @@ -148,6 +155,7 @@ def test_spotify_album_fetch_one():
"year": "2012",
"playlist_num": 1,
"spotify_id": "5EoKQDGE2zxrTfRFZF52u5",
'tempo': 120.009,
} == songs[0]


Expand All @@ -169,6 +177,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 1,
"spotify_id": "69Yw7H4bRIwfIxL0ZCZy8y",
'tempo': 120.955,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -182,6 +191,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 2,
"spotify_id": "5GGSjXZeTgX9sKYBtl8K6U",
'tempo': 147.384,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -195,6 +205,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 3,
"spotify_id": "0Ssh20fuVhmasLRJ97MLnp",
'tempo': 152.769,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -208,6 +219,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 4,
"spotify_id": "2LasW39KJDE4VH9hTVNpE2",
'tempo': 115.471,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -221,6 +233,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 5,
"spotify_id": "6jXrIu3hWbmJziw34IHIwM",
'tempo': 145.124,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -234,6 +247,7 @@ def test_spotify_album_fetch_more():
"track_url": None,
"playlist_num": 6,
"spotify_id": "5dHmGuUeRgp5f93G69tox5",
'tempo': 108.544,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -247,6 +261,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 7,
"spotify_id": "2KPj0oB7cUuHQ3FuardOII",
'tempo': 159.156,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -260,6 +275,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 8,
"spotify_id": "34CcBjL9WqEAtnl2i6Hbxa",
'tempo': 118.48,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -273,6 +289,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 9,
"spotify_id": "1x9ak6LGIazLhfuaSIEkhG",
'tempo': 112.623,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -286,6 +303,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 10,
"spotify_id": "4CITL18Tos0PscW1amCK4j",
'tempo': 145.497,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -299,6 +317,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 11,
"spotify_id": "1e9Tt3nKBwRbuaU79kN3dn",
'tempo': 126.343,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -312,6 +331,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 12,
"spotify_id": "0uHqoDT7J2TYBsJx6m4Tvi",
'tempo': 172.274,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -325,6 +345,8 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 13,
"spotify_id": "3MIueGYoNiyBNfi5ukDgAK",
'tempo': 146.712,

},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -338,6 +360,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 14,
"spotify_id": "34WAOFWdJ83a3YYrDAZTjm",
'tempo': 128.873,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -351,6 +374,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 15,
"spotify_id": "2AFIPUlApcUwGEgOSDwoBz",
'tempo': 122.986,
},
{
"album": "Queen II (Deluxe Remastered Version)",
Expand All @@ -364,6 +388,7 @@ def test_spotify_album_fetch_more():
"year": "1974",
"playlist_num": 16,
"spotify_id": "4G4Sf18XkFvNTV5vAxiQyd",
'tempo': 169.166,
},
] == songs
assert (len(songs)) == 16
Expand All @@ -374,6 +399,7 @@ def test_spotify_playlist_fetch_local_file():
url = "https://open.spotify.com/playlist/1TWZ36xJ8qkvSeAQQUvU5b?si=ad56b6bb085b4ab9"
item_type = "playlist"
songs = fetch_tracks(sp, item_type, url)
print(songs)
assert [
{
"album": "Yoshi's Island",
Expand All @@ -387,5 +413,6 @@ def test_spotify_playlist_fetch_local_file():
"year": "",
"playlist_num": 1,
"spotify_id": None,
"tempo": None,
}
] == songs
] == songs

0 comments on commit faf4617

Please sign in to comment.