test(playout): generated liquidsoap script syntax
This commit is contained in:
parent
654105e865
commit
0c2b2c6b63
|
@ -9,14 +9,13 @@ import pytest
|
|||
from libretime_shared.logging import setup_logger
|
||||
|
||||
from libretime_playout.liquidsoap.client import LiquidsoapConnection
|
||||
from libretime_playout.liquidsoap.version import get_liquidsoap_version
|
||||
|
||||
from ..conftest import LIQ_VERSION, LIQ_VERSION_STR
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
setup_logger("debug")
|
||||
|
||||
LIQ_VERSION = get_liquidsoap_version()
|
||||
LIQ_VERSION_STR = ".".join(map(str, LIQ_VERSION))
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
LIQ_VERSION >= (2, 0, 0),
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
from libretime_playout.liquidsoap.version import get_liquidsoap_version
|
||||
|
||||
LIQ_VERSION = get_liquidsoap_version()
|
||||
LIQ_VERSION_STR = ".".join(map(str, LIQ_VERSION))
|
|
@ -1,4 +1,5 @@
|
|||
from pathlib import Path
|
||||
from subprocess import check_call
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
@ -6,7 +7,9 @@ import pytest
|
|||
from libretime_playout.config import Config
|
||||
from libretime_playout.liquidsoap.entrypoint import generate_entrypoint
|
||||
from libretime_playout.liquidsoap.models import Info, StreamPreferences
|
||||
from libretime_playout.liquidsoap.version import get_liquidsoap_version
|
||||
|
||||
from .conftest import LIQ_VERSION
|
||||
from .fixtures import TEST_STREAM_CONFIGS
|
||||
|
||||
|
||||
|
@ -42,3 +45,33 @@ def test_generate_entrypoint(tmp_path: Path, stream_config: Config, version, sna
|
|||
|
||||
found = entrypoint_filepath.read_text(encoding="utf-8")
|
||||
assert found == snapshot
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
LIQ_VERSION >= (2, 0, 0),
|
||||
reason="unsupported liquidsoap >= 2.0.0",
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"stream_config",
|
||||
TEST_STREAM_CONFIGS,
|
||||
)
|
||||
def test_liquidsoap_syntax(tmp_path: Path, stream_config):
|
||||
entrypoint_filepath = tmp_path / "radio.liq"
|
||||
log_filepath = tmp_path / "radio.log"
|
||||
|
||||
generate_entrypoint(
|
||||
entrypoint_filepath,
|
||||
log_filepath=log_filepath,
|
||||
config=stream_config,
|
||||
preferences=StreamPreferences(
|
||||
input_fade_transition=0.0,
|
||||
message_format=0,
|
||||
message_offline="LibreTime - offline",
|
||||
),
|
||||
info=Info(
|
||||
station_name="LibreTime",
|
||||
),
|
||||
version=get_liquidsoap_version(),
|
||||
)
|
||||
|
||||
check_call(["liquidsoap", "--check", str(entrypoint_filepath)])
|
||||
|
|
Loading…
Reference in New Issue