aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_backends.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/tests/test_backends.py')
-rw-r--r--app/tests/test_backends.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/app/tests/test_backends.py b/app/tests/test_backends.py
index 0e260be..9ecedd1 100644
--- a/app/tests/test_backends.py
+++ b/app/tests/test_backends.py
@@ -34,7 +34,7 @@ class RegistryTests(unittest.TestCase):
def test_every_entry_has_detect_setup_and_uninstall(self):
for info in REGISTRY:
self.assertTrue(callable(info.detect), info.key)
- self.assertTrue(callable(info.setup_tui), info.key)
+ self.assertTrue(callable(info.setup_screen), info.key)
self.assertTrue(callable(info.uninstall), info.key)
def test_get_returns_entry_by_key(self):
@@ -296,3 +296,28 @@ class RemoteSuppressionTests(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
+
+
+class QwenSetupScreenTests(unittest.TestCase):
+ """qwen.setup_screen: the wizard run on the hub's screen."""
+
+ def test_abort_returns_one_without_executing(self):
+ from backends import qwen
+ with patch.object(qwen, "_wizard", return_value=None) as mk_wizard, \
+ patch.object(qwen, "_execute") as mk_execute:
+ rc = qwen.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):
+ import contextlib
+ from backends import qwen
+ settings = {"custom_port": 7860}
+ with patch.object(qwen, "_wizard", return_value=settings), \
+ patch.object(qwen, "_execute", return_value=0) as mk_execute, \
+ patch.object(qwen.tui, "suspend", contextlib.nullcontext):
+ rc = qwen.setup_screen(None)
+ self.assertEqual(rc, 0)
+ mk_execute.assert_called_once()
+ self.assertIs(mk_execute.call_args[0][0], settings)