- add neutral wishlist payload helpers while keeping legacy Spotify aliases - route wishlist removal and classification through generic track data - keep API and service compatibility for existing callers
20 lines
722 B
Python
20 lines
722 B
Python
import pytest
|
|
|
|
from core.wishlist.classification import classify_wishlist_track
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"spotify_data,expected",
|
|
[
|
|
({"album": {"album_type": "single"}}, "singles"),
|
|
({"track_data": {"album": {"album_type": "single"}}}, "singles"),
|
|
({"album": {"album_type": "ep"}}, "singles"),
|
|
({"album": {"album_type": "album"}}, "albums"),
|
|
({"album": {"album_type": "compilation"}}, "albums"),
|
|
({"album": {"total_tracks": 4}}, "singles"),
|
|
({"album": {"total_tracks": 8}}, "albums"),
|
|
({}, "albums"),
|
|
],
|
|
)
|
|
def test_classify_wishlist_track(spotify_data, expected):
|
|
assert classify_wishlist_track({"spotify_data": spotify_data}) == expected
|