40 lines
879 B
Go
40 lines
879 B
Go
//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"))
|
|
}
|