diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-09-03 01:22:31 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-09-03 02:43:06 +0200 |
commit | e9b14585f5eecddf8c22b2e68aa1a0500682ba3a (patch) | |
tree | 14b8c72cc6bb912e670ea6254a2076f869d27532 /OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain | |
parent | 35962cd2546da025116a0adb4c4025ee00f1e7a3 (diff) | |
download | open-keychain-e9b14585f5eecddf8c22b2e68aa1a0500682ba3a.tar.gz open-keychain-e9b14585f5eecddf8c22b2e68aa1a0500682ba3a.tar.bz2 open-keychain-e9b14585f5eecddf8c22b2e68aa1a0500682ba3a.zip |
add getSecretKeyType method to CachedPublicKeyRing
Diffstat (limited to 'OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain')
-rw-r--r-- | OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java index d117f2103..44918c5fb 100644 --- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java +++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java @@ -29,7 +29,10 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing; import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; +import org.sufficientlysecure.keychain.pgp.UncachedPublicKey; +import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.service.OperationResults.SaveKeyringResult; +import org.sufficientlysecure.keychain.support.KeyringTestingHelper; import org.sufficientlysecure.keychain.util.ProgressScaler; import java.io.IOException; @@ -39,6 +42,8 @@ import java.util.Iterator; @org.robolectric.annotation.Config(emulateSdk = 18) // Robolectric doesn't yet support 19 public class ProviderHelperSaveTest { + ProviderHelper mProviderHelper = new ProviderHelper(Robolectric.application); + @BeforeClass public static void setUpOnce() throws Exception { ShadowLog.stream = System.out; @@ -81,27 +86,21 @@ public class ProviderHelperSaveTest { SaveKeyringResult result; // insert both keys, second should fail - result = new ProviderHelper(Robolectric.application).savePublicKeyRing(pub); + result = mProviderHelper.savePublicKeyRing(pub); Assert.assertTrue("import of public keyring should succeed", result.success()); - result = new ProviderHelper(Robolectric.application).saveSecretKeyRing(sec, - new ProgressScaler()); + result = mProviderHelper.saveSecretKeyRing(sec, new ProgressScaler()); Assert.assertTrue("import of secret keyring should succeed", result.success()); - CanonicalizedSecretKeyRing secRing = - new ProviderHelper(Robolectric.application).getCanonicalizedSecretKeyRing(keyId); + // make sure both the CanonicalizedSecretKeyRing as well as the CachedPublicKeyRing correctly + // indicate the secret key type + CachedPublicKeyRing cachedRing = mProviderHelper.getCachedPublicKeyRing(keyId); + CanonicalizedSecretKeyRing secRing = mProviderHelper.getCanonicalizedSecretKeyRing(keyId); for (CanonicalizedSecretKey key : secRing.secretKeyIterator()) { - Assert.assertEquals("all subkeys should be divert-to-key", - SecretKeyType.DIVERT_TO_CARD, key.getSecretKeyType()); - } - - /* - CachedPublicKeyRing cachedRing = - new ProviderHelper(Robolectric.application).getCachedPublicKeyRing(keyId); - for (CanonicalizedSecretKey key : cachedRing.()) { - Assert.assertEquals("all subkeys should be divert-to-key", + Assert.assertEquals("all subkeys from CanonicalizedSecretKeyRing should be divert-to-key", SecretKeyType.DIVERT_TO_CARD, key.getSecretKeyType()); + Assert.assertEquals("all subkeys from CachedPublicKeyRing should be divert-to-key", + SecretKeyType.DIVERT_TO_CARD, cachedRing.getSecretKeyType(key.getKeyId())); } - */ } |