chiark / gitweb /
Add test for when apk icon src could not be found
authorJonas Kalderstam <jonas@kalderstam.se>
Tue, 27 Mar 2018 16:39:59 +0000 (18:39 +0200)
committerJonas Kalderstam <jonas@kalderstam.se>
Tue, 27 Mar 2018 16:39:59 +0000 (18:39 +0200)
An APK (Netflix) was found to have the following icon filename:

    \u2003\u2009\n.xml

This breaks the aapt dump parsing because it iterates line by line and
this filename goes across two lines. Consequently, icon_src will be
None (default value) when it is passed to the icons parser.

tests/update.TestCase

index 03391c181369ed50f3f132aba104ed957e1a4471..9c60adfdb1ef7a0106ee6f75194a47c0f6a979c7 100755 (executable)
@@ -647,6 +647,16 @@ class UpdateTest(unittest.TestCase):
         with self.assertRaises(fdroidserver.exception.FDroidException):
             fdroidserver.update.has_known_vulnerability('janus.apk')
 
+    def test_get_apk_icon_when_src_is_none(self):
+        config = dict()
+        fdroidserver.common.fill_config_defaults(config)
+        fdroidserver.common.config = config
+        fdroidserver.update.config = config
+
+        # pylint: disable=protected-access
+        icons_src = fdroidserver.update._get_apk_icons_src('urzip-release.apk', None)
+        assert icons_src == {}
+
 
 if __name__ == "__main__":
     parser = optparse.OptionParser()