music-app/backend/tests/test_routers_lofi.py
Jarian Cottingham 5c283eceef chore: remove test artifacts, fix hardcoded paths, ruff clean, license
- Remove committed .coverage and test-results/ (196K screenshots); gitignore them
- Fix hardcoded  /home/userpath + venv/bin/python in test_endpoints.py
  (relative backend dir + sys.executable)
- Fix concatenated 'import json' in settings.py; bare excepts -> Exception;
  SQLAlchemy-safe is_active.is_(True); __all__ on models/schemas barrels
- ruff clean (93 fixes), MIT LICENSE, PLAN.md -> docs/, README Tests section
- 300 tests pass, 93.7% coverage
2026-08-20 21:34:15 +00:00

29 lines
982 B
Python

"""Router tests - LoFi endpoints."""
class TestListChannels:
def test_list_channels(self, client):
r = client.get("/api/lofi/channels")
assert r.status_code == 200
channels = r.json()
assert len(channels) >= 3
assert all("stream_url" in c for c in channels)
class TestAddChannel:
def test_add_channel(self, client):
r = client.post("/api/lofi/add", json={
"name": "Custom Lofi",
"stream_url": "https://example.com/stream",
"description": "Custom channel"
})
assert r.status_code == 200
data = r.json()
assert data["name"] == "Custom Lofi"
assert data["source_platform"] == "youtube"
def test_add_duplicate(self, client):
client.post("/api/lofi/add", json={"name": "Dup", "stream_url": "https://a.com"})
r = client.post("/api/lofi/add", json={"name": "Dup", "stream_url": "https://b.com"})
assert r.status_code == 400