Initial commit (code only without large binaries)
This commit is contained in:
39
EdgeAPI/internal/db/models/user_dao_plus_test.go
Normal file
39
EdgeAPI/internal/db/models/user_dao_plus_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
//go:build plus
|
||||
|
||||
package models_test
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/iwind/TeaGo/bootstrap"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUserDAO_CheckUserServersEnabled2(t *testing.T) {
|
||||
dbs.NotifyReady()
|
||||
|
||||
var dao = models.NewUserDAO()
|
||||
var tx *dbs.Tx
|
||||
for _, userId := range []int64{1, 2, 1000000} {
|
||||
isEnabled, err := dao.CheckUserServersEnabled(tx, userId)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("user:", userId, "isEnabled:", isEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUserDAO_FindUserNotificationConfig(t *testing.T) {
|
||||
dbs.NotifyReady()
|
||||
|
||||
var dao = models.NewUserDAO()
|
||||
var tx *dbs.Tx
|
||||
config, err := dao.FindUserNotificationConfig(tx, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
logs.PrintAsJSON(config, t)
|
||||
t.Log(dao.NotifyEmail(tx, 1, "bill", "subject", "body"))
|
||||
}
|
||||
Reference in New Issue
Block a user