34 lines
696 B
Go
34 lines
696 B
Go
package logic
|
||
|
||
import (
|
||
"github.com/eigeen/furryboard/spider-scheduler/pkg/conf"
|
||
"github.com/eigeen/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
|
||
}
|
||
}
|