mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 06:20:12 +01:00
Merge branch 'fix-ArchivePolicy-0' into 'master'
update: fix regression for ArchivePolicy: 0 See merge request fdroid/fdroidserver!1371
This commit is contained in:
commit
a1c4f803de
@ -176,7 +176,7 @@ def status_update_json(apps, apks):
|
||||
validapks = 0
|
||||
if app.get('Disabled'):
|
||||
output['disabled'].append(appid)
|
||||
elif app["ArchivePolicy"] == 0:
|
||||
elif app.get("ArchivePolicy") == 0:
|
||||
output['archivePolicy0'].append(appid)
|
||||
else:
|
||||
for build in app.get('Builds', []):
|
||||
@ -1876,7 +1876,7 @@ def archive_old_apks(apps, apks, archapks, repodir, archivedir, defaultkeepversi
|
||||
|
||||
for appid, app in apps.items():
|
||||
|
||||
if app.get('ArchivePolicy'):
|
||||
if app.get('ArchivePolicy') is not None:
|
||||
keepversions = app['ArchivePolicy']
|
||||
else:
|
||||
keepversions = defaultkeepversions
|
||||
|
@ -1757,6 +1757,17 @@ class UpdateTest(unittest.TestCase):
|
||||
apks, cachechanged = fdroidserver.update.process_apks({}, 'repo', knownapks, False, apps)
|
||||
self.assertEqual([], apks)
|
||||
|
||||
def test_archive_old_apks_ArchivePolicy_0(self):
|
||||
app = fdroidserver.metadata.App()
|
||||
app.id = 'test'
|
||||
app.ArchivePolicy = 0
|
||||
apps = {app.id: app}
|
||||
with self.assertLogs(level='DEBUG') as cm:
|
||||
fdroidserver.update.archive_old_apks(apps, [], [], '', '', 3)
|
||||
self.assertEqual(cm.output, [
|
||||
"DEBUG:root:Checking archiving for test - apks:0, keepversions:0, archapks:0"
|
||||
])
|
||||
|
||||
def test_archive_old_apks(self):
|
||||
app = fdroidserver.metadata.App()
|
||||
app.id = 'test'
|
||||
|
Loading…
Reference in New Issue
Block a user