aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain-Test
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-07-26 14:16:44 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-07-26 14:16:44 +0200
commit1c00227c41850be155748233a8010a8067cf679f (patch)
treea8115ed444b7f1c43673cbaf4f47919b5078ff93 /OpenKeychain-Test
parentd849b6d8a83deed28e8a22da642db781c4e6cf6d (diff)
downloadopen-keychain-1c00227c41850be155748233a8010a8067cf679f.tar.gz
open-keychain-1c00227c41850be155748233a8010a8067cf679f.tar.bz2
open-keychain-1c00227c41850be155748233a8010a8067cf679f.zip
test: small code cleanup
Diffstat (limited to 'OpenKeychain-Test')
-rw-r--r--OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java18
1 files changed, 4 insertions, 14 deletions
diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java
index e423d790d..2cc22deee 100644
--- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java
+++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java
@@ -352,7 +352,8 @@ public class PgpKeyOperationTest {
{ // bad keysize should fail
parcel.reset();
- parcel.mAddSubKeys.add(new SubkeyAdd(algorithm.rsa, 77, KeyFlags.SIGN_DATA, null));
+ parcel.mAddSubKeys.add(new SubkeyAdd(
+ algorithm.rsa, new Random().nextInt(1024), KeyFlags.SIGN_DATA, null));
WrappedSecretKeyRing secretRing = new WrappedSecretKeyRing(ring.getEncoded(), false, 0);
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
@@ -379,12 +380,7 @@ public class PgpKeyOperationTest {
public void testSubkeyModify() throws Exception {
long expiry = new Date().getTime()/1000 + 1024;
- long keyId;
- {
- Iterator<UncachedPublicKey> it = ring.getPublicKeys();
- it.next();
- keyId = it.next().getKeyId();
- }
+ long keyId = KeyringTestingHelper.getSubkeyId(ring, 1);
UncachedKeyRing modified = ring;
{
@@ -463,13 +459,7 @@ public class PgpKeyOperationTest {
@Test
public void testSubkeyRevoke() throws Exception {
- long keyId;
- {
- Iterator<UncachedPublicKey> it = ring.getPublicKeys();
- it.next();
- keyId = it.next().getKeyId();
- }
-
+ long keyId = KeyringTestingHelper.getSubkeyId(ring, 1);
int flags = ring.getPublicKey(keyId).getKeyUsage();
UncachedKeyRing modified;