diff options
| author | historia <historiavg@proton.me> | 2026-08-25 19:03:09 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-25 19:03:09 -0400 |
| commit | 8c9a782dfe94525dc5f0893c98fd19543648264b (patch) | |
| tree | fdff70d967ef06f0da560ca284842427cbe647a8 /app/tests/test_hub.py | |
| parent | 64e9940d43fad1bc5908b39673b03e4fdc1e8f2f (diff) | |
| download | tts-audiobook-generator-8c9a782dfe94525dc5f0893c98fd19543648264b.tar.gz | |
fix: tui errors wait for getch()
Diffstat (limited to 'app/tests/test_hub.py')
| -rw-r--r-- | app/tests/test_hub.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/tests/test_hub.py b/app/tests/test_hub.py index ec079f5..3feaa05 100644 --- a/app/tests/test_hub.py +++ b/app/tests/test_hub.py @@ -1730,6 +1730,40 @@ class ConfigureBackendsDispatchTests(unittest.TestCase): self.assertIs(result, tui.Wizard.BACK) self.assertEqual(flashes, ["kaboom"]) + def test_screen_install_runs_setup_inline_then_goes_back(self): + # No stack frame for the setup: BACK pops past the picker straight + # to the Configure menu instead of re-showing "Install Backend". + info = BackendInfo("qwen", "qwen-tts", lambda: None, lambda: 0) + with patch.object(hub._Hub, "_pick_backend", return_value=info), \ + patch.object(info, "setup_screen") as mk_setup: + result = hub._Hub(None).screen_install() + mk_setup.assert_called_once_with(None) + self.assertIs(result, tui.Wizard.BACK) + + def test_screen_install_esc_on_picker_goes_back_without_setup(self): + info = BackendInfo("qwen", "qwen-tts", lambda: None, lambda: 0) + with patch.object(hub._Hub, "_pick_backend", return_value=None), \ + patch.object(info, "setup_screen") as mk_setup: + result = hub._Hub(None).screen_install() + mk_setup.assert_not_called() + self.assertIs(result, tui.Wizard.BACK) + + def test_screen_install_flashes_on_crash_and_still_goes_back(self): + info = BackendInfo("qwen", "qwen-tts", lambda: None, lambda: 0) + flashes = [] + + def boom(scr): + raise RuntimeError("kaboom") + + with patch.object(hub._Hub, "_pick_backend", return_value=info), \ + patch.object(info, "setup_screen", boom), \ + patch.object(hub.tui, "flash", + lambda scr, text, kind="warn": + flashes.append(text)): + result = hub._Hub(None).screen_install() + self.assertIs(result, tui.Wizard.BACK) + self.assertEqual(flashes, ["kaboom"]) + def test_screen_uninstall_runs_in_task_view_and_goes_back(self): info = BackendInfo("qwen", "qwen-tts", lambda: None, lambda: 0) with patch.object(hub._Hub, "_pick_backend", return_value=info), \ |
