utils_test.go 562 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 18 19 20

func TestJwtParse(t *testing.T) {
	c, err := jwt.ParseToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjQyNDAyNjEsIkV4dGVybmFsSWQiOiI0MTIwOWU5NTE0ZDI0ODQwYTliNTMxMDgyMWViNjRkNiIsImV4cCI6MTY5MjI2MTIxNiwiaXNzIjoiaGlsb0FwaSJ9.2ru292Z1q8p87Chzp5DWrR1hMHO3sQcD1X3QNwOio2U")
	println(c, err)
}