MergeCertsTest: do not pass unarmored data

This is done to fix external-sop tests, which rely on environment variables,
which do not play nicely with binary data
This commit is contained in:
Paul Schaub 2025-06-02 14:14:22 +02:00
parent 79aece6f04
commit 5a7a8ae901
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -25,18 +25,15 @@ public class MergeCertsTest extends AbstractSOPTest {
@MethodSource("provideInstances") @MethodSource("provideInstances")
public void testMergeWithItself(SOP sop) throws IOException { public void testMergeWithItself(SOP sop) throws IOException {
byte[] key = sop.generateKey() byte[] key = sop.generateKey()
.noArmor()
.userId("Alice <alice@pgpainless.org>") .userId("Alice <alice@pgpainless.org>")
.generate() .generate()
.getBytes(); .getBytes();
byte[] cert = sop.extractCert() byte[] cert = sop.extractCert()
.noArmor()
.key(key) .key(key)
.getBytes(); .getBytes();
byte[] merged = sop.mergeCerts() byte[] merged = sop.mergeCerts()
.noArmor()
.updates(cert) .updates(cert)
.baseCertificates(cert) .baseCertificates(cert)
.getBytes(); .getBytes();
@ -69,20 +66,17 @@ public class MergeCertsTest extends AbstractSOPTest {
@MethodSource("provideInstances") @MethodSource("provideInstances")
public void testMergeWithItselfViaBase(SOP sop) throws IOException { public void testMergeWithItselfViaBase(SOP sop) throws IOException {
byte[] key = sop.generateKey() byte[] key = sop.generateKey()
.noArmor()
.userId("Alice <alice@pgpainless.org>") .userId("Alice <alice@pgpainless.org>")
.generate() .generate()
.getBytes(); .getBytes();
byte[] cert = sop.extractCert() byte[] cert = sop.extractCert()
.noArmor()
.key(key) .key(key)
.getBytes(); .getBytes();
byte[] certs = ArraysKt.plus(cert, cert); byte[] certs = ArraysKt.plus(cert, cert);
byte[] merged = sop.mergeCerts() byte[] merged = sop.mergeCerts()
.noArmor()
.updates(cert) .updates(cert)
.baseCertificates(certs) .baseCertificates(certs)
.getBytes(); .getBytes();
@ -94,23 +88,19 @@ public class MergeCertsTest extends AbstractSOPTest {
@MethodSource("provideInstances") @MethodSource("provideInstances")
public void testApplyBaseToUpdate(SOP sop) throws IOException { public void testApplyBaseToUpdate(SOP sop) throws IOException {
byte[] key = sop.generateKey() byte[] key = sop.generateKey()
.noArmor()
.userId("Alice <alice@pgpainless.org>") .userId("Alice <alice@pgpainless.org>")
.generate() .generate()
.getBytes(); .getBytes();
byte[] cert = sop.extractCert() byte[] cert = sop.extractCert()
.noArmor()
.key(key) .key(key)
.getBytes(); .getBytes();
byte[] update = sop.revokeKey() byte[] update = sop.revokeKey()
.noArmor()
.keys(key) .keys(key)
.getBytes(); .getBytes();
byte[] merged = sop.mergeCerts() byte[] merged = sop.mergeCerts()
.noArmor()
.updates(cert) .updates(cert)
.baseCertificates(update) .baseCertificates(update)
.getBytes(); .getBytes();
@ -122,23 +112,19 @@ public class MergeCertsTest extends AbstractSOPTest {
@MethodSource("provideInstances") @MethodSource("provideInstances")
public void testApplyUpdateToBase(SOP sop) throws IOException { public void testApplyUpdateToBase(SOP sop) throws IOException {
byte[] key = sop.generateKey() byte[] key = sop.generateKey()
.noArmor()
.userId("Alice <alice@pgpainless.org>") .userId("Alice <alice@pgpainless.org>")
.generate() .generate()
.getBytes(); .getBytes();
byte[] cert = sop.extractCert() byte[] cert = sop.extractCert()
.noArmor()
.key(key) .key(key)
.getBytes(); .getBytes();
byte[] update = sop.revokeKey() byte[] update = sop.revokeKey()
.noArmor()
.keys(key) .keys(key)
.getBytes(); .getBytes();
byte[] merged = sop.mergeCerts() byte[] merged = sop.mergeCerts()
.noArmor()
.updates(update) .updates(update)
.baseCertificates(cert) .baseCertificates(cert)
.getBytes(); .getBytes();
@ -150,29 +136,24 @@ public class MergeCertsTest extends AbstractSOPTest {
@MethodSource("provideInstances") @MethodSource("provideInstances")
public void testApplyUpdateToMissingBaseDoesNothing(SOP sop) throws IOException { public void testApplyUpdateToMissingBaseDoesNothing(SOP sop) throws IOException {
byte[] aliceKey = sop.generateKey() byte[] aliceKey = sop.generateKey()
.noArmor()
.userId("Alice <alice@pgpainless.org>") .userId("Alice <alice@pgpainless.org>")
.generate() .generate()
.getBytes(); .getBytes();
byte[] aliceCert = sop.extractCert() byte[] aliceCert = sop.extractCert()
.noArmor()
.key(aliceKey) .key(aliceKey)
.getBytes(); .getBytes();
byte[] bobKey = sop.generateKey() byte[] bobKey = sop.generateKey()
.noArmor()
.userId("Bob <bob@pgpainless.org>") .userId("Bob <bob@pgpainless.org>")
.generate() .generate()
.getBytes(); .getBytes();
byte[] bobCert = sop.extractCert() byte[] bobCert = sop.extractCert()
.noArmor()
.key(bobKey) .key(bobKey)
.getBytes(); .getBytes();
byte[] merged = sop.mergeCerts() byte[] merged = sop.mergeCerts()
.noArmor()
.updates(bobCert) .updates(bobCert)
.baseCertificates(aliceCert) .baseCertificates(aliceCert)
.getBytes(); .getBytes();