Exemple #1
0
// 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
}
Exemple #2
0
// 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
}