Now store track file mimetype in database

This commit is contained in:
Eliot Berriot 2018-02-18 23:46:15 +01:00
commit ddea5f1825
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
6 changed files with 99 additions and 1 deletions

View file

@ -1,9 +1,12 @@
import os
import pytest
from funkwhale_api.music import models
from funkwhale_api.music import importers
from funkwhale_api.music import tasks
DATA_DIR = os.path.dirname(os.path.abspath(__file__))
def test_can_store_release_group_id_on_album(factories):
album = factories['music.Album']()
@ -48,3 +51,15 @@ def test_import_job_is_bound_to_track_file(factories, mocker):
tasks.import_job_run(import_job_id=job.pk)
job.refresh_from_db()
assert job.track_file.track == track
@pytest.mark.parametrize('extention,mimetype', [
('ogg', 'audio/ogg'),
('mp3', 'audio/mpeg'),
])
def test_audio_track_mime_type(extention, mimetype, factories):
name = '.'.join(['test', extention])
path = os.path.join(DATA_DIR, name)
tf = factories['music.TrackFile'](audio_file__from_path=path)
assert tf.mimetype == mimetype