spider-scheduler/pkg/logic/user_test.go

34 lines
682 B
Go
Raw Permalink 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 logic
import (
"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
}
}