test: small code cleanup

This commit is contained in:
Vincent Breitmoser 2014-07-26 14:16:44 +02:00
parent d849b6d8a8
commit 1c00227c41

View File

@ -352,7 +352,8 @@ public class PgpKeyOperationTest {
{ // bad keysize should fail { // bad keysize should fail
parcel.reset(); 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); WrappedSecretKeyRing secretRing = new WrappedSecretKeyRing(ring.getEncoded(), false, 0);
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog(); OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
@ -379,12 +380,7 @@ public class PgpKeyOperationTest {
public void testSubkeyModify() throws Exception { public void testSubkeyModify() throws Exception {
long expiry = new Date().getTime()/1000 + 1024; long expiry = new Date().getTime()/1000 + 1024;
long keyId; long keyId = KeyringTestingHelper.getSubkeyId(ring, 1);
{
Iterator<UncachedPublicKey> it = ring.getPublicKeys();
it.next();
keyId = it.next().getKeyId();
}
UncachedKeyRing modified = ring; UncachedKeyRing modified = ring;
{ {
@ -463,13 +459,7 @@ public class PgpKeyOperationTest {
@Test @Test
public void testSubkeyRevoke() throws Exception { public void testSubkeyRevoke() throws Exception {
long keyId; long keyId = KeyringTestingHelper.getSubkeyId(ring, 1);
{
Iterator<UncachedPublicKey> it = ring.getPublicKeys();
it.next();
keyId = it.next().getKeyId();
}
int flags = ring.getPublicKey(keyId).getKeyUsage(); int flags = ring.getPublicKey(keyId).getKeyUsage();
UncachedKeyRing modified; UncachedKeyRing modified;