github.com/zooyer/miskit@v1.0.71/sdk/upm/upm_test.go (about)

     1  package ice
     2  
     3  import (
     4  	"context"
     5  	"github.com/zooyer/miskit/log"
     6  	"testing"
     7  	"time"
     8  )
     9  
    10  func TestNew(t *testing.T) {
    11  	var (
    12  		config = log.Config{
    13  			Level: "DEBUG",
    14  		}
    15  		stdout    = log.NewStdoutRecorder(log.TextFormatter(true))
    16  		logger, _ = log.New(config, nil)
    17  	)
    18  	logger.SetDefaultRecorder(stdout)
    19  
    20  	var option = Option{
    21  		AppID:     19511,
    22  		AppSecret: "e41e3df18ff53f208aa1789c61261f20",
    23  		Addr:      "127.0.0.1:8805",
    24  		Retry:     1,
    25  		Logger:    logger,
    26  		Timeout:   time.Second,
    27  	}
    28  	upm := New(option)
    29  
    30  	cond := map[string]interface{}{
    31  		"path":   "/upm/v1/test",
    32  		"method": "GET",
    33  	}
    34  
    35  	auth, args, err := upm.Auth(context.Background(), 996, cond)
    36  	if err != nil {
    37  		t.Fatal(err)
    38  	}
    39  
    40  	t.Log(auth, args.JSONString())
    41  }