mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-22 19:08:00 +01:00
Fix indentation for CLI tests
This commit is contained in:
parent
b9152d5cde
commit
de76f4b3a9
5 changed files with 20 additions and 10 deletions
|
@ -161,6 +161,7 @@ public abstract class CLITest {
|
|||
}
|
||||
|
||||
public void assertSuccess(int exitCode) {
|
||||
assertEquals(0, exitCode, "Expected successful program execution");
|
||||
assertEquals(0, exitCode,
|
||||
"Expected successful program execution");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ public class ExtractCertCmdTest extends CLITest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testExtractCert() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException, IOException {
|
||||
public void testExtractCert()
|
||||
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException, IOException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing()
|
||||
.simpleEcKeyRing("Juliet Capulet <juliet@capulet.lit>");
|
||||
|
||||
|
|
|
@ -83,7 +83,8 @@ public class GenerateKeyCmdTest extends CLITest {
|
|||
KeyRingInfo info = PGPainless.inspectKeyRing(secretKeys);
|
||||
assertTrue(info.isFullyEncrypted());
|
||||
|
||||
assertNotNull(UnlockSecretKey.unlockSecretKey(secretKeys.getSecretKey(), Passphrase.fromPassword("sw0rdf1sh")));
|
||||
assertNotNull(UnlockSecretKey
|
||||
.unlockSecretKey(secretKeys.getSecretKey(), Passphrase.fromPassword("sw0rdf1sh")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -91,6 +92,7 @@ public class GenerateKeyCmdTest extends CLITest {
|
|||
int exit = executeCommand("generate-key",
|
||||
"--with-key-password", "nonexistent", "Alice <alice@pgpainless.org>");
|
||||
|
||||
assertEquals(SOPGPException.MissingInput.EXIT_CODE, exit, "Expected MISSING_INPUT (" + SOPGPException.MissingInput.EXIT_CODE + ")");
|
||||
assertEquals(SOPGPException.MissingInput.EXIT_CODE, exit,
|
||||
"Expected MISSING_INPUT (" + SOPGPException.MissingInput.EXIT_CODE + ")");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,7 +168,8 @@ public class RoundTripEncryptDecryptCmdTest extends CLITest {
|
|||
|
||||
File verifications = nonExistentFile("verifications");
|
||||
ByteArrayOutputStream out = pipeStdoutToStream();
|
||||
int exitCode = executeCommand("decrypt", "--verifications-out", verifications.getAbsolutePath(), key.getAbsolutePath());
|
||||
int exitCode = executeCommand("decrypt", "--verifications-out",
|
||||
verifications.getAbsolutePath(), key.getAbsolutePath());
|
||||
|
||||
assertEquals(SOPGPException.IncompleteVerification.EXIT_CODE, exitCode);
|
||||
assertEquals(0, out.size());
|
||||
|
@ -211,7 +212,8 @@ public class RoundTripEncryptDecryptCmdTest extends CLITest {
|
|||
|
||||
pipeStringToStdin(ciphertext);
|
||||
ByteArrayOutputStream plaintextOut = pipeStdoutToStream();
|
||||
assertSuccess(executeCommand("decrypt", "--session-key-out", sessionKeyFile.getAbsolutePath(), key.getAbsolutePath()));
|
||||
assertSuccess(executeCommand("decrypt", "--session-key-out",
|
||||
sessionKeyFile.getAbsolutePath(), key.getAbsolutePath()));
|
||||
|
||||
assertEquals(plaintext, plaintextOut.toString());
|
||||
String resultSessionKey = readStringFromFile(sessionKeyFile);
|
||||
|
@ -300,7 +302,8 @@ public class RoundTripEncryptDecryptCmdTest extends CLITest {
|
|||
InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
|
||||
.addUserId("No Crypt <no@crypt.key>")
|
||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA))
|
||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519),
|
||||
KeyFlag.CERTIFY_OTHER, KeyFlag.SIGN_DATA))
|
||||
.build();
|
||||
PGPPublicKeyRing cert = PGPainless.extractCertificate(secretKeys);
|
||||
File certFile = writeFile("cert.pgp", cert.getEncoded());
|
||||
|
@ -314,11 +317,13 @@ public class RoundTripEncryptDecryptCmdTest extends CLITest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSignWithIncapableKey() throws IOException, PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
public void testSignWithIncapableKey()
|
||||
throws IOException, PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
|
||||
.addUserId("Cannot Sign <cannot@sign.key>")
|
||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
||||
.addSubkey(KeySpec.getBuilder(KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
||||
.addSubkey(KeySpec.getBuilder(
|
||||
KeyType.XDH(XDHSpec._X25519), KeyFlag.ENCRYPT_COMMS, KeyFlag.ENCRYPT_STORAGE))
|
||||
.build();
|
||||
File keyFile = writeFile("key.pgp", secretKeys.getEncoded());
|
||||
File certFile = writeFile("cert.pgp", PGPainless.extractCertificate(secretKeys).getEncoded());
|
||||
|
|
|
@ -189,7 +189,8 @@ public class RoundTripSignVerifyCmdTest extends CLITest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSignWithIncapableKey() throws IOException, PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
public void testSignWithIncapableKey()
|
||||
throws IOException, PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
PGPSecretKeyRing secretKeys = PGPainless.buildKeyRing()
|
||||
.addUserId("Cannot Sign <cannot@sign.key>")
|
||||
.setPrimaryKey(KeySpec.getBuilder(KeyType.EDDSA(EdDSACurve._Ed25519), KeyFlag.CERTIFY_OTHER))
|
||||
|
|
Loading…
Reference in a new issue