Fix #772: Prevent skipping on file import if album_mbid is different

This commit is contained in:
Eliot Berriot 2019-03-27 12:13:25 +01:00
parent d5712ea2fb
commit 31227b8641
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
3 changed files with 32 additions and 4 deletions

View file

@ -133,6 +133,29 @@ def test_can_create_track_from_file_metadata_fid_existing_album_artist(
assert track.artist == artist
def test_can_create_track_from_file_metadata_distinct_release_mbid(factories):
"""Cf https://dev.funkwhale.audio/funkwhale/funkwhale/issues/772"""
artist = factories["music.Artist"]()
album = factories["music.Album"](artist=artist)
track = factories["music.Track"](album=album, artist=artist)
metadata = {
"artist": artist.name,
"album": album.title,
"title": track.title,
"track_number": 4,
"fid": "https://hello",
"musicbrainz_artistid": artist.mbid,
"musicbrainz_albumid": str(uuid.uuid4()),
}
new_track = tasks.get_track_from_import_metadata(metadata)
# the returned track should be different from the existing one, and mapped
# to a new album, because the albumid is different
assert new_track.album != album
assert new_track != track
def test_can_create_track_from_file_metadata_federation(factories, mocker, r_mock):
metadata = {
"artist": "Artist",