0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-01-06 22:40:28 -05:00
zot/pkg/cli/root_test.go
2019-06-21 15:29:19 -07:00

42 lines
848 B
Go

package cli_test
import (
"os"
"testing"
"github.com/anuvu/zot/pkg/cli"
. "github.com/smartystreets/goconvey/convey"
)
func TestUsage(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 := cli.NewRootCmd().Execute()
So(err, ShouldBeNil)
})
}
func TestServe(t *testing.T) {
oldArgs := os.Args
defer func() { os.Args = oldArgs }()
Convey("Test Usage", t, func(c C) {
os.Args = []string{"cli_test", "serve", "-h"}
err := cli.NewRootCmd().Execute()
So(err, ShouldBeNil)
})
}
func TestGC(t *testing.T) {
oldArgs := os.Args
defer func() { os.Args = oldArgs }()
Convey("Test Usage", t, func(c C) {
os.Args = []string{"cli_test", "garbage-collect", "-h"}
err := cli.NewRootCmd().Execute()
So(err, ShouldBeNil)
})
}