mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-26 00:52:07 +01:00
decrypt: rename --not-after, --not-before to --verify-not-after, --verify-not-before
This commit is contained in:
parent
2c3717157a
commit
d9708e882d
2 changed files with 11 additions and 11 deletions
|
@ -26,14 +26,14 @@ import java.util.List;
|
|||
exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
|
||||
public class DecryptCmd extends AbstractSopCmd {
|
||||
|
||||
private static final String OPT_SESSION_KEY_OUT = "--session-key-out";
|
||||
private static final String OPT_WITH_SESSION_KEY = "--with-session-key";
|
||||
private static final String OPT_WITH_PASSWORD = "--with-password";
|
||||
private static final String OPT_NOT_BEFORE = "--not-before";
|
||||
private static final String OPT_NOT_AFTER = "--not-after";
|
||||
private static final String OPT_SESSION_KEY_OUT = "--session-key-out";
|
||||
private static final String OPT_VERIFICATIONS_OUT = "--verifications-out";
|
||||
private static final String OPT_VERIFY_WITH = "--verify-with";
|
||||
private static final String OPT_WITH_KEY_PASSWORD = "--with-key-password";
|
||||
private static final String OPT_VERIFICATIONS_OUT = "--verifications-out"; // see SOP-05
|
||||
private static final String OPT_VERIFY_WITH = "--verify-with";
|
||||
private static final String OPT_NOT_BEFORE = "--verify-not-before";
|
||||
private static final String OPT_NOT_AFTER = "--verify-not-after";
|
||||
|
||||
|
||||
@CommandLine.Option(
|
||||
|
|
|
@ -123,7 +123,7 @@ public class DecryptCmdTest {
|
|||
|
||||
@Test
|
||||
public void assertVerifyNotAfterAndBeforeDashResultsInMaxTimeRange() throws SOPGPException.UnsupportedOption {
|
||||
SopCLI.main(new String[] {"decrypt", "--not-before", "-", "--not-after", "-"});
|
||||
SopCLI.main(new String[] {"decrypt", "--verify-not-before", "-", "--verify-not-after", "-"});
|
||||
verify(decrypt, times(1)).verifyNotBefore(AbstractSopCmd.BEGINNING_OF_TIME);
|
||||
verify(decrypt, times(1)).verifyNotAfter(AbstractSopCmd.END_OF_TIME);
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class DecryptCmdTest {
|
|||
return Math.abs(now.getTime() - argument.getTime()) <= 1000;
|
||||
};
|
||||
|
||||
SopCLI.main(new String[] {"decrypt", "--not-before", "now", "--not-after", "now"});
|
||||
SopCLI.main(new String[] {"decrypt", "--verify-not-before", "now", "--verify-not-after", "now"});
|
||||
verify(decrypt, times(1)).verifyNotAfter(ArgumentMatchers.argThat(isMaxOneSecOff));
|
||||
verify(decrypt, times(1)).verifyNotBefore(ArgumentMatchers.argThat(isMaxOneSecOff));
|
||||
}
|
||||
|
@ -145,28 +145,28 @@ public class DecryptCmdTest {
|
|||
@ExpectSystemExitWithStatus(1)
|
||||
public void assertMalformedDateInNotBeforeCausesExit1() {
|
||||
// ParserException causes exit(1)
|
||||
SopCLI.main(new String[] {"decrypt", "--not-before", "invalid"});
|
||||
SopCLI.main(new String[] {"decrypt", "--verify-not-before", "invalid"});
|
||||
}
|
||||
|
||||
@Test
|
||||
@ExpectSystemExitWithStatus(1)
|
||||
public void assertMalformedDateInNotAfterCausesExit1() {
|
||||
// ParserException causes exit(1)
|
||||
SopCLI.main(new String[] {"decrypt", "--not-after", "invalid"});
|
||||
SopCLI.main(new String[] {"decrypt", "--verify-not-after", "invalid"});
|
||||
}
|
||||
|
||||
@Test
|
||||
@ExpectSystemExitWithStatus(SOPGPException.UnsupportedOption.EXIT_CODE)
|
||||
public void assertUnsupportedNotAfterCausesExit37() throws SOPGPException.UnsupportedOption {
|
||||
when(decrypt.verifyNotAfter(any())).thenThrow(new SOPGPException.UnsupportedOption("Setting upper signature date boundary not supported."));
|
||||
SopCLI.main(new String[] {"decrypt", "--not-after", "now"});
|
||||
SopCLI.main(new String[] {"decrypt", "--verify-not-after", "now"});
|
||||
}
|
||||
|
||||
@Test
|
||||
@ExpectSystemExitWithStatus(SOPGPException.UnsupportedOption.EXIT_CODE)
|
||||
public void assertUnsupportedNotBeforeCausesExit37() throws SOPGPException.UnsupportedOption {
|
||||
when(decrypt.verifyNotBefore(any())).thenThrow(new SOPGPException.UnsupportedOption("Setting lower signature date boundary not supported."));
|
||||
SopCLI.main(new String[] {"decrypt", "--not-before", "now"});
|
||||
SopCLI.main(new String[] {"decrypt", "--verify-not-before", "now"});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in a new issue