diff --git a/tests/metadata/com.politedroid.txt b/tests/metadata/com.politedroid.txt new file mode 100644 index 00000000..526be787 --- /dev/null +++ b/tests/metadata/com.politedroid.txt @@ -0,0 +1,36 @@ +Categories:Time +License:GPL-3.0 +Web Site: +Source Code:https://github.com/miguelvps/PoliteDroid +Issue Tracker:https://github.com/miguelvps/PoliteDroid/issues + +Auto Name:Polite Droid +Summary:Calendar tool +Description: +Activates silent mode during calendar events. +. + +Repo Type:git +Repo:https://github.com/miguelvps/PoliteDroid.git + +Build:1.2,3 + commit=6a548e4b19 + target=android-10 + +Build:1.3,4 + commit=ad865b57bf3ac59580f38485608a9b1dda4fa7dc + target=android-15 + +Build:1.4,5 + commit=456bd615f3fbe6dff06433928cf7ea20073601fb + target=android-10 + +Build:1.5,6 + commit=v1.5 + gradle=yes + +Archive Policy:4 versions +Auto Update Mode:Version v%v +Update Check Mode:Tags +Current Version:1.5 +Current Version Code:6 diff --git a/tests/repo/categories.txt b/tests/repo/categories.txt index a4664e81..d4a50083 100644 --- a/tests/repo/categories.txt +++ b/tests/repo/categories.txt @@ -7,3 +7,4 @@ None Phone & SMS Security System +Time diff --git a/tests/repo/com.politedroid_3.apk b/tests/repo/com.politedroid_3.apk new file mode 100644 index 00000000..19634ba9 Binary files /dev/null and b/tests/repo/com.politedroid_3.apk differ diff --git a/tests/repo/com.politedroid_4.apk b/tests/repo/com.politedroid_4.apk new file mode 100644 index 00000000..7ef46599 Binary files /dev/null and b/tests/repo/com.politedroid_4.apk differ diff --git a/tests/repo/com.politedroid_5.apk b/tests/repo/com.politedroid_5.apk new file mode 100644 index 00000000..35e0ed6c Binary files /dev/null and b/tests/repo/com.politedroid_5.apk differ diff --git a/tests/repo/com.politedroid_6.apk b/tests/repo/com.politedroid_6.apk new file mode 100644 index 00000000..f48d8082 Binary files /dev/null and b/tests/repo/com.politedroid_6.apk differ diff --git a/tests/repo/index.xml b/tests/repo/index.xml index 4b85a960..9836fc3e 100644 --- a/tests/repo/index.xml +++ b/tests/repo/index.xml @@ -159,6 +159,71 @@ b4964fd759edaa54e65bb476d0276880 + + com.politedroid + 2017-06-23 + 2017-06-23 + Polite Droid + Calendar tool + com.politedroid.6.png + <p>Activates silent mode during calendar events.</p> + GPL-3.0 + Time + Time + + https://github.com/miguelvps/PoliteDroid + https://github.com/miguelvps/PoliteDroid/issues + 1.5 + 6 + + 1.5 + 6 + com.politedroid_6.apk + 70c2f776a2bac38a58a7d521f96ee0414c6f0fb1de973c3ca8b10862a009247d + 16578 + 14 + 21 + 2017-06-23 + b4964fd759edaa54e65bb476d0276880 + READ_CALENDAR,RECEIVE_BOOT_COMPLETED + + + 1.4 + 5 + com.politedroid_5.apk + 5bdbfa071cca4b8d05ced41d6b28763595d6e8096cca5bbf0f9253c9a2622e5d + 18817 + 3 + 10 + 2017-06-23 + b4964fd759edaa54e65bb476d0276880 + READ_CALENDAR,RECEIVE_BOOT_COMPLETED + + + 1.3 + 4 + com.politedroid_4.apk + c809bdff83715fbf919f3840ee09869b038e209378b906e135ee40d3f0e1f075 + 18489 + 3 + 3 + 2017-06-23 + b4964fd759edaa54e65bb476d0276880 + READ_CALENDAR,READ_EXTERNAL_STORAGE,READ_PHONE_STATE,RECEIVE_BOOT_COMPLETED,WRITE_EXTERNAL_STORAGE + + + 1.2 + 3 + com.politedroid_3.apk + 665d03d61ebc642289fda697f71a59305b0202b16cafc5ffdae91cbe91f0b25d + 17552 + 3 + 3 + 2017-06-23 + b4964fd759edaa54e65bb476d0276880 + READ_CALENDAR,READ_EXTERNAL_STORAGE,READ_PHONE_STATE,RECEIVE_BOOT_COMPLETED,WRITE_EXTERNAL_STORAGE + + info.guardianproject.urzip 2016-06-23 diff --git a/tests/run-tests b/tests/run-tests index a3d62d27..6afaf5cd 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -237,7 +237,119 @@ test -e repo/obb.main.twoversions_1101617_src.tar.gz.asc # we can't easily reproduce the timestamps for things, so just hardcode them sed -i --expression='s,timestamp="[0-9]*",timestamp="1480431575",' repo/index.xml -diff $WORKSPACE/tests/repo/index.xml repo/index.xml +diff -uw $WORKSPACE/tests/repo/index.xml repo/index.xml + + +#------------------------------------------------------------------------------# +echo_header 'test per-app "Archive Policy"' + +REPOROOT=`create_test_dir` +cd $REPOROOT +cp $WORKSPACE/tests/keystore.jks $REPOROOT/ +$fdroid init --keystore keystore.jks --repo-keyalias=sova +echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py +echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py +echo "accepted_formats = ['txt']" >> config.py +test -d metadata || mkdir metadata +cp $WORKSPACE/tests/metadata/com.politedroid.txt metadata/ +test -d repo || mkdir repo +cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/ +sed -i 's,archive_older = [0-9],archive_older = 3,' config.py + +$fdroid update --pretty --nosign +test `grep '' archive/index.xml | wc -l` -eq 0 +test `grep '' repo/index.xml | wc -l` -eq 4 +grep -F com.politedroid_3.apk repo/index.xml +grep -F com.politedroid_4.apk repo/index.xml +grep -F com.politedroid_5.apk repo/index.xml +grep -F com.politedroid_6.apk repo/index.xml +test -e repo/com.politedroid_3.apk +test -e repo/com.politedroid_4.apk +test -e repo/com.politedroid_5.apk +test -e repo/com.politedroid_6.apk + +echo "enable one app in the repo" +sed -i 's,^Archive Policy:4,Archive Policy:1,' metadata/com.politedroid.txt +$fdroid update --pretty --nosign +test `grep '' archive/index.xml | wc -l` -eq 3 +test `grep '' repo/index.xml | wc -l` -eq 1 +grep -F com.politedroid_3.apk archive/index.xml +grep -F com.politedroid_4.apk archive/index.xml +grep -F com.politedroid_5.apk archive/index.xml +grep -F com.politedroid_6.apk repo/index.xml +test -e archive/com.politedroid_3.apk +test -e archive/com.politedroid_4.apk +test -e archive/com.politedroid_5.apk +test -e repo/com.politedroid_6.apk + + +#------------------------------------------------------------------------------# +echo_header 'test moving old APKs to and from the archive' + +REPOROOT=`create_test_dir` +cd $REPOROOT +cp $WORKSPACE/tests/keystore.jks $REPOROOT/ +$fdroid init --keystore keystore.jks --repo-keyalias=sova +echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py +echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py +echo "accepted_formats = ['txt']" >> config.py +test -d metadata || mkdir metadata +cp $WORKSPACE/tests/metadata/com.politedroid.txt metadata/ +sed -i '/Archive Policy:/d' metadata/com.politedroid.txt +test -d repo || mkdir repo +cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/ +sed -i 's,archive_older = [0-9],archive_older = 3,' config.py + +$fdroid update --pretty --nosign +test `grep '' archive/index.xml | wc -l` -eq 1 +test `grep '' repo/index.xml | wc -l` -eq 3 +grep -F com.politedroid_3.apk archive/index.xml +grep -F com.politedroid_4.apk repo/index.xml +grep -F com.politedroid_5.apk repo/index.xml +grep -F com.politedroid_6.apk repo/index.xml +test -e archive/com.politedroid_3.apk +test -e repo/com.politedroid_4.apk +test -e repo/com.politedroid_5.apk +test -e repo/com.politedroid_6.apk + +sed -i 's,archive_older = 3,archive_older = 1,' config.py +$fdroid update --pretty --nosign +test `grep '' archive/index.xml | wc -l` -eq 3 +test `grep '' repo/index.xml | wc -l` -eq 1 +grep -F com.politedroid_3.apk archive/index.xml +grep -F com.politedroid_4.apk archive/index.xml +grep -F com.politedroid_5.apk archive/index.xml +grep -F com.politedroid_6.apk repo/index.xml +test -e archive/com.politedroid_3.apk +test -e archive/com.politedroid_4.apk +test -e archive/com.politedroid_5.apk +test -e repo/com.politedroid_6.apk + +# disabling deletes from the archive +sed -i 's/Build:1.3,4/Build:1.3,4\n disable=testing deletion/' metadata/com.politedroid.txt +$fdroid update --pretty --nosign +test `grep '' archive/index.xml | wc -l` -eq 2 +test `grep '' repo/index.xml | wc -l` -eq 1 +grep -F com.politedroid_3.apk archive/index.xml +! grep -F com.politedroid_4.apk archive/index.xml +grep -F com.politedroid_5.apk archive/index.xml +grep -F com.politedroid_6.apk repo/index.xml +test -e archive/com.politedroid_3.apk +! test -e archive/com.politedroid_4.apk +test -e archive/com.politedroid_5.apk +test -e repo/com.politedroid_6.apk + +# disabling deletes from the repo, and promotes one from the archive +sed -i 's/Build:1.5,6/Build:1.5,6\n disable=testing deletion/' metadata/com.politedroid.txt +$fdroid update --pretty --nosign +test `grep '' archive/index.xml | wc -l` -eq 1 +test `grep '' repo/index.xml | wc -l` -eq 1 +grep -F com.politedroid_3.apk archive/index.xml +grep -F com.politedroid_5.apk repo/index.xml +! grep -F com.politedroid_6.apk repo/index.xml +test -e archive/com.politedroid_3.apk +test -e repo/com.politedroid_5.apk +! test -e repo/com.politedroid_6.apk #------------------------------------------------------------------------------# diff --git a/tests/stats/known_apks.txt b/tests/stats/known_apks.txt index 329213b7..6d457a6f 100644 --- a/tests/stats/known_apks.txt +++ b/tests/stats/known_apks.txt @@ -1,3 +1,7 @@ +com.politedroid_3.apk repo/com.politedroid 2017-06-23 +com.politedroid_4.apk repo/com.politedroid 2017-06-23 +com.politedroid_5.apk repo/com.politedroid 2017-06-23 +com.politedroid_6.apk repo/com.politedroid 2017-06-23 fake.ota.update_1234.zip fake.ota.update 2016-03-10 obb.main.oldversion_1444412523.apk obb.main.oldversion 2013-12-31 obb.main.twoversions_1101613.apk obb.main.twoversions 2015-10-12 diff --git a/tests/update.TestCase b/tests/update.TestCase index 7e1626c5..cd47e020 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -205,8 +205,16 @@ class UpdateTest(unittest.TestCase): apps = fdroidserver.metadata.read_metadata(xref=True) knownapks = fdroidserver.common.KnownApks() apks, cachechanged = fdroidserver.update.scan_apks({}, 'repo', knownapks, False) - self.assertEqual(len(apks), 7) + self.assertEqual(len(apks), 11) apk = apks[0] + self.assertEqual(apk['packageName'], 'com.politedroid') + self.assertEqual(apk['versionCode'], 3) + self.assertEqual(apk['minSdkVersion'], '3') + self.assertEqual(apk['targetSdkVersion'], '3') + self.assertFalse('maxSdkVersion' in apk) + apk = apks[4] + self.assertEqual(apk['packageName'], 'obb.main.oldversion') + self.assertEqual(apk['versionCode'], 1444412523) self.assertEqual(apk['minSdkVersion'], '4') self.assertEqual(apk['targetSdkVersion'], '18') self.assertFalse('maxSdkVersion' in apk)