rename all cases where "sig" or "signature" should be "signer"

* "signer": standard SHA-256 fingerprint of the APK Signing Certificate
* "sig": fdroid-specific MD5 fingerprint of the APK Signing Certificate
This commit is contained in:
Hans-Christoph Steiner
2023-01-19 11:51:38 +01:00
parent 3924a5fb9f
commit e3550171aa
82 changed files with 301 additions and 281 deletions

View File

@@ -46,7 +46,7 @@ public class TestUtils {
return getApk(versionCode, "signature", null);
}
public static Apk getApk(int versionCode, String signature, String releaseChannel) {
public static Apk getApk(int versionCode, String signer, String releaseChannel) {
Apk apk = new Apk();
apk.repoAddress = "http://www.example.com/fdroid/repo";
apk.canonicalRepoAddress = "http://www.example.com/fdroid/repo";
@@ -57,7 +57,7 @@ public class TestUtils {
apk.apkFile = new FileV1("Test Apk", "hash", null, null);
apk.size = 10000;
apk.compatible = true;
apk.sig = signature;
apk.signer = signer;
apk.releaseChannels = releaseChannel == null ?
null : Collections.singletonList(releaseChannel);
return apk;

View File

@@ -37,7 +37,7 @@ public class SuggestedVersionTest {
public void singleRepoSingleSig() {
App singleApp = TestUtils.getApp();
singleApp.installedVersionCode = 1;
singleApp.installedSig = TestUtils.FDROID_SIG;
singleApp.installedSigner = TestUtils.FDROID_SIG;
Apk apk1 = TestUtils.getApk(1, TestUtils.FDROID_SIG, Apk.RELEASE_CHANNEL_STABLE);
Apk apk2 = TestUtils.getApk(2, TestUtils.FDROID_SIG, Apk.RELEASE_CHANNEL_STABLE);
Apk apk3 = TestUtils.getApk(3, TestUtils.FDROID_SIG, Apk.RELEASE_CHANNEL_BETA);
@@ -53,7 +53,7 @@ public class SuggestedVersionTest {
}
@Test
public void singleRepoMultiSig() {
public void singleRepoMultiSigner() {
App singleApp = TestUtils.getApp();
singleApp.installedVersionCode = 0;
@@ -75,7 +75,7 @@ public class SuggestedVersionTest {
// Now install v1 with the f-droid signature. In response, we should only suggest
// apps with that sig in the future. That is, version 4 from upstream is not considered.
singleApp.installedSig = TestUtils.FDROID_SIG;
singleApp.installedSigner = TestUtils.FDROID_SIG;
singleApp.installedVersionCode = 1;
assertSuggested(singleApp, apks, 3, Apk.RELEASE_CHANNEL_STABLE);
@@ -106,7 +106,7 @@ public class SuggestedVersionTest {
public void testIncompatibleWithBeta() {
App singleApp = TestUtils.getApp();
singleApp.installedVersionCode = 1;
singleApp.installedSig = TestUtils.FDROID_SIG;
singleApp.installedSigner = TestUtils.FDROID_SIG;
Apk apk1 = TestUtils.getApk(1, TestUtils.FDROID_SIG, Apk.RELEASE_CHANNEL_STABLE);
Apk apk2 = TestUtils.getApk(2, TestUtils.FDROID_SIG, Apk.RELEASE_CHANNEL_STABLE);
Apk apk3 = TestUtils.getApk(3, TestUtils.FDROID_SIG, Apk.RELEASE_CHANNEL_STABLE);
@@ -122,8 +122,8 @@ public class SuggestedVersionTest {
* Checks that the app exists, that its suggested version code is correct, and that the apk which is "suggested"
* has the correct signature.
* <p>
* If {@param installedSig} is null then {@param installedVersion} is ignored and the signature of the suggested
* apk is not checked.
* If {@param installedSigner} is null then {@param installedVersion} is
* ignored and the signature of the suggested APK is not checked.
*/
public void assertSuggested(App app, List<Apk> apks, int suggestedVersion,
String releaseChannel, boolean hasUpdates) {
@@ -131,8 +131,8 @@ public class SuggestedVersionTest {
assertNotNull(suggestedApk);
assertEquals("Suggested version on App", suggestedVersion, suggestedApk.versionCode);
if (app.installedSig != null) {
assertEquals("Installed signature on Apk", app.installedSig, suggestedApk.sig);
if (app.installedSigner != null) {
assertEquals("Installed signature on Apk", app.installedSigner, suggestedApk.signer);
}
assertTrue(app.canAndWantToUpdate(suggestedApk));
AppPrefs appPrefs = new AppPrefs(app.packageName, 0, Collections.singletonList(releaseChannel));