github.com/infraboard/keyauth@v0.8.1/client/client_test.go (about)

     1  package client_test
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  
     9  	"github.com/infraboard/keyauth/apps/domain"
    10  	"github.com/infraboard/keyauth/apps/user"
    11  	"github.com/infraboard/keyauth/client"
    12  )
    13  
    14  func Test_Client(t *testing.T) {
    15  	should := assert.New(t)
    16  	conf := client.NewDefaultConfig()
    17  	conf.SetClientCredentials("nHerVBlrKIDurviMGUXVOQHC", "l5FB38Mw2JmxHgGm8rUcich2ZrGRVrl7")
    18  	c, err := client.NewClient(conf)
    19  
    20  	if should.NoError(err) {
    21  		req := user.NewQueryAccountRequest()
    22  		req.Domain = domain.AdminDomainName
    23  		eps, err := c.User().QueryAccount(context.Background(), req)
    24  		if should.NoError(err) {
    25  			t.Logf("get users: %s ", eps)
    26  		}
    27  	}
    28  }