spider-scheduler/pkg/logic/user_test.go

34 lines
682 B
Go
Raw Permalink Normal View History

package logic
import (
2023-04-09 13:35:34 +08:00
"github.com/furryboard/spider-scheduler/pkg/conf"
"github.com/furryboard/spider-scheduler/pkg/log"
"testing"
)
func BeforeTesting() {
log.InitLogger(false)
conf.InitConfig("config.toml")
}
func TestGetUserInfoByUID(t *testing.T) {
BeforeTesting()
info, err := GetUserInfoByUID(686127)
if err != nil {
t.Error(err)
return
}
t.Log(info)
}
func TestBatchGetUserInfo(t *testing.T) {
BeforeTesting()
userIds := []uint{1635354787, 10504485, 272460888, 474481910, 82191626}
infos := BatchGetUserInfo(&userIds)
if len(infos) != len(userIds) {
t.Errorf("结果长度不正确:应为%d实际为%d", len(userIds), len(infos))
return
}
}