1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-06-22 11:34:49 +02:00

Add tests for inline-detach

This commit is contained in:
Paul Schaub 2022-11-21 15:04:13 +01:00
parent ab82a638cc
commit a19fc9ebda

View file

@ -129,4 +129,27 @@ public class InlineDetachCmdTest extends CLITest {
assertEquals(0, msgOut.size());
}
@Test
public void detachNonOpenPgpDataFails() throws IOException {
File sig = nonExistentFile("sig.asc");
pipeStringToStdin("This is non-OpenPGP data and therefore we cannot detach any signatures from it.");
int exitCode = executeCommand("inline-detach", "--signatures-out", sig.getAbsolutePath());
assertEquals(SOPGPException.BadData.EXIT_CODE, exitCode);
}
@Test
public void detachMissingSignaturesFromCleartextSignedMessageFails() throws IOException {
String cleartextSignedNoSigs = "-----BEGIN PGP SIGNED MESSAGE-----\n" +
"\n" +
"Hello, World!\n" +
"What's Up!??\n" +
"\n" +
"\n";
pipeStringToStdin(cleartextSignedNoSigs);
File sig = nonExistentFile("sig.asc");
int exitCode = executeCommand("inline-detach", "--signatures-out", sig.getAbsolutePath());
assertEquals(SOPGPException.BadData.EXIT_CODE, exitCode);
}
}