Fix bug in unique tracks on different albums
This commit is contained in:
@ -39,8 +39,16 @@ class MopidyRequest:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mopidy_track_request_data(**kwargs):
|
||||
return MopidyRequest(**kwargs).request_json
|
||||
def mopidy_track_request_data():
|
||||
return MopidyRequest().request_json
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mopidy_track_diff_album_request_data(**kwargs):
|
||||
mb_album_id = "0c56c457-afe1-4679-baab-759ba8dd2a58"
|
||||
return MopidyRequest(
|
||||
album="Gold", musicbrainz_album_id=mb_album_id
|
||||
).request_json
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@ -38,6 +38,31 @@ def test_scrobble_mopidy_track(client, mopidy_track_request_data):
|
||||
assert scrobble.media_obj.title == "Same in the End"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_scrobble_mopidy_same_track_different_album(
|
||||
client, mopidy_track_request_data, mopidy_track_diff_album_request_data
|
||||
):
|
||||
url = reverse('scrobbles:mopidy-websocket')
|
||||
response = client.post(
|
||||
url, mopidy_track_request_data, content_type='application/json'
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.data == {'scrobble_id': 1}
|
||||
scrobble = Scrobble.objects.get(id=1)
|
||||
assert scrobble.media_obj.album.name == "Sublime"
|
||||
|
||||
response = client.post(
|
||||
url,
|
||||
mopidy_track_diff_album_request_data,
|
||||
content_type='application/json',
|
||||
)
|
||||
|
||||
scrobble = Scrobble.objects.get(id=2)
|
||||
assert scrobble.media_obj.__class__ == Track
|
||||
assert scrobble.media_obj.album.name == "Gold"
|
||||
assert scrobble.media_obj.title == "Same in the End"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_scrobble_mopidy_podcast(client, mopidy_podcast_request_data):
|
||||
url = reverse('scrobbles:mopidy-websocket')
|
||||
|
||||
Reference in New Issue
Block a user