[checkupdates] Only update if version code is grater

Don't change the current versions in case there is an error in the check_* methods or upstream screwed up.
This commit is contained in:
Jochen Sprickerhof 2021-06-15 20:53:05 +02:00 committed by Jochen Sprickerhof
parent 37e3142610
commit 39c55d799b
2 changed files with 15 additions and 1 deletions

View file

@ -60,6 +60,16 @@ class CheckupdatesTest(unittest.TestCase):
self.assertEqual(build.versionName, '1.1.9')
self.assertEqual(build.commit, '1.1.9')
with mock.patch(
'fdroidserver.checkupdates.check_http', lambda app: ('1.7.9', 10107)
):
with mock.patch('fdroidserver.metadata.write_metadata', mock.Mock()):
with mock.patch('subprocess.call', lambda cmd: 0):
fdroidserver.checkupdates.checkupdates_app(app)
build = app['Builds'][-1]
self.assertEqual(build.versionName, '1.1.9')
self.assertEqual(build.commit, '1.1.9')
def test_autoupdatemode_suffix(self):
fdroidserver.checkupdates.options = mock.Mock()
fdroidserver.checkupdates.options.auto = 'bleh'