diff options
| author | historia <historiavg@proton.me> | 2026-08-25 20:10:40 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-25 20:10:40 -0400 |
| commit | ca3c78ef577f5d8435dd10db0296c3e2fd8e69e2 (patch) | |
| tree | cff4b84c14d0ac88bc53f2aef63115352d57de90 /app/tests/test_converter_progress.py | |
| parent | 757588321d4c27889be6e8e3c12b75873ad1218d (diff) | |
| download | tts-audiobook-generator-ca3c78ef577f5d8435dd10db0296c3e2fd8e69e2.tar.gz | |
feat: stop server and exit after generating
Diffstat (limited to 'app/tests/test_converter_progress.py')
| -rw-r--r-- | app/tests/test_converter_progress.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/tests/test_converter_progress.py b/app/tests/test_converter_progress.py index 1041173..0f708a1 100644 --- a/app/tests/test_converter_progress.py +++ b/app/tests/test_converter_progress.py @@ -142,6 +142,33 @@ class ProgressEventTests(unittest.TestCase): self.assertEqual(events[-1]["kind"], "done") self.assertEqual(events[-1]["ok"], 0) + def test_book_done_reports_output_files(self): + # book_done carries the output file names the run view's summary + # lists after the TUI closes. + events = [] + converter = self.fixture.build(progress=events.append) + converter.run() + done = next(e for e in events if e["kind"] == "book_done") + self.assertEqual(done["files"], ["book_Vivian.mp3"]) + self.assertEqual(converter.current_outputs, ["book_Vivian.mp3"]) + + def test_multi_chapter_book_lists_every_chapter_file(self): + # A multi-section book (no --single-file) produces one file per + # chapter, all reported on the event. + sections = [MagicMock(text=f"chapter {n} text.", title=t) + for n, t in enumerate(("One", "Two"), 1)] + book = MagicMock(title="Book", author="Author", sections=sections) + events = [] + with patch.object(converter_mod.extractors, "extract_book", + return_value=book): + converter = self.fixture.build(progress=events.append) + converter.single_file = False + converter.run() + done = next(e for e in events if e["kind"] == "book_done") + self.assertTrue(done["ok"]) + self.assertEqual(done["files"], + ["book_Vivian_01_One.mp3", "book_Vivian_02_Two.mp3"]) + class CancelTests(unittest.TestCase): def setUp(self): |
