Tag albums service: album lookup API for Home Assistant and assignment web page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 16:56:21 +00:00
co-authored by Claude Opus 5.5
commit eaf77dd0de
20 changed files with 1358 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import pytest
from fastapi.testclient import TestClient
from tag_albums.app import create_app
from tag_albums.config import Settings
from tag_albums.library import Album
from tag_albums.store import Store
TOKEN = "test-token"
AUTH = {"Authorization": f"Bearer {TOKEN}"}
class FakeLibrary:
def __init__(self):
self.queries = []
def search_albums(self, query, limit=12):
self.queries.append(query)
return [Album(artist="Tool", album="Lateralus", image="http://img/1")]
@pytest.fixture
def store(tmp_path):
s = Store(str(tmp_path / "test.sqlite3"))
yield s
s.close()
@pytest.fixture
def library():
return FakeLibrary()
@pytest.fixture
def client(store, library):
settings = Settings(db_path=":unused:", api_token=TOKEN, ha_url="http://ha", ha_token="x")
return TestClient(create_app(settings, store=store, library=library))