aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_selfupdate.py
diff options
context:
space:
mode:
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"))