forked from kenzuya/unshackle
refactor(api): build list, search and session services through one launch_served
This commit is contained in:
@@ -168,7 +168,9 @@ class _FakeService:
|
||||
@pytest.mark.parametrize("wanted", [None, "S01"], ids=["one-title", "episodes"])
|
||||
def test_list_tracks_stamps_the_service_flags(monkeypatch: pytest.MonkeyPatch, wanted: str | None) -> None:
|
||||
monkeypatch.setattr(handlers, "validate_service", lambda tag, request=None: "FAKE")
|
||||
monkeypatch.setattr(handlers, "setup_list_service", lambda *a, **kw: _FakeService([ep(), ep(number=2)]))
|
||||
monkeypatch.setattr(
|
||||
handlers, "launch_served", lambda *a, **kw: handlers.Launched(_FakeService([ep(), ep(number=2)]), None, None)
|
||||
)
|
||||
response = asyncio.run(handlers.list_tracks_handler({"service": "FAKE", "title_id": "t1", "wanted": wanted}))
|
||||
body = json.loads(response.body)
|
||||
titles = [e["title"] for e in body["episodes"]] if wanted else [body["title"]]
|
||||
@@ -178,7 +180,7 @@ def test_list_tracks_stamps_the_service_flags(monkeypatch: pytest.MonkeyPatch, w
|
||||
|
||||
def test_list_titles_stamps_the_service_flags(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(handlers, "validate_service", lambda tag, request=None: "FAKE")
|
||||
monkeypatch.setattr(handlers, "setup_list_service", lambda *a, **kw: _FakeService([ep()]))
|
||||
monkeypatch.setattr(handlers, "launch_served", lambda *a, **kw: handlers.Launched(_FakeService([ep()]), None, None))
|
||||
response = asyncio.run(handlers.list_titles_handler({"service": "FAKE", "title_id": "t1"}))
|
||||
title = json.loads(response.body)["titles"][0]
|
||||
assert (title["anime"], title["daily"]) == (True, True)
|
||||
|
||||
Reference in New Issue
Block a user