测试部分的model

This commit is contained in:
2024-04-10 17:30:12 +08:00
parent ad3c959586
commit fbef5d56a7
13 changed files with 1497 additions and 622 deletions

36
test/gorm_test.go Normal file
View File

@@ -0,0 +1,36 @@
package vertmore_test
import (
"log"
"testing"
"github.com/iapologizewhenimwrong/Vestmore_GO/model"
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/basic"
)
func TestCaseInsert(t *testing.T) {
c, err := model.Models.KillaraCustomerModel.GetCustomer(1)
if err != nil {
panic(err)
}
log.Printf("%#v", c)
c.CustomerId = nil
c.Email = basic.StringPtr("474420502@qq.com")
model.Models.KillaraCustomerModel.InsertCustomer(c)
}
func TestUpdate(t *testing.T) {
c, err := model.Models.KillaraCustomerModel.GetCustomer(6)
if err != nil {
panic(err)
}
uc := &model.KillaraCustomer{}
uc.CustomerId = c.CustomerId
uc.Email = basic.StringPtr("474420502@gmail.com")
log.Println(model.Models.KillaraCustomerModel.UpdateCustomer(uc))
}
func TestExist(t *testing.T) {
log.Println(model.Models.KillaraCustomerModel.CheckEmailExists("474420502@gmail.com"))
log.Println(model.Models.KillaraCustomerModel.CheckEmailExists("474420502@qq.com"))
}