diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-08-01 17:36:34 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-08-01 17:46:04 +0200 |
commit | f555447011a4d975e87d99ddc5f512c3205c2211 (patch) | |
tree | 35702ca78f4a120d12385c71a6642727370cc7a5 /OpenKeychain-Test/src/test/java/org/sufficientlysecure | |
parent | 827a958e123184ae70c2c5e5b10ab47f50ef1a52 (diff) | |
download | open-keychain-f555447011a4d975e87d99ddc5f512c3205c2211.tar.gz open-keychain-f555447011a4d975e87d99ddc5f512c3205c2211.tar.bz2 open-keychain-f555447011a4d975e87d99ddc5f512c3205c2211.zip |
fix dumb mistake in modifySecretKey
Diffstat (limited to 'OpenKeychain-Test/src/test/java/org/sufficientlysecure')
-rw-r--r-- | OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java index 516d1ac63..0e0ec7ee2 100644 --- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java +++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java @@ -34,6 +34,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; +import java.util.List; import java.util.Random; @RunWith(RobolectricTestRunner.class) @@ -202,8 +203,8 @@ public class PgpKeyOperationTest { Assert.assertEquals("number of user ids must be two", 2, ring.getPublicKey().getUnorderedUserIds().size()); - Assert.assertEquals("number of subkeys must be three", - 3, KeyringTestingHelper.itToList(ring.getPublicKeys()).size()); + List<UncachedPublicKey> subkeys = KeyringTestingHelper.itToList(ring.getPublicKeys()); + Assert.assertEquals("number of subkeys must be three", 3, subkeys.size()); Assert.assertTrue("key ring should have been created in the last 120 seconds", ring.getPublicKey().getCreationTime().after(new Date(new Date().getTime()-1000*120))); @@ -211,24 +212,21 @@ public class PgpKeyOperationTest { Assert.assertNull("key ring should not expire", ring.getPublicKey().getExpiryTime()); - Iterator<UncachedPublicKey> it = ring.getPublicKeys(); - Assert.assertEquals("first (master) key can certify", - KeyFlags.CERTIFY_OTHER, it.next().getKeyUsage()); + KeyFlags.CERTIFY_OTHER, subkeys.get(0).getKeyUsage()); - UncachedPublicKey signingKey = it.next(); Assert.assertEquals("second key can sign", - KeyFlags.SIGN_DATA, signingKey.getKeyUsage()); - ArrayList<WrappedSignature> sigs = signingKey.getSignatures().next().getEmbeddedSignatures(); + KeyFlags.SIGN_DATA, subkeys.get(1).getKeyUsage()); + ArrayList<WrappedSignature> sigs = subkeys.get(1).getSignatures().next().getEmbeddedSignatures(); Assert.assertEquals("signing key signature should have one embedded signature", 1, sigs.size()); Assert.assertEquals("embedded signature should be of primary key binding type", PGPSignature.PRIMARYKEY_BINDING, sigs.get(0).getSignatureType()); Assert.assertEquals("primary key binding signature issuer should be signing subkey", - signingKey.getKeyId(), sigs.get(0).getKeyId()); + subkeys.get(1).getKeyId(), sigs.get(0).getKeyId()); Assert.assertEquals("third key can encrypt", - KeyFlags.ENCRYPT_COMMS, it.next().getKeyUsage()); + KeyFlags.ENCRYPT_COMMS, subkeys.get(2).getKeyUsage()); } |