graphql-engine/cli/integration_test/cli.go
Aravind Shankar bb63d7e60e
cli: allow managing actions (#3859)
Co-authored-by: Rishichandra Wawhal <rishichandra.wawhal@gmail.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: Aravind <aravindkp@outlook.in>
Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com>
Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
2020-02-24 21:44:46 +05:30

46 lines
1007 B
Go

package integrationtest
import (
"math/rand"
"testing"
"time"
"github.com/hasura/graphql-engine/cli"
)
func init() {
rand.Seed(time.Now().UTC().UnixNano())
}
func TestPrepare(t *testing.T, ec *cli.ExecutionContext) {
err := ec.Prepare()
if err != nil {
t.Fatalf("prepare failed: %v", err)
}
if ec.CMDName == "" {
t.Fatalf("expected CMDName, got: %v", ec.CMDName)
}
if ec.Spinner == nil {
t.Fatal("got spinner empty")
}
if ec.Logger == nil {
t.Fatal("got empty logger")
}
if ec.GlobalConfigDir == "" {
t.Fatalf("global config dir: expected $HOME/%s, got %s", cli.GlobalConfigDirName, ec.GlobalConfigDir)
}
if ec.GlobalConfigFile == "" {
t.Fatalf("global config file: expected $HOME/%s/%s, got %s", cli.GlobalConfigDirName, cli.GlobalConfigFileName, ec.GlobalConfigFile)
}
if ec.Config == nil {
t.Fatal("got empty Config")
}
}
func TestValidate(t *testing.T, ec *cli.ExecutionContext) {
err := ec.Validate()
if err != nil {
t.Fatalf("validate failed: %v", err)
}
}