fix(server): announce track title not album in messages; cover error paths

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-08 20:07:09 -07:00
parent f4ffd23ed8
commit 257ed5e0a5
2 changed files with 19 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
import pytest
from server import actions, mf
@@ -15,14 +17,14 @@ def make_lidarr_album_hit():
def test_started_message_mentions_source_and_title():
msg = actions.started_message(make_yt_hit())
assert "Under My Skin" in msg
assert "Together" in msg
assert "Avril Lavigne" in msg
assert "YouTube" in msg
def test_done_message_mentions_title():
msg = actions.done_message(make_yt_hit())
assert "Under My Skin" in msg
assert "Together" in msg
assert "Avril Lavigne" in msg
@@ -58,3 +60,17 @@ def test_perform_lidarr_album_fallsthrough_to_youtube(monkeypatch):
quality="best", root="/media/music")
assert yt_calls["hit"] is yt_hit
assert result["path"] == "/media/music/Avril Lavigne/youtube"
def test_perform_lidarr_album_no_release_no_fallback_raises(monkeypatch):
monkeypatch.setattr(mf, "act_lidarr_album",
lambda hit, root, search_all, dry_run: False)
hit = make_lidarr_album_hit()
with pytest.raises(RuntimeError):
actions.perform_fetch(hit, [hit], quality="best", root="/media/music")
def test_failed_message_mentions_title_and_artist():
msg = actions.failed_message(make_yt_hit())
assert "Together" in msg
assert "Avril Lavigne" in msg