diff options
| author | historia <historiavg@proton.me> | 2026-08-24 03:22:29 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-24 03:22:29 -0400 |
| commit | 471798cf5e967b2d1bceb02d12a47fe9ad1cbed1 (patch) | |
| tree | b974708bb60424fa5d39825e54813ed133bccc42 /app/tests/test_hub.py | |
| parent | 8e54a42db2690e0ac7f09fd400b29ad2fb2c9c5a (diff) | |
| download | tts-audiobook-generator-471798cf5e967b2d1bceb02d12a47fe9ad1cbed1.tar.gz | |
feat: tui ffmpeg check
Diffstat (limited to 'app/tests/test_hub.py')
| -rw-r--r-- | app/tests/test_hub.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/tests/test_hub.py b/app/tests/test_hub.py index b3a17e8..749d2e6 100644 --- a/app/tests/test_hub.py +++ b/app/tests/test_hub.py @@ -160,6 +160,37 @@ class HubMenuTests(unittest.TestCase): ["Convert books...", "Set up a backend...", "Configure a backend...", "Server...", "Settings...", "Quit"]) + def test_ffmpeg_warning_shown_when_missing(self): + # ffmpeg not on PATH → a red notice is passed above the table. + captured = {} + + def fake_menu(stdscr, title, options, **kwargs): + captured["notice_lines"] = kwargs.get("notice_lines") + return "quit" + + screen = FakeScreen() + with patch.object(hub.tui, "menu", fake_menu), \ + patch.object(hub, "detect_all", return_value=[]), \ + patch.object(hub.shutil, "which", return_value=None): + hub._hub_menu(screen) + self.assertEqual(captured["notice_lines"], + [("Warning: ffmpeg not installed!", "err")]) + + def test_ffmpeg_warning_hidden_when_installed(self): + # ffmpeg on PATH → no notice is passed at all. + captured = {} + + def fake_menu(stdscr, title, options, **kwargs): + captured["notice_lines"] = kwargs.get("notice_lines") + return "quit" + + screen = FakeScreen() + with patch.object(hub.tui, "menu", fake_menu), \ + patch.object(hub, "detect_all", return_value=[]), \ + patch.object(hub.shutil, "which", return_value="/usr/bin/ffmpeg"): + hub._hub_menu(screen) + self.assertIsNone(captured["notice_lines"]) + def test_convert_with_no_available_backend_offers_setup(self): # One installed-but-not-ready backend → Convert is offered. The # convert menu lists no available backend, so only "Set up a |
