go17/vblog/apps/user/impl_test.go

43 lines
1.0 KiB
Go
Raw Normal View History

2024-12-01 18:04:02 +08:00
package user_test
import (
"context"
"testing"
"gitlab.com/go-course-project/go17/vblog/apps/user"
"gitlab.com/go-course-project/go17/vblog/apps/user/impl"
)
var (
ctx = context.Background()
)
// 我要测试的对象是什么?, 这个服务的具体实现
// Service的具体实现现在还没实现
2024-12-08 11:04:25 +08:00
// $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
2024-12-01 18:04:02 +08:00
func TestRegistry(t *testing.T) {
2024-12-08 11:04:25 +08:00
req := user.NewRegistryRequest()
req.Username = "test02"
req.Password = "123456"
ins, err := impl.UserService.Registry(ctx, req)
2024-12-01 18:04:02 +08:00
if err != nil {
t.Fatal(err)
}
t.Log(ins)
}
2024-12-08 11:04:25 +08:00
func TestDescribeUser(t *testing.T) {
ins, err := impl.UserService.DescribeUser(ctx, &user.DescribeUserRequest{
user.DESCRIBE_BY_USERNAME, "admin",
})
if err != nil {
t.Fatal(err)
}
//
// if ins.Password = in.Password
t.Log(ins.CheckPassword("1234567"))
}