mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
Support AutoUpdateMode: Version without pattern
Since 24dd6740
UpdateCheckMode: Tags uses the found tag instead of
regenerating it from the AutoUpdateMode pattern making the pattern
superfluous. This adds support for dropping the pattern and a test case.
This commit is contained in:
parent
4c339b4ef4
commit
185da60d93
@ -492,7 +492,7 @@ def checkupdates_app(app):
|
||||
logging.warning("Can't auto-update app with no CurrentVersionCode: " + app.id)
|
||||
elif mode in ('None', 'Static'):
|
||||
pass
|
||||
elif mode.startswith('Version '):
|
||||
elif mode.startswith('Version'):
|
||||
pattern = mode[8:]
|
||||
suffix = ''
|
||||
if pattern.startswith('+'):
|
||||
|
@ -447,7 +447,7 @@ valuetypes = {
|
||||
["AntiFeatures"]),
|
||||
|
||||
FieldValidator("Auto Update Mode",
|
||||
r"^(Version .+|None)$",
|
||||
r"^(Version.*|None)$",
|
||||
["AutoUpdateMode"]),
|
||||
|
||||
FieldValidator("Update Check Mode",
|
||||
|
@ -106,6 +106,38 @@ class CheckupdatesTest(unittest.TestCase):
|
||||
fdroidserver.checkupdates.checkupdates_app(app)
|
||||
wrmock.assert_called_with(app.metadatapath, app)
|
||||
|
||||
def test_checkupdates_app_tags(self):
|
||||
fdroidserver.checkupdates.options = mock.Mock()
|
||||
fdroidserver.checkupdates.options.auto = 'bleh'
|
||||
fdroidserver.checkupdates.config = {}
|
||||
|
||||
app = fdroidserver.metadata.App()
|
||||
app.id = 'loop.starts.shooting'
|
||||
app.metadatapath = 'metadata/' + app.id + '.yml'
|
||||
app.CurrentVersion = '1.1.8'
|
||||
app.CurrentVersionCode = 10108
|
||||
app.UpdateCheckMode = 'Tags'
|
||||
app.AutoUpdateMode = 'Version'
|
||||
|
||||
build = fdroidserver.metadata.Build()
|
||||
build.versionCode = app.CurrentVersionCode
|
||||
build.versionName = app.CurrentVersion
|
||||
app['Builds'].append(build)
|
||||
|
||||
with mock.patch('fdroidserver.checkupdates.check_tags', lambda app,
|
||||
pattern: (None, 'bla', None)):
|
||||
fdroidserver.checkupdates.checkupdates_app(app)
|
||||
|
||||
with mock.patch('fdroidserver.checkupdates.check_tags', lambda app,
|
||||
pattern: ('1.1.9', 10109, 'v1.1.9')):
|
||||
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, 'v1.1.9')
|
||||
|
||||
def test_check_http(self):
|
||||
fdroidserver.checkupdates.options = mock.Mock()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user