diff options
| author | historia <historiavg@proton.me> | 2026-08-24 20:17:11 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-24 20:17:11 -0400 |
| commit | cf24fa74188cee498eeb7b94422371c952278d4a (patch) | |
| tree | 302244a8b09b9173fbde542874cfa549f26be7a2 /app/tests/test_backends_faster.py | |
| parent | 0522e73b68291af62e43c387ab8f9b8ffa2cab47 (diff) | |
| download | tts-audiobook-generator-cf24fa74188cee498eeb7b94422371c952278d4a.tar.gz | |
fix: stepping back steps in tui
Diffstat (limited to 'app/tests/test_backends_faster.py')
| -rw-r--r-- | app/tests/test_backends_faster.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/tests/test_backends_faster.py b/app/tests/test_backends_faster.py index 21baea7..0da461a 100644 --- a/app/tests/test_backends_faster.py +++ b/app/tests/test_backends_faster.py @@ -4,6 +4,7 @@ import json import sys import tempfile import unittest +import contextlib from pathlib import Path from unittest.mock import patch @@ -247,3 +248,27 @@ class MainTests(unittest.TestCase): if __name__ == "__main__": unittest.main() + + +class SetupScreenTests(unittest.TestCase): + """setup_screen: the wizard run on the hub's screen, console tail via + suspend.""" + + def test_abort_returns_one_without_executing(self): + with patch.object(make_voices, "_wizard", return_value=None) as mk_wizard, \ + patch.object(make_voices, "_execute") as mk_execute: + rc = make_voices.setup_screen(None) + self.assertEqual(rc, 1) + mk_wizard.assert_called_once() + mk_execute.assert_not_called() + + def test_success_executes_the_tail_under_suspend(self): + settings = {"wav_dir": Path("/x")} + with patch.object(make_voices, "_wizard", return_value=settings), \ + patch.object(make_voices, "_execute", + return_value=0) as mk_execute, \ + patch.object(make_voices.tui, "suspend", contextlib.nullcontext): + rc = make_voices.setup_screen(None) + self.assertEqual(rc, 0) + mk_execute.assert_called_once() + self.assertIs(mk_execute.call_args[0][0], settings) |
