Files
Lyra/worker/tests/test_soulseek_live.py

21 lines
763 B
Python

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")