aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/test
diff options
context:
space:
mode:
authorArt O Cathain <art.home@gmail.com>2014-06-22 20:40:29 +0100
committerArt O Cathain <art.home@gmail.com>2014-06-23 17:54:27 +0100
commit13f785d0b04582bf4ccde97ab21eef40824df09d (patch)
tree6ee343b0cf562a6e9e9eb072033afe6caddd5617 /OpenKeychain/src/test
parenta5d85b367dd885221f3f36eca82bfb3ec2b701c4 (diff)
downloadopen-keychain-13f785d0b04582bf4ccde97ab21eef40824df09d.tar.gz
open-keychain-13f785d0b04582bf4ccde97ab21eef40824df09d.tar.bz2
open-keychain-13f785d0b04582bf4ccde97ab21eef40824df09d.zip
borrow tests from Haskell OpenPGP
Diffstat (limited to 'OpenKeychain/src/test')
-rw-r--r--OpenKeychain/src/test/java/tests/ProviderHelperKeyringTest.java68
1 files changed, 67 insertions, 1 deletions
diff --git a/OpenKeychain/src/test/java/tests/ProviderHelperKeyringTest.java b/OpenKeychain/src/test/java/tests/ProviderHelperKeyringTest.java
index 265e01170..3d48c2f97 100644
--- a/OpenKeychain/src/test/java/tests/ProviderHelperKeyringTest.java
+++ b/OpenKeychain/src/test/java/tests/ProviderHelperKeyringTest.java
@@ -1,5 +1,10 @@
package tests;
+import java.util.Collections;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.ArrayList;
+
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -14,7 +19,68 @@ public class ProviderHelperKeyringTest {
@Test
public void testSavePublicKeyring() throws Exception {
- Assert.assertTrue(new KeyringTestingHelper(Robolectric.application).addKeyring());
+ Assert.assertTrue(new KeyringTestingHelper(Robolectric.application).addKeyring(Collections.singleton(
+ "/public-key-for-sample.blob"
+ )));
+ }
+
+ @Test
+ public void testSavePublicKeyringRsa() throws Exception {
+ Assert.assertTrue(new KeyringTestingHelper(Robolectric.application).addKeyring(prependResourcePath(Arrays.asList(
+ "000001-006.public_key",
+ "000002-013.user_id",
+ "000003-002.sig",
+ "000004-012.ring_trust",
+ "000005-002.sig",
+ "000006-012.ring_trust",
+ "000007-002.sig",
+ "000008-012.ring_trust",
+ "000009-002.sig",
+ "000010-012.ring_trust",
+ "000011-002.sig",
+ "000012-012.ring_trust",
+ "000013-014.public_subkey",
+ "000014-002.sig",
+ "000015-012.ring_trust"
+ ))));
}
+ @Test
+ public void testSavePublicKeyringDsa() throws Exception {
+ Assert.assertTrue(new KeyringTestingHelper(Robolectric.application).addKeyring(prependResourcePath(Arrays.asList(
+ "000016-006.public_key",
+ "000017-002.sig",
+ "000018-012.ring_trust",
+ "000019-013.user_id",
+ "000020-002.sig",
+ "000021-012.ring_trust",
+ "000022-002.sig",
+ "000023-012.ring_trust",
+ "000024-014.public_subkey",
+ "000025-002.sig",
+ "000026-012.ring_trust"
+ ))));
+ }
+
+ @Test
+ public void testSavePublicKeyringDsa2() throws Exception {
+ Assert.assertTrue(new KeyringTestingHelper(Robolectric.application).addKeyring(prependResourcePath(Arrays.asList(
+ "000027-006.public_key",
+ "000028-002.sig",
+ "000029-012.ring_trust",
+ "000030-013.user_id",
+ "000031-002.sig",
+ "000032-012.ring_trust",
+ "000033-002.sig",
+ "000034-012.ring_trust"
+ ))));
+ }
+
+ private static Collection<String> prependResourcePath(Collection<String> files) {
+ Collection<String> prependedFiles = new ArrayList<String>();
+ for (String file: files) {
+ prependedFiles.add("/extern/OpenPGP-Haskell/tests/data/" + file);
+ }
+ return prependedFiles;
+ }
}