feat: add real slskd Soulseek client and opt-in live test
This commit is contained in:
@@ -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")
|
||||
Reference in New Issue
Block a user