aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Breitmoser <look@my.amazin.horse>2015-05-20 12:46:31 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-05-20 12:47:23 +0200
commit46cc7f8174d1bedabaafbab05e9461c1cfe72891 (patch)
treef54e3f9770b91ad735c777230e853f5ffab7eb8b
parent0df51b614015279b83b2c4059039ed3ac076ba62 (diff)
downloadopen-keychain-46cc7f8174d1bedabaafbab05e9461c1cfe72891.tar.gz
open-keychain-46cc7f8174d1bedabaafbab05e9461c1cfe72891.tar.bz2
open-keychain-46cc7f8174d1bedabaafbab05e9461c1cfe72891.zip
tests: add attribute to PgpKeyOperationTest
-rw-r--r--OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java19
1 files changed, 19 insertions, 0 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 54ccccc3d..056165e01 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
@@ -99,6 +99,14 @@ public class PgpKeyOperationTest {
parcel.mAddUserIds.add("twi");
parcel.mAddUserIds.add("pink");
+
+ {
+ int type = 42;
+ byte[] data = new byte[] { 0, 1, 2, 3, 4 };
+ WrappedUserAttribute uat = WrappedUserAttribute.fromSubpacket(type, data);
+ parcel.mAddUserAttribute.add(uat);
+ }
+
parcel.mNewUnlock = new ChangeUnlockParcel(passphrase);
PgpKeyOperation op = new PgpKeyOperation(null);
@@ -231,6 +239,17 @@ public class PgpKeyOperationTest {
Assert.assertEquals("number of user ids must be two",
2, ring.getPublicKey().getUnorderedUserIds().size());
+ ArrayList<WrappedUserAttribute> attributes =
+ ring.getPublicKey().getUnorderedUserAttributes();
+ Assert.assertEquals("number of user attributes must be one",
+ 1, attributes.size());
+ Assert.assertEquals("user attribute must be correct type",
+ 42, attributes.get(0).getType());
+ Assert.assertEquals("user attribute must have one subpacket",
+ 1, attributes.get(0).getSubpackets().length);
+ Assert.assertArrayEquals("user attribute must have correct data",
+ new byte[] { 0, 1, 2, 3, 4 }, attributes.get(0).getSubpackets()[0]);
+
List<UncachedPublicKey> subkeys = KeyringTestingHelper.itToList(ring.getPublicKeys());
Assert.assertEquals("number of subkeys must be three", 3, subkeys.size());