mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-12-23 05:17:58 +01:00
decrypt --verify-with: Do not expect exit 3 when verifications is empty
This commit is contained in:
parent
cf1d39643d
commit
4ccd89b148
1 changed files with 8 additions and 5 deletions
|
@ -21,6 +21,7 @@ import sop.operation.Decrypt;
|
||||||
import sop.util.HexUtil;
|
import sop.util.HexUtil;
|
||||||
import sop.util.UTCUtil;
|
import sop.util.UTCUtil;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -247,15 +248,17 @@ public class DecryptCmdTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ExpectSystemExitWithStatus(SOPGPException.NoSignature.EXIT_CODE)
|
public void assertNoVerificationsIsOkay() throws SOPGPException.CannotDecrypt, SOPGPException.MissingArg, SOPGPException.BadData, IOException {
|
||||||
public void assertNoSignatureExceptionCausesExit3() throws SOPGPException.CannotDecrypt, SOPGPException.MissingArg, SOPGPException.BadData, IOException {
|
File tempFile = File.createTempFile("verify-with-", ".tmp");
|
||||||
|
File verifyOut = new File(tempFile.getParent(), "verifications.out");
|
||||||
|
verifyOut.deleteOnExit();
|
||||||
when(decrypt.ciphertext((InputStream) any())).thenReturn(new ReadyWithResult<DecryptionResult>() {
|
when(decrypt.ciphertext((InputStream) any())).thenReturn(new ReadyWithResult<DecryptionResult>() {
|
||||||
@Override
|
@Override
|
||||||
public DecryptionResult writeTo(OutputStream outputStream) throws SOPGPException.NoSignature {
|
public DecryptionResult writeTo(@Nonnull OutputStream outputStream) throws SOPGPException.NoSignature {
|
||||||
throw new SOPGPException.NoSignature();
|
return new DecryptionResult(null, Collections.emptyList());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
SopCLI.main(new String[] {"decrypt"});
|
SopCLI.main(new String[] {"decrypt", "--verify-with", tempFile.getAbsolutePath(), "--verifications-out", verifyOut.getAbsolutePath()});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue