utils_test.go 585 Bytes
Newer Older
hujiebin's avatar
hujiebin committed
1 2 3
package utils

import (
hujiebin's avatar
hujiebin committed
4
	"git.hilo.cn/hilo-common/script/utils/jwt"
hujiebin's avatar
hujiebin committed
5 6 7 8
	"testing"
)

func TestTestCommon(t *testing.T) {
hujiebin's avatar
hujiebin committed
9
	TestCommon()
hujiebin's avatar
hujiebin committed
10
}
iamhujiebin's avatar
iamhujiebin committed
11 12

func TestJwt(t *testing.T) {
hujiebin's avatar
hujiebin committed
13
	token, _ := jwt.GenerateToken(4051, "96f6c25208a346b8871d5ef1a74a7fe3", "hiloApi")
iamhujiebin's avatar
iamhujiebin committed
14 15
	t.Logf(token)
}
iamhujiebin's avatar
iamhujiebin committed
16 17

func TestJwtParse(t *testing.T) {
hujiebin's avatar
hujiebin committed
18 19
	c, _ := jwt.ParseToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjg4Nzc2OTEsIkV4dGVybmFsSWQiOiJkNmZlNmJhN2E3ZTI0NjRiYjhhNmU3OTFlNmQxY2E5ZCIsIlRva2VuVmVyc2lvbiI6NywiZXhwIjoxNzE5NTczOTkzLCJpc3MiOiJoaWxvQXBpIn0.EWSFvxzyPDRLWA5eNQ_MSrUDlAeoMhmn0RKw4vfvL6k")
	println(c.UserId)
iamhujiebin's avatar
iamhujiebin committed
20
}