aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_backends.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-26 17:46:48 -0400
committerhistoria <historiavg@proton.me>2026-08-26 17:46:48 -0400
commit6ccb6d443d2fb871b43d96ea61a95bc3e6a92355 (patch)
treed692ddccd6ec212cf4ebabb25a85e83af479d0fe /app/tests/test_backends.py
parentc147087c9d4707bffaeee58d390653637a21cce8 (diff)
downloadtts-audiobook-generator-6ccb6d443d2fb871b43d96ea61a95bc3e6a92355.tar.gz
feat: combined install/configure tui screens into one menu, removed extraneous wizard screens
Diffstat (limited to 'app/tests/test_backends.py')
-rw-r--r--app/tests/test_backends.py36
1 files changed, 28 insertions, 8 deletions
diff --git a/app/tests/test_backends.py b/app/tests/test_backends.py
index dc2b4d0..15a8649 100644
--- a/app/tests/test_backends.py
+++ b/app/tests/test_backends.py
@@ -352,20 +352,28 @@ if __name__ == "__main__":
class QwenSetupScreenTests(unittest.TestCase):
- """qwen.setup_screen: the wizard run on the hub's screen."""
+ """qwen.setup_screen: a question-free setup on the hub's screen.
- def test_abort_returns_one_without_executing(self):
+ The qwen wizard asks nothing (ports live in Settings, the speaker is
+ chosen on Generate), so it cannot be aborted: an already-installed
+ package is a no-op flash, everything else runs in the task view.
+ """
+
+ def test_already_installed_flashes_and_skips_the_task_view(self):
from backends import qwen
- with patch.object(qwen, "_wizard", return_value=None) as mk_wizard, \
- patch.object(qwen, "_execute_steps") as mk_steps:
+ settings = {"do_install": False}
+ with patch.object(qwen, "_wizard", return_value=settings) as mk_wizard, \
+ patch.object(qwen.tui, "flash") as mk_flash, \
+ patch.object(qwen.taskview, "run_steps") as mk_run:
rc = qwen.setup_screen(None)
- self.assertEqual(rc, 1)
+ self.assertEqual(rc, 0)
mk_wizard.assert_called_once()
- mk_steps.assert_not_called()
+ mk_flash.assert_called_once()
+ mk_run.assert_not_called()
- def test_success_runs_the_tail_in_the_task_view(self):
+ def test_missing_package_runs_the_tail_in_the_task_view(self):
from backends import qwen
- settings = {"custom_port": 7860}
+ settings = {"do_install": True}
steps = [qwen.taskview.TaskStep("t", lambda emit, cancel: 0)]
with patch.object(qwen, "_wizard", return_value=settings), \
patch.object(qwen, "_execute_steps",
@@ -379,6 +387,18 @@ class QwenSetupScreenTests(unittest.TestCase):
mk_run.assert_called_once()
self.assertEqual(mk_run.call_args[0][2], steps)
+ def test_wizard_has_no_port_or_speaker_settings(self):
+ # The screens for CustomVoice/Base ports and the built-in speaker
+ # are gone; settings only carry whether to pip install.
+ from backends import qwen
+ args = qwen.build_parser().parse_args([])
+ with patch.object(qwen, "_is_installed", return_value=False):
+ settings = qwen._wizard(None, args)
+ self.assertEqual(settings, {"do_install": True})
+ with patch.object(qwen, "_is_installed", return_value=True):
+ settings = qwen._wizard(None, args)
+ self.assertEqual(settings, {"do_install": False})
+
class QwenUninstallTests(unittest.TestCase):
"""qwen.uninstall: stop both servers, then pip-uninstall the package."""