Exemplo n.º 1
0
Arquivo: engine.go Projeto: ovh/tatcli
// Client return a new Tat Client
func Client() *tat.Client {
	ReadConfig()
	if instance != nil {
		return instance
	}

	tc, err := tat.NewClient(tat.Options{
		URL:      viper.GetString("url"),
		Username: viper.GetString("username"),
		Password: viper.GetString("password"),
		Referer:  "tatcli.v." + VERSION,
	})

	if err != nil {
		log.Fatalf("Error while create new Tat Client: %s", err)
	}

	tat.DebugLogFunc = log.Debugf

	if Debug {
		tat.IsDebug = true
	}

	return tc
}
Exemplo n.º 2
0
Arquivo: common.go Projeto: ovh/tat
// TATClient is a client
func TATClient(t *testing.T, username string) *tat.Client {
	g := testsRouterGroups[t].BasePath()
	client, _ := tat.NewClient(tat.Options{
		URL:      g,
		Username: username,
		Password: "******",
	})
	tat.HTTPClient = getTestHTTPClient(t)
	tat.ErrorLogFunc = t.Errorf
	tat.DebugLogFunc = t.Logf
	return client
}