Vestmore_GO/test/gorm_test.go

37 lines
986 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(nil, 1)
if err != nil {
panic(err)
}
log.Printf("%#v", c)
c.CustomerId = nil
c.Email = basic.StringPtr("474420502@qq.com")
model.Models.KillaraCustomerModel.InsertCustomer(nil, c)
}
func TestUpdate(t *testing.T) {
c, err := model.Models.KillaraCustomerModel.GetCustomer(nil, 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(nil, uc))
}
func TestExist(t *testing.T) {
log.Println(model.Models.KillaraCustomerModel.CheckEmailExists(nil, "474420502@gmail.com"))
log.Println(model.Models.KillaraCustomerModel.CheckEmailExists(nil, "474420502@qq.com"))
}