mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
Merge 'obfusk-master-patch-83286' into 'master'
* read_pkg_args: common: add test case for read_pkg_args() read_pkg_args(): allow appid_vercode.apk in addition to appid:vercode fdroid/fdroidserver!901
This commit is contained in:
commit
b9435d3113
2 changed files with 44 additions and 0 deletions
|
@ -599,7 +599,9 @@ def read_pkg_args(appid_versionCode_pairs, allow_vercodes=False):
|
|||
if not appid_versionCode_pairs:
|
||||
return vercodes
|
||||
|
||||
apk_regex = re.compile(r'_(\d+)\.apk$')
|
||||
for p in appid_versionCode_pairs:
|
||||
p = apk_regex.sub(r':\1', p)
|
||||
if allow_vercodes and ':' in p:
|
||||
package, vercode = p.split(':')
|
||||
try:
|
||||
|
|
|
@ -1712,6 +1712,48 @@ class CommonTest(unittest.TestCase):
|
|||
)
|
||||
self.assertSequenceEqual(expected, sorted(components))
|
||||
|
||||
def test_read_pkg_args(self):
|
||||
allow_vercodes = False
|
||||
self.assertEqual(
|
||||
{'org.fdroid.fdroid': []},
|
||||
fdroidserver.common.read_pkg_args(['org.fdroid.fdroid'], allow_vercodes)
|
||||
)
|
||||
self.assertNotEqual(
|
||||
{'com.example': ['123456']},
|
||||
fdroidserver.common.read_pkg_args(['com.example:123456'], allow_vercodes)
|
||||
)
|
||||
|
||||
allow_vercodes = True
|
||||
self.assertEqual(
|
||||
{'org.fdroid.fdroid': []},
|
||||
fdroidserver.common.read_pkg_args(['org.fdroid.fdroid'], allow_vercodes)
|
||||
)
|
||||
self.assertEqual(
|
||||
{'com.example': ['123456']},
|
||||
fdroidserver.common.read_pkg_args(['com.example:123456'], allow_vercodes)
|
||||
)
|
||||
self.assertEqual(
|
||||
{'org.debian_kit': ['6']},
|
||||
fdroidserver.common.read_pkg_args(['org.debian_kit_6.apk'], allow_vercodes)
|
||||
)
|
||||
appid_versionCode_pairs = (
|
||||
'org.fdroid.fdroid:1',
|
||||
'com.example:12345',
|
||||
'com.example:67890',
|
||||
)
|
||||
self.assertEqual(
|
||||
{'com.example': ['12345', '67890'], 'org.fdroid.fdroid': ['1']},
|
||||
fdroidserver.common.read_pkg_args(appid_versionCode_pairs, allow_vercodes)
|
||||
)
|
||||
appid_versionCode_pairs = (
|
||||
'com.example:67890',
|
||||
'org.c_base.c_beam_29.apk',
|
||||
)
|
||||
self.assertEqual(
|
||||
{'com.example': ['67890'], 'org.c_base.c_beam': ['29']},
|
||||
fdroidserver.common.read_pkg_args(appid_versionCode_pairs, allow_vercodes)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue