Example #1
0
File: engine.go Project: 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
}
Example #2
0
File: common.go Project: 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: "no_password_for_tests",
	})
	tat.HTTPClient = getTestHTTPClient(t)
	tat.ErrorLogFunc = t.Errorf
	tat.DebugLogFunc = t.Logf
	return client
}