refactor(playout): generate entrypoint to string
This commit is contained in:
parent
f09d0ec3c6
commit
c6c5b1125f
3 changed files with 32 additions and 36 deletions
|
@ -21,15 +21,12 @@ from .fixtures import TEST_STREAM_CONFIGS
|
|||
"stream_config",
|
||||
TEST_STREAM_CONFIGS,
|
||||
)
|
||||
def test_generate_entrypoint(tmp_path: Path, stream_config: Config, version, snapshot):
|
||||
entrypoint_filepath = tmp_path / "radio.liq"
|
||||
|
||||
def test_generate_entrypoint(stream_config: Config, version, snapshot):
|
||||
with mock.patch(
|
||||
"libretime_playout.liquidsoap.entrypoint.here",
|
||||
Path("/fake"),
|
||||
):
|
||||
generate_entrypoint(
|
||||
entrypoint_filepath,
|
||||
found = generate_entrypoint(
|
||||
log_filepath=Path("/var/log/radio.log"),
|
||||
config=stream_config,
|
||||
preferences=StreamPreferences(
|
||||
|
@ -43,7 +40,6 @@ def test_generate_entrypoint(tmp_path: Path, stream_config: Config, version, sna
|
|||
version=version,
|
||||
)
|
||||
|
||||
found = entrypoint_filepath.read_text(encoding="utf-8")
|
||||
assert found == snapshot
|
||||
|
||||
|
||||
|
@ -59,19 +55,21 @@ 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",
|
||||
entrypoint_filepath.write_text(
|
||||
generate_entrypoint(
|
||||
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(),
|
||||
),
|
||||
info=Info(
|
||||
station_name="LibreTime",
|
||||
),
|
||||
version=get_liquidsoap_version(),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
check_call(["liquidsoap", "--check", str(entrypoint_filepath)])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue