go17/vblog/apps/token/impl_test.go
2024-12-15 11:36:22 +08:00

37 lines
942 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package token_test
import (
"context"
"testing"
"gitlab.com/go-course-project/go17/vblog/apps/token"
)
var (
ctx = context.Background()
)
// 我要测试的对象是什么?, 这个服务的具体实现
// Service的具体实现现在还没实现
// $2a$10$yHVSVuyIpTrQxwiuZUwSMuaJFsnd4YBd6hgA.31xNzuyTu4voD/QW
// $2a$10$fe0lsMhM15i4cjHmWudroOOIIBR27Nb7vwrigwK.9PhWdFld44Yze
// $2a$10$RoR0qK37vfc7pddPV0mpU.nN15Lv8745A40MkCJLe47Q00Ag83Qru
// https://gitee.com/infraboard/go-course/blob/master/day09/go-hash.md#bcrypt
func TestIssueToken(t *testing.T) {
req := token.NewIssueTokenRequest("admin", "123456")
ins, err := token.GetService().IssueToken(ctx, req)
if err != nil {
t.Fatal(err)
}
t.Log(ins)
}
func TestValidateToken(t *testing.T) {
req := token.NewValidateTokenRequest("51bf49f5-12a2-406a-baf8-3f99d985b41a")
ins, err := token.GetService().ValidateToken(ctx, req)
if err != nil {
t.Fatal(err)
}
t.Log(ins)
}