aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_selfupdate.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-09-02 18:36:34 -0400
committerhistoria <historiavg@proton.me>2026-09-02 18:36:34 -0400
commit268b6734b22cc251bf340882ea9debbd079b9a48 (patch)
tree41dcfb983af96e5a3ad95a83d81298f3587f588c /app/tests/test_selfupdate.py
parentf14b80f6b42a0d0891718eb6284336b1694795cf (diff)
downloadtts-audiobook-generator-268b6734b22cc251bf340882ea9debbd079b9a48.tar.gz
rename generator to tts-audiobook-generator. remove pointless upgrade flashes.
Diffstat (limited to 'app/tests/test_selfupdate.py')
-rw-r--r--app/tests/test_selfupdate.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/tests/test_selfupdate.py b/app/tests/test_selfupdate.py
index bf2f6b3..b69c6e3 100644
--- a/app/tests/test_selfupdate.py
+++ b/app/tests/test_selfupdate.py
@@ -155,6 +155,9 @@ class UpdateGeneratorTests(unittest.TestCase):
self.assertEqual(self.config.read_bytes(), b"# user settings\n")
self.assertTrue(any("already up to date" in line
for line in self.emitted))
+ # A no-op update needs no restart, so no reminder either.
+ self.assertFalse(any("Restart to apply" in line
+ for line in self.emitted))
def test_fetch_failure_short_circuits(self):
run = self._patch_git(fetch_rc=128)
@@ -200,6 +203,24 @@ class UpdateGeneratorTests(unittest.TestCase):
self.assertEqual(run.call_args_list[1][1]["emit"],
self.emitted.append)
+ def test_successful_reset_prints_the_restart_reminder(self):
+ # The hub no longer flashes after the task view's summary, so the
+ # console output itself must tell the user to restart.
+ self._patch_git()
+ rc = selfupdate.update_generator(root=self.root,
+ emit=self.emitted.append)
+ self.assertEqual(rc, 0)
+ self.assertTrue(any("Restart to apply" in line
+ for line in self.emitted))
+
+ def test_failed_reset_prints_no_restart_reminder(self):
+ self._patch_git(reset_rc=1)
+ rc = selfupdate.update_generator(root=self.root,
+ emit=self.emitted.append)
+ self.assertEqual(rc, 1)
+ self.assertFalse(any("Restart to apply" in line
+ for line in self.emitted))
+
def test_reset_failure_still_restores_the_snapshot(self):
self._patch_git(reset_rc=1, on_reset=lambda: self.config.write_bytes(
b"# upstream settings\n"))