2023-09-15 17:17:01 -05:00
|
|
|
//go:build search
|
|
|
|
// +build search
|
|
|
|
|
|
|
|
package client_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
|
|
2024-01-31 23:34:07 -05:00
|
|
|
"zotregistry.dev/zot/pkg/cli/client"
|
2023-09-15 17:17:01 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestCliUsage(t *testing.T) {
|
|
|
|
oldArgs := os.Args
|
|
|
|
|
|
|
|
defer func() { os.Args = oldArgs }()
|
|
|
|
|
|
|
|
Convey("Test usage", t, func(c C) {
|
|
|
|
os.Args = []string{"cli_test", "help"}
|
|
|
|
err := client.NewCliRootCmd().Execute()
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
})
|
|
|
|
|
|
|
|
Convey("Test version", t, func(c C) {
|
|
|
|
os.Args = []string{"cli_test", "--version"}
|
|
|
|
err := client.NewCliRootCmd().Execute()
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
})
|
|
|
|
}
|