Vestmore_GO/test/gorm_test.go
2024-04-10 17:30:12 +08:00

37 lines
956 B
Go

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"))
}