feat sc改名ss
This commit is contained in:
@@ -7,8 +7,8 @@ import (
|
||||
"git.hlsq.asia/mmorpg/service-common/db/redis"
|
||||
"git.hlsq.asia/mmorpg/service-common/net/grpc/service"
|
||||
"git.hlsq.asia/mmorpg/service-common/net/http/http_resp"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/mocks"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb/mocks"
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"git.hlsq.asia/mmorpg/service-gateway/internal/global"
|
||||
"git.hlsq.asia/mmorpg/service-gateway/internal/testutil"
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -27,7 +28,7 @@ type LoginTestSuite struct {
|
||||
|
||||
func (ts *LoginTestSuite) TestGenToken() {
|
||||
usn := utils.RandInt(1, 100000000)
|
||||
at, rt, err := genToken(context.Background(), int64(usn))
|
||||
at, rt, err := genToken(context.Background(), strconv.Itoa(usn))
|
||||
ts.Assert().NoError(err)
|
||||
|
||||
redisAt := redis.GetClient().Get(context.Background(), fmt.Sprintf(global.KeyGatewayAccessToken, usn)).Val()
|
||||
@@ -89,7 +90,7 @@ func (ts *LoginTestSuite) TestLogin() {
|
||||
client := mocks.NewMockUserClient(ctrl)
|
||||
client.EXPECT().
|
||||
Login(gomock.Any(), gomock.Any()).
|
||||
Return(&grpc_pb.LoginResp{USN: 1, Name: "hh"}, nil)
|
||||
Return(&grpc_pb.LoginResp{USN: "1", Name: "hh"}, nil)
|
||||
|
||||
monkey.Patch(service.UserNewClientLB, func() (grpc_pb.UserClient, error) {
|
||||
return client, nil
|
||||
@@ -132,7 +133,7 @@ func (ts *LoginTestSuite) TestRefreshToken() {
|
||||
ts.Run("Redis Get Failed", func() {
|
||||
monkey.Patch(utils.ParseToken, func(tokenString string, secret string) (*utils.Claims, error) {
|
||||
if tokenString == "abc" {
|
||||
return &utils.Claims{USN: 1}, nil
|
||||
return &utils.Claims{USN: "1"}, nil
|
||||
}
|
||||
return nil, assert.AnError
|
||||
})
|
||||
@@ -150,7 +151,7 @@ func (ts *LoginTestSuite) TestRefreshToken() {
|
||||
ts.Run("OK", func() {
|
||||
monkey.Patch(utils.ParseToken, func(tokenString string, secret string) (*utils.Claims, error) {
|
||||
if tokenString == "abc" {
|
||||
return &utils.Claims{USN: 1}, nil
|
||||
return &utils.Claims{USN: "1"}, nil
|
||||
}
|
||||
return nil, assert.AnError
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user