2022-12-20 21:45:52 +08:00
|
|
|
|
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"
|
2022-12-20 21:45:52 +08:00
|
|
|
|
"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
|
|
|
|
|
}
|
|
|
|
|
}
|