diff --git a/pgpainless-cli/src/test/java/org/pgpainless/cli/commands/ListProfilesCmdTest.java b/pgpainless-cli/src/test/java/org/pgpainless/cli/commands/ListProfilesCmdTest.java new file mode 100644 index 00000000..b3e3cac3 --- /dev/null +++ b/pgpainless-cli/src/test/java/org/pgpainless/cli/commands/ListProfilesCmdTest.java @@ -0,0 +1,42 @@ +// SPDX-FileCopyrightText: 2023 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +package org.pgpainless.cli.commands; + +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.jupiter.api.Test; +import org.slf4j.LoggerFactory; + +public class ListProfilesCmdTest extends CLITest { + + public ListProfilesCmdTest() { + super(LoggerFactory.getLogger(ListProfilesCmdTest.class)); + } + + @Test + public void listProfilesWithoutCommand() throws IOException { + assertNotEquals(0, executeCommand("list-profiles")); + } + + @Test + public void listProfileOfGenerateKey() throws IOException { + ByteArrayOutputStream output = pipeStdoutToStream(); + assertSuccess(executeCommand("list-profiles", "generate-key")); + + assertTrue(output.toString().contains("rfc4880")); + } + + @Test + public void listProfilesOfEncrypt() throws IOException { + ByteArrayOutputStream output = pipeStdoutToStream(); + assertSuccess(executeCommand("list-profiles", "encrypt")); + + assertTrue(output.toString().contains("rfc4880")); + } +}