aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_hub.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/tests/test_hub.py')
-rw-r--r--app/tests/test_hub.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/tests/test_hub.py b/app/tests/test_hub.py
index 3feaa05..3547ba8 100644
--- a/app/tests/test_hub.py
+++ b/app/tests/test_hub.py
@@ -1246,6 +1246,33 @@ class PrepareRunConfigTests(unittest.TestCase):
self.assertEqual(cfg.server_url, spec.url)
self.assertIsNone(cfg.autostart_spec)
+ def test_book_files_travel_on_the_config_not_the_kwargs(self):
+ # _preflight stashes the plan in the form kwargs; keeping it there
+ # collided with convert()'s named book_files/planned parameters.
+ spec = self._spec()
+ status = BackendStatus("qwen", "qwen-tts", installed=True,
+ configured=True, servers=[spec])
+ kwargs = {"book_files": ["b.txt"], "planned": ["b.txt"]}
+ with tempfile.TemporaryDirectory() as tmp, \
+ patch.object(hub, "LOGS_FOLDER", Path(tmp)), \
+ patch.object(hub, "detect_all", return_value=[status]), \
+ patch("backends.common.server_running", return_value=False):
+ cfg = hub._prepare_run_config("qwen", kwargs)
+ self.assertNotIn("book_files", kwargs)
+ self.assertNotIn("planned", kwargs)
+ self.assertEqual(cfg.book_files, ["b.txt"])
+ self.assertEqual(cfg.planned, ["b.txt"])
+
+ def test_the_dated_log_file_exists_once_a_run_is_prepared(self):
+ # The run view advertises this file on failures; create it up front
+ # so a crash before setup_logging still points somewhere real.
+ with tempfile.TemporaryDirectory() as tmp:
+ with patch.object(hub, "LOGS_FOLDER", Path(tmp)), \
+ patch.object(hub, "detect_all", return_value=[]):
+ cfg = hub._prepare_run_config(
+ "audiocpp", {"api_url": "http://10.0.0.5:8080"})
+ self.assertTrue(Path(cfg.log_path).exists())
+
class PreflightTests(unittest.TestCase):
"""_preflight: overwrite prompts run in the TUI, plan stashed in kwargs."""