-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Generate Command to cobra cli lib
Signed-off-by: Marco Franssen <marco.franssen@philips.com>
- Loading branch information
1 parent
cf2d451
commit dca7236
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package cli_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/philips-labs/slsa-provenance-action/cmd/slsa-provenance/cli" | ||
) | ||
|
||
func TestCli(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
cli := cli.New() | ||
assert.Len(cli.Commands(), 2) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package cli_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/philips-labs/slsa-provenance-action/cmd/slsa-provenance/cli" | ||
) | ||
|
||
func TestGenerate(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
cmd := cli.Generate() | ||
|
||
assert.Len(cmd.Commands(), 2) | ||
output, err := executeCommand(cmd) | ||
|
||
assert.NoError(err) | ||
assert.Contains(output, "Generate provenance using subcommands\n\nUsage:\n") | ||
} |