aircox-radiocampus/aircox/tests/management/test_sounds_monitor.py
Chris Tactic fd4c765dc4 #123: Sound Monitoring (#125)
110fac70a6 n'est pas lié à #123 (tu peux l'ignorer ici mais rc/aircox#122 (comment))

04f5c3208a : nettoyage d'anciens tests, je ne suis pas parvenu à rétablir le dernier, je l'ai préfixé avec broken_. Il y aurait aussi à supprimer/corriger aircox/tests/management/_test_sound_monitor.py

5a75f42808 : le correctif qui permet d'ajouter des sons dans une émission à l'aide de la commande `sounds_scan`.

Co-authored-by: Christophe Siraut <d@tobald.eu.org>
Reviewed-on: rc/aircox#125
Co-authored-by: Chris Tactic <chris@tacticasbl.be>
Co-committed-by: Chris Tactic <chris@tacticasbl.be>
2023-11-08 18:38:49 +01:00

24 lines
606 B
Python

import pytest
import os
from django.core.management import call_command
from django.conf import settings
wav = (
b"RIFF$\x00\x00\x00WAVEfmt \x10\x00\x00\x00\x01\x00\x02\x00D\xac\x00\x00"
b"\x10\xb1\x02\x00\x04\x00\x10\x00data\x00\x00\x00\x00"
)
@pytest.mark.django_db
def test_adding_a_sound(programs, fs):
p0 = programs[0]
assert len(p0.sound_set.all()) == 0
s0 = os.path.join(
settings.PROJECT_ROOT, "static/media/%s/archives/sound.wav" % p0.path
)
fs.create_file(s0, contents=wav)
call_command("sounds_monitor", "-s")
assert len(p0.sound_set.all()) == 1