feat: add real slskd Soulseek client and opt-in live test

This commit is contained in:
Jonathan
2026-07-10 22:45:36 +02:00
parent b5931a7b66
commit 7b4b7ef1aa
3 changed files with 156 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
import os
import pytest
from lyra_worker.adapters._slskd import SlskdClient
pytestmark = pytest.mark.skipif(
not (os.environ.get("LYRA_LIVE_TESTS") and os.environ.get("SLSKD_URL") and os.environ.get("SLSKD_API_KEY")),
reason="live slskd test; set LYRA_LIVE_TESTS=1 + SLSKD_URL + SLSKD_API_KEY to run",
)
def test_live_search_returns_results():
client = SlskdClient({"slskd.url": os.environ["SLSKD_URL"], "slskd.api_key": os.environ["SLSKD_API_KEY"]})
results = client.search_album("John Mayer", "Continuum")
assert isinstance(results, list)
# Soulseek results depend on who's online; assert shape, not count.
for r in results:
assert r["source_ref"] and r["track_count"] >= 1
assert r["format"] in ("FLAC", "MP3")