Sort_YM/tests/test_cli.py
Andrew Pimenov ff452b0162 add --source flag to read/sort an arbitrary playlist by link
report/apply/digest can now point at any Yandex Music playlist via a
share link instead of only the account's likes. Fetches the playlist's
tracks and artist genres straight into memory (no disk cache, nothing
persisted) and feeds them through the existing build_rows/render_digest/
apply_classification pipeline. apply supports --label to keep a foreign
playlist's tracks in separate genre playlists instead of merging them
into your own. Closes a gap where UnauthorizedError went uncaught anywhere.
2026-08-09 11:59:39 +03:00

18 lines
600 B
Python

import pytest
from sort_ym import cli
def test_apply_label_without_source_fails_before_any_network_access():
with pytest.raises(SystemExit, match="--source"):
cli.main(["apply", "--yes", "--label", "Друг"])
def test_apply_empty_label_fails_before_any_network_access():
with pytest.raises(SystemExit, match="пустым"):
cli.main(["apply", "--yes", "--source", "https://music.yandex.ru/users/a/playlists/1", "--label", " "])
def test_apply_without_yes_fails_regardless_of_source():
with pytest.raises(SystemExit, match="--yes"):
cli.main(["apply"])