Polish customer update flow and prepare ZIP installation
This commit is contained in:
@@ -48,11 +48,14 @@ class UpdaterTests(unittest.TestCase):
|
||||
self.git(self.author, "push", "origin", "main")
|
||||
|
||||
def test_fast_forward_and_requirements_change(self):
|
||||
self.assertFalse(updater.check_for_update()["update_available"])
|
||||
self.assertFalse(updater.update_package()["updated"])
|
||||
# The release URL, not the user's origin, determines the update source.
|
||||
self.git(self.install, "remote", "set-url", "origin", str(self.install / "unused-origin"))
|
||||
(self.author / "requirements.txt").write_text("requests>=3\n", encoding="utf-8")
|
||||
self.commit_and_push()
|
||||
self.assertTrue(updater.check_for_update()["update_available"])
|
||||
self.assertEqual((self.install / "requirements.txt").read_text(encoding="utf-8"), "requests>=2\n")
|
||||
result = updater.update_package()
|
||||
self.assertTrue(result["updated"])
|
||||
self.assertTrue(result["requirements_changed"])
|
||||
@@ -60,6 +63,13 @@ class UpdaterTests(unittest.TestCase):
|
||||
|
||||
def test_local_modification_is_preserved(self):
|
||||
(self.install / "version.txt").write_text("local work\n", encoding="utf-8")
|
||||
self.assertFalse(updater.check_for_update()["update_available"])
|
||||
self.assertFalse(updater.update_package()["updated"])
|
||||
(self.author / "version.txt").write_text("new release\n", encoding="utf-8")
|
||||
self.commit_and_push()
|
||||
with self.assertRaises(updater.UpdateError) as caught:
|
||||
updater.check_for_update()
|
||||
self.assertEqual(caught.exception.code, "local_changes")
|
||||
with self.assertRaises(updater.UpdateError) as caught:
|
||||
updater.update_package()
|
||||
self.assertEqual(caught.exception.code, "local_changes")
|
||||
|
||||
Reference in New Issue
Block a user