mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2025-09-07 17:29:44 +02:00
CertifyValidateUserIdTest: unbound User-IDs do throw exceptions
This commit is contained in:
parent
61206dde53
commit
e1d048225b
1 changed files with 25 additions and 24 deletions
|
@ -14,7 +14,6 @@ import sop.exception.SOPGPException;
|
|||
import java.io.IOException;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
|
@ -47,16 +46,17 @@ public class CertifyValidateUserIdTest {
|
|||
|
||||
// Alice has her own user-id self-certified
|
||||
assertTrue(sop.validateUserId()
|
||||
.authorities(aliceCert)
|
||||
.userId("Alice <alice@pgpainless.org>")
|
||||
.subjects(aliceCert),
|
||||
.authorities(aliceCert)
|
||||
.userId("Alice <alice@pgpainless.org>")
|
||||
.subjects(aliceCert),
|
||||
"Alice accepts her own self-certified user-id");
|
||||
|
||||
// Alice has not yet certified Bobs user-id
|
||||
assertFalse(sop.validateUserId()
|
||||
.authorities(aliceCert)
|
||||
.userId("Bob <bob@pgpainless.org>")
|
||||
.subjects(bobCert),
|
||||
assertThrows(SOPGPException.CertUserIdNoMatch.class, () ->
|
||||
sop.validateUserId()
|
||||
.authorities(aliceCert)
|
||||
.userId("Bob <bob@pgpainless.org>")
|
||||
.subjects(bobCert),
|
||||
"Alice has not yet certified Bobs user-id");
|
||||
|
||||
byte[] bobCertifiedByAlice = sop.certifyUserId()
|
||||
|
@ -67,10 +67,10 @@ public class CertifyValidateUserIdTest {
|
|||
.getBytes();
|
||||
|
||||
assertTrue(sop.validateUserId()
|
||||
.userId("Bob <bob@pgpainless.org>")
|
||||
.authorities(aliceCert)
|
||||
.subjects(bobCertifiedByAlice),
|
||||
"Alice accepts Bobs user-id after she certified it");
|
||||
.userId("Bob <bob@pgpainless.org>")
|
||||
.authorities(aliceCert)
|
||||
.subjects(bobCertifiedByAlice),
|
||||
"Alice accepts Bobs user-id after she certified it");
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
@ -132,11 +132,11 @@ public class CertifyValidateUserIdTest {
|
|||
.getBytes();
|
||||
|
||||
assertThrows(SOPGPException.CertUserIdNoMatch.class, () ->
|
||||
sop.certifyUserId()
|
||||
.userId("Bobby")
|
||||
.keys(aliceKey)
|
||||
.certs(bobCert)
|
||||
.getBytes(),
|
||||
sop.certifyUserId()
|
||||
.userId("Bobby")
|
||||
.keys(aliceKey)
|
||||
.certs(bobCert)
|
||||
.getBytes(),
|
||||
"Alice cannot create a pet-name for Bob without the --no-require-self-sig flag");
|
||||
|
||||
byte[] bobWithPetName = sop.certifyUserId()
|
||||
|
@ -147,15 +147,16 @@ public class CertifyValidateUserIdTest {
|
|||
.getBytes();
|
||||
|
||||
assertTrue(sop.validateUserId()
|
||||
.userId("Bobby")
|
||||
.authorities(aliceCert)
|
||||
.subjects(bobWithPetName),
|
||||
.userId("Bobby")
|
||||
.authorities(aliceCert)
|
||||
.subjects(bobWithPetName),
|
||||
"Alice accepts the pet-name she gave to Bob");
|
||||
|
||||
assertFalse(sop.validateUserId()
|
||||
.userId("Bobby")
|
||||
.authorities(bobWithPetName)
|
||||
.subjects(bobWithPetName),
|
||||
assertThrows(SOPGPException.CertUserIdNoMatch.class, () ->
|
||||
sop.validateUserId()
|
||||
.userId("Bobby")
|
||||
.authorities(bobWithPetName)
|
||||
.subjects(bobWithPetName),
|
||||
"Bob does not accept the pet-name Alice gave him");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue