测试部分的model
This commit is contained in:
36
test/gorm_test.go
Normal file
36
test/gorm_test.go
Normal 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"))
|
||||
}
|
||||
Reference in New Issue
Block a user