aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain-Test
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-07-26 03:47:29 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-07-26 03:47:29 +0200
commitab2b90342e805a0a625e059dcfe2db11157a5680 (patch)
tree6dee9b1614d94c9e112e1fdff1d1877bb5d1c803 /OpenKeychain-Test
parentf560bc9317357a755b5862c1eec142b7c4665c0a (diff)
downloadopen-keychain-ab2b90342e805a0a625e059dcfe2db11157a5680.tar.gz
open-keychain-ab2b90342e805a0a625e059dcfe2db11157a5680.tar.bz2
open-keychain-ab2b90342e805a0a625e059dcfe2db11157a5680.zip
test and fix: adding an empty user id should fail
Diffstat (limited to 'OpenKeychain-Test')
-rw-r--r--OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java
index 5c6072c25..e423d790d 100644
--- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java
+++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpKeyOperationTest.java
@@ -107,7 +107,7 @@ public class PgpKeyOperationTest {
}
@Test
- public void testAlgorithmChoice() {
+ public void createSecretKeyRingTests() {
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
@@ -629,6 +629,15 @@ public class PgpKeyOperationTest {
@Test
public void testUserIdAdd() throws Exception {
+ {
+ parcel.mAddUserIds.add("");
+ WrappedSecretKeyRing secretRing = new WrappedSecretKeyRing(ring.getEncoded(), false, 0);
+ OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
+ UncachedKeyRing modified = op.modifySecretKeyRing(secretRing, parcel, passphrase, log, 0);
+ Assert.assertNull("adding an empty user id should fail", modified);
+ }
+
+ parcel.reset();
parcel.mAddUserIds.add("rainbow");
UncachedKeyRing modified = applyModificationWithChecks(parcel, ring, onlyA, onlyB);
@@ -689,6 +698,9 @@ public class PgpKeyOperationTest {
parcel.reset();
//noinspection SpellCheckingInspection
parcel.mChangePrimaryUserId = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+ if (parcel.mChangePrimaryUserId.equals(passphrase)) {
+ parcel.mChangePrimaryUserId += "A";
+ }
WrappedSecretKeyRing secretRing = new WrappedSecretKeyRing(ring.getEncoded(), false, 0);
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();