test(playout): check unsupported liquidsoap aac output

This commit is contained in:
jo 2023-05-29 10:46:31 +02:00 committed by Kyle Robbertze
parent 67af6cfa53
commit 285bb11da0
1 changed files with 43 additions and 2 deletions

View File

@ -1,5 +1,5 @@
from pathlib import Path from pathlib import Path
from subprocess import check_call from subprocess import CalledProcessError, check_call, check_output
from unittest import mock from unittest import mock
import pytest import pytest
@ -10,7 +10,7 @@ from libretime_playout.liquidsoap.models import Info, StreamPreferences
from libretime_playout.liquidsoap.version import get_liquidsoap_version from libretime_playout.liquidsoap.version import get_liquidsoap_version
from .conftest import LIQ_VERSION from .conftest import LIQ_VERSION
from .fixtures import TEST_STREAM_CONFIGS from .fixtures import TEST_STREAM_CONFIGS, make_config_with_stream
@pytest.mark.parametrize( @pytest.mark.parametrize(
@ -73,3 +73,44 @@ def test_liquidsoap_syntax(tmp_path: Path, stream_config):
) )
check_call(["liquidsoap", "--check", str(entrypoint_filepath)]) check_call(["liquidsoap", "--check", str(entrypoint_filepath)])
@pytest.mark.skipif(
LIQ_VERSION >= (2, 0, 0),
reason="unsupported liquidsoap >= 2.0.0",
)
def test_liquidsoap_unsupported_output_aac(tmp_path: Path):
entrypoint_filepath = tmp_path / "radio.liq"
log_filepath = tmp_path / "radio.log"
entrypoint_filepath.write_text(
generate_entrypoint(
log_filepath=log_filepath,
config=make_config_with_stream(
outputs={
"icecast": [
{
"enabled": True,
"mount": "main.aac",
"source_password": "hackme",
"audio": {"format": "aac", "bitrate": 128},
}
]
}
),
preferences=StreamPreferences(
input_fade_transition=0.0,
message_format=0,
message_offline="LibreTime - offline",
),
info=Info(
station_name="LibreTime",
),
version=get_liquidsoap_version(),
),
encoding="utf-8",
)
with pytest.raises(CalledProcessError) as exception:
check_output(["liquidsoap", "--check", str(entrypoint_filepath)])
assert b"You must be missing an optional dependency." in exception.value.stdout