aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/testsupport/UncachedKeyringTestingHelper.java11
-rw-r--r--OpenKeychain/src/test/java/tests/UncachedKeyringTest.java5
2 files changed, 11 insertions, 5 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/testsupport/UncachedKeyringTestingHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/testsupport/UncachedKeyringTestingHelper.java
index e0580a86a..ac4955715 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/testsupport/UncachedKeyringTestingHelper.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/testsupport/UncachedKeyringTestingHelper.java
@@ -14,10 +14,12 @@ import org.spongycastle.openpgp.PGPUserAttributeSubpacketVector;
import org.spongycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
import org.sufficientlysecure.keychain.pgp.UncachedPublicKey;
+import org.sufficientlysecure.keychain.service.OperationResultParcel;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Date;
+import java.util.Objects;
/**
* Created by art on 28/06/14.
@@ -25,7 +27,14 @@ import java.util.Date;
public class UncachedKeyringTestingHelper {
public static boolean compareRing(UncachedKeyRing keyRing1, UncachedKeyRing keyRing2) {
- return TestDataUtil.iterEquals(keyRing1.getPublicKeys(), keyRing2.getPublicKeys(), new
+ OperationResultParcel.OperationLog operationLog = new OperationResultParcel.OperationLog();
+ UncachedKeyRing canonicalized = keyRing1.canonicalize(operationLog, 0);
+
+ if (canonicalized == null) {
+ throw new AssertionError("Canonicalization failed; messages: [" + operationLog.toString() + "]");
+ }
+
+ return TestDataUtil.iterEquals(canonicalized.getPublicKeys(), keyRing2.getPublicKeys(), new
TestDataUtil.EqualityChecker<UncachedPublicKey>() {
@Override
public boolean areEquals(UncachedPublicKey lhs, UncachedPublicKey rhs) {
diff --git a/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java b/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java
index 05a9c23ef..e4e98cc5c 100644
--- a/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java
+++ b/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java
@@ -16,11 +16,8 @@ public class UncachedKeyringTest {
@Test
public void testVerifySuccess() throws Exception {
UncachedKeyRing expectedKeyRing = KeyringBuilder.ring2();
-// Uncomment to prove it's working - the createdDate will then be different
-// Thread.sleep(1500);
UncachedKeyRing inputKeyRing = KeyringBuilder.ring1();
- new UncachedKeyringTestingHelper().doTestCanonicalize(
- inputKeyRing, expectedKeyRing);
+ new UncachedKeyringTestingHelper().doTestCanonicalize(inputKeyRing, expectedKeyRing);
}
/**