aircox-radiocampus/aircox/tests/controllers/test_sound_file.py
Chris Tactic 55123c386d #132 | #121: backoffice / dev-1.0-121 (#131)
cfr #121

Co-authored-by: Christophe Siraut <d@tobald.eu.org>
Co-authored-by: bkfox <thomas bkfox net>
Co-authored-by: Thomas Kairos <thomas@bkfox.net>
Reviewed-on: rc/aircox#131
Co-authored-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
Co-committed-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
2024-04-28 22:02:09 +02:00

80 lines
1.9 KiB
Python

import pytest
from django.conf import settings as conf
from aircox.controllers.sound_file import SoundFile
# FIXME: use from tests.models.sound
@pytest.fixture
def path_infos():
return {
"test/20220101_10h13_1_sample_1.mp3": {
"year": 2022,
"month": 1,
"day": 1,
"hour": 10,
"minute": 13,
"n": 1,
"name": "Sample 1",
},
"test/20220102_10h13_sample_2.mp3": {
"year": 2022,
"month": 1,
"day": 2,
"hour": 10,
"minute": 13,
"n": None,
"name": "Sample 2",
},
"test/20220103_1_sample_3.mp3": {
"year": 2022,
"month": 1,
"day": 3,
"n": 1,
"name": "Sample 3",
},
"test/20220104_sample_4.mp3": {
"year": 2022,
"month": 1,
"day": 4,
"name": "Sample 4",
},
"test/20220105.mp3": {
"year": 2022,
"month": 1,
"day": 5,
"name": "20220105",
},
}
@pytest.fixture
def sound_files(path_infos):
return {k: r for k, r in ((path, SoundFile(conf.MEDIA_ROOT + "/" + path)) for path in path_infos.keys())}
@pytest.fixture
def sound_file(sound_files):
return next(sound_files.items())
def test_sound_path(sound_files):
for path, sound_file in sound_files.items():
assert path == sound_file.sound_path
class TestSoundFile:
def sound_path(self, sound_file):
assert sound_file[0] == sound_file[1].sound_path
def sync(self):
raise NotImplementedError("test is not implemented")
def create_episode_sound(self):
raise NotImplementedError("test is not implemented")
def _on_delete(self):
raise NotImplementedError("test is not implemented")