本文整理匯總了Golang中github.com/ninnemana/API/models/cart.Customer.Email方法的典型用法代碼示例。如果您正苦於以下問題:Golang Customer.Email方法的具體用法?Golang Customer.Email怎麽用?Golang Customer.Email使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ninnemana/API/models/cart.Customer
的用法示例。
在下文中一共展示了Customer.Email方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Test_EditAccount
func Test_EditAccount(t *testing.T) {
Convey("with shop identifier", t, func() {
shopID := cart.InsertTestData()
So(shopID, ShouldNotBeNil)
val := shopID.Hex()
qs := make(url.Values, 0)
qs.Add("shop", val)
cust := cart.Customer{
ShopId: *shopID,
FirstName: "Alex",
LastName: "Ninneman",
Email: time.Now().Format(time.RFC3339Nano) + "@gmail.com",
}
cust.Password = "password"
response = httprunner.JsonRequest("POST", "/shopify/account", &qs, cust, AddAccount)
So(response.Code, ShouldEqual, 200)
So(json.Unmarshal(response.Body.Bytes(), &cust), ShouldBeNil)
cust.Email = time.Now().Format(time.RFC3339Nano) + "@gmail.com"
header := map[string]interface{}{
"Authorization": "Bearer as;ldskfja;lfdj",
}
response = httprunner.Req(EditAccount, "PUT", "", "/shopify/account", &qs, nil, cust, header)
So(response.Code, ShouldEqual, 500)
So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil)
header = map[string]interface{}{
"Authorization": "Bearer " + cust.Token,
}
cust.FirstName = ""
response = httprunner.Req(EditAccount, "PUT", "", "/shopify/account", &qs, nil, cust, header)
So(response.Code, ShouldEqual, 500)
So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil)
cust.FirstName = "Alex"
response = httprunner.Req(EditAccount, "PUT", "", "/shopify/account", &qs, nil, cust, header)
So(response.Code, ShouldEqual, 200)
So(json.Unmarshal(response.Body.Bytes(), &cust), ShouldBeNil)
})
}
示例2: Test_AddAccount
func Test_AddAccount(t *testing.T) {
Convey("with shop identifier", t, func() {
shopID := cart.InsertTestData()
So(shopID, ShouldNotBeNil)
val := shopID.Hex()
qs := make(url.Values, 0)
qs.Add("shop", val)
response = httprunner.Req(AddAccount, "POST", "", "/shopify/account", &qs, nil, cart.Shop{})
So(response.Code, ShouldEqual, 500)
So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil)
cust := cart.Customer{
ShopId: *shopID,
FirstName: "Alex",
LastName: "Ninneman",
}
addr := cart.CustomerAddress{}
addr.Address1 = "Test"
response = httprunner.Req(AddAccount, "POST", "", "/shopify/account", &qs, nil, addr)
So(response.Code, ShouldEqual, 500)
So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil)
response = httprunner.Req(AddAccount, "POST", "", "/shopify/account", &qs, nil, cust)
So(response.Code, ShouldEqual, 500)
So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil)
cust.Email = time.Now().Format(time.RFC3339Nano) + "@gmail.com"
response = httprunner.JsonRequest("POST", "/shopify/account", &qs, nil, AddAccount)
So(response.Code, ShouldEqual, 500)
So(json.Unmarshal(response.Body.Bytes(), &apierror.ApiErr{}), ShouldBeNil)
cust.Password = "password"
response = httprunner.JsonRequest("POST", "/shopify/account", &qs, cust, AddAccount)
So(response.Code, ShouldEqual, 200)
So(json.Unmarshal(response.Body.Bytes(), &cust), ShouldBeNil)
})
}