Add first test for new commands

This commit is contained in:
Paul Schaub 2024-09-19 18:25:17 +02:00
parent ce19207a92
commit eb712e6853
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -13,10 +13,12 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import sop.SOP; import sop.SOP;
import sop.exception.SOPGPException; import sop.exception.SOPGPException;
import sop.operation.Armor; import sop.operation.Armor;
import sop.operation.CertifyUserId;
import sop.operation.ChangeKeyPassword; import sop.operation.ChangeKeyPassword;
import sop.operation.Dearmor; import sop.operation.Dearmor;
import sop.operation.Decrypt; import sop.operation.Decrypt;
@ -29,7 +31,10 @@ import sop.operation.InlineVerify;
import sop.operation.DetachedSign; import sop.operation.DetachedSign;
import sop.operation.DetachedVerify; import sop.operation.DetachedVerify;
import sop.operation.ListProfiles; import sop.operation.ListProfiles;
import sop.operation.MergeCerts;
import sop.operation.RevokeKey; import sop.operation.RevokeKey;
import sop.operation.UpdateKey;
import sop.operation.ValidateUserId;
import sop.operation.Version; import sop.operation.Version;
public class SOPTest { public class SOPTest {
@ -52,6 +57,30 @@ public class SOPTest {
@Test @Test
public void UnsupportedSubcommandsTest() { public void UnsupportedSubcommandsTest() {
SOP nullCommandSOP = new SOP() { SOP nullCommandSOP = new SOP() {
@NotNull
@Override
public ValidateUserId validateUserId() {
return null;
}
@NotNull
@Override
public CertifyUserId certifyUserId() {
return null;
}
@NotNull
@Override
public MergeCerts mergeCerts() {
return null;
}
@NotNull
@Override
public UpdateKey updateKey() {
return null;
}
@Override @Override
public Version version() { public Version version() {
return null; return null;
@ -140,6 +169,11 @@ public class SOPTest {
commands.add(new String[] {"sign"}); commands.add(new String[] {"sign"});
commands.add(new String[] {"verify", "signature.asc", "cert.asc"}); commands.add(new String[] {"verify", "signature.asc", "cert.asc"});
commands.add(new String[] {"version"}); commands.add(new String[] {"version"});
commands.add(new String[] {"list-profiles", "generate-key"});
commands.add(new String[] {"certify-userid", "--userid", "Alice <alice@pgpainless.org>", "--", "alice.pgp"});
commands.add(new String[] {"validate-userid", "Alice <alice@pgpainless.org>", "bob.pgp", "--", "alice.pgp"});
commands.add(new String[] {"update-key"});
commands.add(new String[] {"merge-certs"});
for (String[] command : commands) { for (String[] command : commands) {
int exit = SopCLI.execute(command); int exit = SopCLI.execute(command);