mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-30 04:22:18 -05:00
tests: add attribute to PgpKeyOperationTest
This commit is contained in:
parent
0df51b6140
commit
46cc7f8174
@ -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());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user