From 882f8cfe19fe7660ec759c32bf46cbff1cf63551 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Mon, 24 Aug 2020 21:19:59 +0200 Subject: [PATCH] test_check_for_key_collisions: test with an actual collision Genrated with this script: https://gitlab.com/fdroid/fdroidserver/-/merge_requests/787#note_401275883 --- tests/publish.TestCase | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/publish.TestCase b/tests/publish.TestCase index 300ca422..38691f85 100755 --- a/tests/publish.TestCase +++ b/tests/publish.TestCase @@ -171,10 +171,6 @@ class PublishTest(unittest.TestCase): common.fill_config_defaults(common.config) publish.config = common.config - # We cannot really test the negative case here as there doesn't seem - # to be a md5 collision with text input around. - # So we just test we don't trigger an exception here and get back the same number - # of aliases as we put in apps. randomappids = [ "org.fdroid.fdroid", "a.b.c", @@ -190,6 +186,10 @@ class PublishTest(unittest.TestCase): allaliases = publish.check_for_key_collisions(allapps) self.assertEqual(len(randomappids), len(allaliases)) + allapps = {'tof.cv.mpp': App(), 'j6mX276h': App()} + self.assertEqual(publish.key_alias('tof.cv.mpp'), publish.key_alias('j6mX276h')) + self.assertRaises(SystemExit, publish.check_for_key_collisions, allapps) + def test_create_key_if_not_existing(self): try: import jks