mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-22 19:08:00 +01:00
Add tests for inline-detach
This commit is contained in:
parent
ab82a638cc
commit
a19fc9ebda
1 changed files with 23 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue