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