package fnpsapi

import (
	"testing"

	"git.rosy.net.cn/baseapi"
	"git.rosy.net.cn/baseapi/utils"
	"go.uber.org/zap"
)

var (
	api         *API
	apiv3       *APIv3
	sugarLogger *zap.SugaredLogger
)

func init() {
	logger, _ := zap.NewDevelopment()
	sugarLogger = logger.Sugar()
	baseapi.Init(sugarLogger)
	api = New("6a3e2073-1850-413b-9eb7-6c342ec36e1c", "a8248088-a742-4c33-a0db-03aeae00ca7d")
	api.SetToken("n-606c907a-5117-4c64-bc32-291c3091cabd-w")
	apiv3 = Newv3("6a3e2073-1850-413b-9eb7-6c342ec36e1c", "a8248088-a742-4c33-a0db-03aeae00ca7d")
	apiv3.SetTokenv3("n-606c907a-5117-4c64-bc32-291c3091cabd-w")
}

func TestGetAccessToken(t *testing.T) {
	result, err := api.GetAccessToken()
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}
