aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_backends_faster.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/tests/test_backends_faster.py')
-rw-r--r--app/tests/test_backends_faster.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/tests/test_backends_faster.py b/app/tests/test_backends_faster.py
index 21baea7..0da461a 100644
--- a/app/tests/test_backends_faster.py
+++ b/app/tests/test_backends_faster.py
@@ -4,6 +4,7 @@ import json
import sys
import tempfile
import unittest
+import contextlib
from pathlib import Path
from unittest.mock import patch
@@ -247,3 +248,27 @@ class MainTests(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
+
+
+class SetupScreenTests(unittest.TestCase):
+ """setup_screen: the wizard run on the hub's screen, console tail via
+ suspend."""
+
+ def test_abort_returns_one_without_executing(self):
+ with patch.object(make_voices, "_wizard", return_value=None) as mk_wizard, \
+ patch.object(make_voices, "_execute") as mk_execute:
+ rc = make_voices.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):
+ settings = {"wav_dir": Path("/x")}
+ with patch.object(make_voices, "_wizard", return_value=settings), \
+ patch.object(make_voices, "_execute",
+ return_value=0) as mk_execute, \
+ patch.object(make_voices.tui, "suspend", contextlib.nullcontext):
+ rc = make_voices.setup_screen(None)
+ self.assertEqual(rc, 0)
+ mk_execute.assert_called_once()
+ self.assertIs(mk_execute.call_args[0][0], settings)