Filter the import search from the list of library books

The search through CWA gave no results for books that the full list shows. The search now filters the list that "Show all stories in the library" loads, by title, author and site.

The buttons stay disabled until the answer comes. A book that the user imports leaves the list.
This commit is contained in:
tim
2026-10-06 16:59:09 +02:00
parent eea6adcc91
commit 9a48356155
6 changed files with 100 additions and 63 deletions
+1 -10
View File
@@ -151,18 +151,9 @@ def test_library_candidates_and_search(fake):
"formats": ["epub"],
}
]
# A search shows only the matches from a story site.
fake.books.append(FakeBook(2, "uuid-2", "Test Novel", publisher="A Publisher", epub=b"x"))
fake.books.append(FakeBook(4, "uuid-4", "Other Story", publisher="www.royalroad.com", epub=b"x"))
assert [b["id"] for b in orchestrator.search_library("test")] == [1, 2]
assert orchestrator.library_candidates("test") == candidates
assert [b["id"] for b in orchestrator.library_candidates("story")] == [1, 4]
assert orchestrator.library_candidates("nothing") == []
assert orchestrator.library_candidates(" ") == []
story_id = add_story()
orchestrator.link_story(story_id, "uuid-1")
assert [b["id"] for b in orchestrator.library_candidates()] == [4]
assert orchestrator.library_candidates("test") == []
assert orchestrator.library_candidates() == []
assert orchestrator.search_library("test")[0]["tracked_as"] == "Test Story"
with pytest.raises(KeyError):
orchestrator.link_story(story_id, "uuid-nope")