Petitminion 2023-11-08 14:05:08 +01:00 committed by Marge
parent 363a4b5d35
commit 7bf1d95d8e
1 changed files with 23 additions and 0 deletions

View File

@ -1427,3 +1427,26 @@ def test_upload_checks_mbid_tag(temp_signal, factories, mocker, preferences):
"error_code": "Uploading files without a MusicBrainz ID is not permitted in this pod",
"detail": "You can tag you files with MusicBrainz Picard",
}
def test_upload_checks_mbid_tag_pass(temp_signal, factories, mocker, preferences):
preferences["music__only_allow_musicbrainz_tagged_files"] = True
mocker.patch("funkwhale_api.federation.routes.outbox.dispatch")
mocker.patch("funkwhale_api.music.tasks.populate_album_cover")
mocker.patch("funkwhale_api.music.metadata.Metadata.get_picture")
track = factories["music.Track"](album__attachment_cover=None, mbid=None)
path = os.path.join(DATA_DIR, "test.mp3")
upload = factories["music.Upload"](
track=None,
audio_file__from_path=path,
import_metadata={"funkwhale": {"track": {"uuid": str(track.uuid)}}},
)
mocker.patch("funkwhale_api.music.models.TrackActor.create_entries")
with temp_signal(signals.upload_import_status_updated):
tasks.process_upload(upload_id=upload.pk)
upload.refresh_from_db()
assert upload.import_status == "finished"