本文整理汇总了Golang中github.com/gomicro/bogus.Bogus类的典型用法代码示例。如果您正苦于以下问题:Golang Bogus类的具体用法?Golang Bogus怎么用?Golang Bogus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bogus类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestMediator
func TestMediator(t *testing.T) {
g := Goblin(t)
RegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })
g.Describe("Initialization", func() {
g.It("should return an error for blank values", func() {
_, err := New("", "", "", "", DefaultConnectionHeaders)
Expect(err).NotTo(Succeed())
_, err = New("host", "", "", "", DefaultConnectionHeaders)
Expect(err).NotTo(Succeed())
_, err = New("host", "port", "", "", DefaultConnectionHeaders)
Expect(err).NotTo(Succeed())
_, err = New("host", "port", "user", "", DefaultConnectionHeaders)
Expect(err).NotTo(Succeed())
_, err = New("host", "port", "user", "pass", DefaultConnectionHeaders)
Expect(err).NotTo(Succeed())
_, err = New("host", "port", "user", "pass", DefaultConnectionHeaders)
Expect(err).NotTo(Succeed())
})
})
g.Describe("Connecting & Subscribing", func() {
var server *bogus.Bogus
g.BeforeEach(func() {
server = bogus.New()
server.Start()
})
g.AfterEach(func() {
server.Close()
})
g.It("should connect to a broker", func() {
h, p := server.HostPort()
getStompConn = func(n net.Conn, h stompngo.Headers) (connectioner, error) {
return &mockstompngo.MockStompngo{}, nil
}
m, err := New(h, p, "user", "pass", DefaultConnectionHeaders)
Expect(err).NotTo(HaveOccurred())
Expect(m.netConn).NotTo(BeNil())
Expect(m.conn).NotTo(BeNil())
Expect(m.conn.Connected()).To(BeTrue())
})
g.It("should auto reconnect", func() {
h, p := server.HostPort()
hits := 0
hitsChan := make(chan int, 100)
mockstomp := mockstompngo.New()
getStompConn = func(n net.Conn, h stompngo.Headers) (connectioner, error) {
hits++
hitsChan <- hits
return mockstomp, nil
}
m, err := New(h, p, "user", "pass", DefaultConnectionHeaders)
Expect(err).NotTo(HaveOccurred())
m.reconnect = 50 * time.Millisecond
SetDefaultEventuallyPollingInterval(10 * time.Millisecond)
SetDefaultEventuallyTimeout(3 * time.Second)
Eventually(hitsChan).Should(Receive(Equal(3)))
Expect(mockstomp.DisconnectCalled).To(BeTrue())
})
g.It("should disconnect", func() {
h, p := server.HostPort()
mockstomp := mockstompngo.New()
getStompConn = func(n net.Conn, h stompngo.Headers) (connectioner, error) {
return mockstomp, nil
}
m, err := New(h, p, "user", "pass", DefaultConnectionHeaders)
Expect(err).NotTo(HaveOccurred())
err = m.Disconnect()
Expect(err).NotTo(HaveOccurred())
Expect(mockstomp.DisconnectCalled).To(BeTrue())
Expect(m.conn).To(BeNil())
})
g.It("should subscribe to a broker", func() {
h, p := server.HostPort()
mockstomp := mockstompngo.New()
getStompConn = func(n net.Conn, h stompngo.Headers) (connectioner, error) {
return mockstomp, nil
}
m, err := New(h, p, "user", "pass", DefaultConnectionHeaders)
err = m.Subscribe(DefaultSubscriptionHeaders)
Expect(err).NotTo(HaveOccurred())
Expect(mockstomp.SubscribeCalled).To(BeTrue())
})
})
g.Describe("Sending", func() {
//.........这里部分代码省略.........
开发者ID:gomicro,项目名称:mediator,代码行数:101,代码来源:mediator_test.go
示例2: TestShopifyFullfillments
func TestShopifyFullfillments(t *testing.T) {
g := Goblin(t)
RegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })
g.Describe("Fullfillments", func() {
var mockShopify *bogus.Bogus
g.BeforeEach(func() {
mockShopify = bogus.New()
mockShopify.Start()
})
g.AfterEach(func() {
mockShopify.Close()
})
g.Describe("serialization", func() {
g.It("should unmarshal a single fulfillment response without error", func() {
var fulfillmentResponse SingleFulfillmentResponse
err := json.Unmarshal([]byte(SingleFulfillmentsJson), &fulfillmentResponse)
Expect(err).NotTo(HaveOccurred())
Expect(fulfillmentResponse.Fulfillment.Id).To(Equal(int64(1533523203)))
Expect(fulfillmentResponse.Fulfillment.LineItems).To(HaveLen(4))
})
})
g.Describe("CreateFulfillment", func() {
g.It("should send back a single fulfillment after creating a fulfillment", func() {
mock := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(SingleFulfillmentsJson))
}))
s := &Shopify{mock.URL}
c := &Credentials{"some-cart-id", "oauthom"}
fulfillmentJson := `{"fulfillment": {"tracking_number": "9405510200882805665013" }}`
orderId := `2017986627`
fulfillment, err := s.CreateFulfillment(fulfillmentJson, orderId, c, nil)
Expect(err).NotTo(HaveOccurred())
Expect(fulfillment.Id).To(Equal(int64(1533523203)))
Expect(fulfillment.LineItems).To(HaveLen(4))
})
})
g.Describe("Get All", func() {
g.It("should get a single variant by id", func() {
mockShopify.SetPayload([]byte(SampleFullfillmentsJson))
mockShopify.SetStatus(http.StatusOK)
host, port := mockShopify.HostPort()
s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
c := &Credentials{"some-cart-id", "oauthom"}
fulfillments, err := s.GetFulfillments("808950810", c, nil)
Expect(err).NotTo(HaveOccurred())
Expect(fulfillments).NotTo(BeNil())
Expect(len(fulfillments)).To(Equal(1))
f := fulfillments[0]
Expect(f).NotTo(BeNil())
Expect(f.Id).To(Equal(int64(255858046)))
Expect(f.OrderId).To(Equal(int64(450789469)))
Expect(f.Status).To(Equal("failure"))
Expect(f.CreatedAt).To(Equal("2015-09-02T14:48:56-04:00"))
Expect(f.Service).To(Equal("manual"))
Expect(f.UpdatedAt).To(Equal("2015-09-02T14:48:56-04:00"))
Expect(f.TrackingCompany).To(Equal(""))
Expect(f.TrackingNumber).To(Equal("1Z2345"))
Expect(len(f.TrackingNumbers)).To(Equal(1))
Expect(f.TrackingNumbers[0]).To(Equal("1Z2345"))
Expect(f.TrackingUrl).To(Equal("http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=1Z2345&TypeOfInquiryNumber=T&AcceptUPSLicenseAgreement=yes&submit=Track"))
Expect(len(f.TrackingUrls)).To(Equal(1))
Expect(f.TrackingUrls[0]).To(Equal("http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=1Z2345&TypeOfInquiryNumber=T&AcceptUPSLicenseAgreement=yes&submit=Track"))
Expect(f.Receipt).NotTo(BeNil())
Expect(f.Receipt.TestCase).To(Equal(true))
Expect(f.Receipt.Authorization).To(Equal("123456"))
Expect(len(f.LineItems)).To(Equal(1))
})
})
})
}
开发者ID:monsooncommerce,项目名称:goshopify,代码行数:80,代码来源:fulfillments_test.go
示例3: TestShopifyCustomers
func TestShopifyCustomers(t *testing.T) {
g := Goblin(t)
RegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })
g.Describe("Customers", func() {
var mockShopify *bogus.Bogus
g.BeforeEach(func() {
mockShopify = bogus.New()
mockShopify.Start()
})
g.AfterEach(func() {
mockShopify.Close()
})
g.Describe("Get All", func() {
g.It("should download a list of customers", func() {
mockShopify.SetPayload([]byte(SampleCustomersJson))
mockShopify.SetStatus(http.StatusOK)
host, port := mockShopify.HostPort()
s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
c := &Credentials{"some-cart-id", "oauthom"}
custs, err := s.GetCustomers(c, nil)
Expect(err).NotTo(HaveOccurred())
Expect(custs).NotTo(BeNil())
Expect(len(custs)).To(Equal(1))
Expect(custs[0].Id).To(Equal(int64(207119551)))
})
})
g.Describe("Count", func() {
g.It("should get an customers count", func() {
mockShopify.SetPayload([]byte(SampleCustomersCountJson))
mockShopify.SetStatus(http.StatusOK)
host, port := mockShopify.HostPort()
s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
c := &Credentials{"some-cart-id", "oauthom"}
count, err := s.GetCustomersCount(c, nil)
Expect(err).NotTo(HaveOccurred())
Expect(count.Count).To(Equal(int64(33)))
})
})
})
}
开发者ID:monsooncommerce,项目名称:goshopify,代码行数:49,代码来源:customers_test.go
示例4: TestSubscription
func TestSubscription(t *testing.T) {
g := Goblin(t)
RegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })
g.Describe("Subscription Status", func() {
var server *bogus.Bogus
var id, authToken string
g.BeforeEach(func() {
id = "AXXXXXXXX"
authToken = "superhash"
server = bogus.New()
server.SetStatus(200)
server.Start()
})
g.It("should get a subscriptions status", func() {
server.SetPayload(greenStatusXML)
s := &seller.Seller{
id,
authToken,
marketplace.Marketplace{
"NA",
"US",
fmt.Sprintf("http://%v", net.JoinHostPort(server.HostPort())),
"ABCDEFG",
},
auth.Auth{},
}
stat, err := Status(s)
Expect(err).NotTo(HaveOccurred())
Expect(stat).To(Equal("GREEN"))
Expect(server.Hits()).To(Equal(1))
})
g.It("should return an error when it receives an error from MWS", func() {
server.SetPayload(errorXML)
s := &seller.Seller{
id,
authToken,
marketplace.Marketplace{
"NA",
"US",
fmt.Sprintf("http://%v", net.JoinHostPort(server.HostPort())),
"ABCDEFG",
},
auth.Auth{},
}
stat, err := Status(s)
Expect(err).To(HaveOccurred())
Expect(stat).To(Equal(""))
Expect(server.Hits()).To(Equal(1))
})
})
g.Describe("Test Notification", func() {
var server *bogus.Bogus
var id, authToken string
g.BeforeEach(func() {
id = "AXXXXXXXX"
authToken = "superhash"
server = bogus.New()
server.SetStatus(200)
server.Start()
})
g.It("should send a request for a test message on a given queue", func() {
server.SetPayload(testMessageXML)
s := &seller.Seller{
id,
authToken,
marketplace.Marketplace{
"NA",
"US",
fmt.Sprintf("http://%v", net.JoinHostPort(server.HostPort())),
"ABCDEFG",
},
auth.Auth{},
}
err := Test(s, []string{"queue"})
Expect(err).NotTo(HaveOccurred())
Expect(server.Hits()).To(Equal(1))
})
g.It("should return an error when it receives an error from MWS", func() {
server.SetPayload(errorXML)
s := &seller.Seller{
id,
authToken,
marketplace.Marketplace{
"NA",
"US",
fmt.Sprintf("http://%v", net.JoinHostPort(server.HostPort())),
"ABCDEFG",
//.........这里部分代码省略.........
开发者ID:gomicro,项目名称:gomws,代码行数:101,代码来源:subscription_test.go
示例5: TestShopify
func TestShopify(t *testing.T) {
g := Goblin(t)
RegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })
g.Describe("Signing", func() {
g.It("should sign a request with an access token", func() {
token := "some-access-token"
req, err := http.NewRequest("GET", "localhost", nil)
Expect(err).NotTo(HaveOccurred())
c := &Credentials{"some-id", token}
c.SignRequest(req)
h := req.Header.Get(AccessHeader)
Expect(h).To(ContainSubstring(token))
})
})
g.Describe("Generic Calls", func() {
var mockShopify *bogus.Bogus
g.BeforeEach(func() {
mockShopify = bogus.New()
mockShopify.Start()
})
g.AfterEach(func() {
mockShopify.Close()
})
g.It("should return a valid cart uri", func() {
cartId := "wakky-wavey-inflatable-waving-arm-guys"
baseUri := "https://%s.myshopify.com"
u, _ := url.Parse(fmt.Sprintf(baseUri, cartId))
s := &Shopify{u.String()}
c := &Credentials{cartId, "some-token"}
uri, err := s.getUri(ProductsEndpoint, c, nil)
Expect(err).NotTo(HaveOccurred())
Expect(uri.Host).To(Equal(fmt.Sprintf("%s.myshopify.com", cartId)))
Expect(uri.Path).To(Equal(ProductsEndpoint))
})
g.It("should return a valid cart uri with params", func() {
cartId := "wakky-wavey-inflatable-waving-arm-guys"
k := "collection"
v := "5555555"
baseUri := "https://%s.myshopify.com"
u, _ := url.Parse(fmt.Sprintf(baseUri, cartId))
s := &Shopify{u.String()}
c := &Credentials{cartId, "some-token"}
p := url.Values{}
p.Add(k, v)
uri, err := s.getUri(ProductsEndpoint, c, p)
Expect(err).NotTo(HaveOccurred())
Expect(uri.Host).To(Equal(fmt.Sprintf("%s.myshopify.com", cartId)))
Expect(uri.Path).To(Equal(ProductsEndpoint))
Expect(uri.Query().Get(k)).To(Equal(v))
})
g.It("should return a valid cart uri with a custom endpoint", func() {
cartId := "wakky-wavey-inflatable-waving-arm-guys"
baseUri := "https://%s.myshopify.com"
productId := "654321"
u, _ := url.Parse(fmt.Sprintf(baseUri, cartId))
s := &Shopify{u.String()}
c := &Credentials{cartId, "some-token"}
uri, err := s.getUri(fmt.Sprintf(ProductEndpoint, productId), c, nil)
Expect(err).NotTo(HaveOccurred())
Expect(uri.Host).To(Equal(fmt.Sprintf("%s.myshopify.com", cartId)))
Expect(uri.Path).To(Equal(fmt.Sprintf(ProductEndpoint, productId)))
})
g.It("should return an error with an invalid cart id", func() {
mockShopify.SetStatus(http.StatusBadRequest)
host, port := mockShopify.HostPort()
u, _ := url.Parse(fmt.Sprintf("http://%s:%s", host, port))
s := &Shopify{u.String()}
c := &Credentials{"some-cart-id", "some-token"}
type TestJson struct {
}
var r TestJson
err := s.DoRequest("GET", u, c, nil, &r)
Expect(err).To(HaveOccurred())
})
g.It("should return an error if bodybytes is 0 length", func() {
mockShopify.SetPayload([]byte(""))
mockShopify.SetStatus(http.StatusBadRequest)
host, port := mockShopify.HostPort()
//.........这里部分代码省略.........
开发者ID:monsooncommerce,项目名称:goshopify,代码行数:101,代码来源:shopify_test.go
示例6: TestShopifyVariants
func TestShopifyVariants(t *testing.T) {
g := Goblin(t)
RegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })
g.Describe("Variants", func() {
var mockShopify *bogus.Bogus
g.BeforeEach(func() {
mockShopify = bogus.New()
mockShopify.Start()
})
g.AfterEach(func() {
mockShopify.Close()
})
g.Describe("Get One", func() {
g.It("should get a single variant by id", func() {
mockShopify.SetPayload([]byte(SampleVariantJson))
mockShopify.SetStatus(http.StatusOK)
host, port := mockShopify.HostPort()
s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
c := &Credentials{"some-cart-hash", "oauthom"}
v, err := s.GetVariant("808950810", c, nil)
Expect(err).NotTo(HaveOccurred())
Expect(v).NotTo(BeNil())
Expect(v.Barcode).To(Equal("1234_pink"))
Expect(v.CompareAtPrice).To(Equal(""))
Expect(v.CreatedAt).To(Equal("2015-03-28T13:31:19-04:03"))
Expect(v.FulfillmentService).To(Equal("manual"))
Expect(v.Grams).To(Equal(float64(200)))
Expect(v.Id).To(Equal(int64(808950810)))
Expect(v.InventoryManagement).To(Equal("shopify"))
Expect(v.InventoryPolicy).To(Equal("continue"))
Expect(v.Option1).To(Equal("Pink"))
Expect(v.Option2).To(Equal(""))
Expect(v.Option3).To(Equal(""))
Expect(v.Position).To(Equal(1))
Expect(v.Price).To(Equal("199.00"))
Expect(v.ProductId).To(Equal(int64(632910392)))
Expect(v.RequiresShipping).To(BeTrue())
Expect(v.Sku).To(Equal("IPOD2008PINK"))
Expect(v.Taxable).To(BeTrue())
Expect(v.Title).To(Equal("Pink"))
Expect(v.UpdatedAt).To(Equal("2015-03-28T13:31:19-04:04"))
Expect(v.InventoryQuantity).To(Equal(int64(10)))
Expect(v.OldInventoryQuantity).To(Equal(int64(10)))
Expect(v.ImageId).To(Equal(int64(562641783)))
Expect(v.Weight).To(Equal(0.2))
Expect(v.WeightUnit).To(Equal("kg"))
})
})
g.Describe("Updating", func() {
g.It("should set variant quantity", func() {
mockShopify.AddPath("/").
SetPayload([]byte(SampleVariantJsonQuantity(5))).
SetStatus(http.StatusOK).
SetMethods("PUT")
host, port := mockShopify.HostPort()
id := int64(1)
oldAmount := int64(1)
newAmount := int64(5)
storeIdentifier := "some-cart-hash"
oauthToken := "oauthom"
update := NewVariantUpdate(id, oldAmount, newAmount, 0)
s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
c := &Credentials{storeIdentifier, oauthToken}
v, err := s.PutVariant(strconv.Itoa(int(id)), update, c)
Expect(err).NotTo(HaveOccurred())
Expect(v).NotTo(BeNil())
Expect(v.Id).To(Equal(int64(1)))
Expect(v.InventoryQuantity).To(Equal(int64(5)))
})
g.It("should decrement variant quantity", func() {
mock := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(SampleVariantJsonQuantity(5)))
}))
s := &Shopify{mock.URL}
c := &Credentials{"some-cart-id", "oauthom"}
id := int64(1)
adjustAmount := int64(-5)
update := NewVariantUpdate(id, 0, 0, adjustAmount)
v, err := s.PutVariant(strconv.Itoa(int(id)), update, c)
Expect(err).NotTo(HaveOccurred())
Expect(v).NotTo(BeNil())
Expect(v.Id).To(Equal(int64(1)))
Expect(v.Sku).To(Equal("Sku1"))
Expect(v.InventoryQuantity).To(Equal(int64(5)))
})
g.It("should increment variant quantity", func() {
mock := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(SampleVariantJsonQuantity(15)))
//.........这里部分代码省略.........
开发者ID:monsooncommerce,项目名称:goshopify,代码行数:101,代码来源:variants_test.go
示例7: TestShopifyTransactions
func TestShopifyTransactions(t *testing.T) {
g := Goblin(t)
RegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })
g.Describe("Transactions", func() {
var mockShopify *bogus.Bogus
g.BeforeEach(func() {
mockShopify = bogus.New()
mockShopify.Start()
})
g.AfterEach(func() {
mockShopify.Close()
})
g.Describe("Get All", func() {
g.It("should download a list of transactions", func() {
mockShopify.SetPayload([]byte(SampleTransactionsJson))
mockShopify.SetStatus(http.StatusOK)
host, port := mockShopify.HostPort()
s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
c := &Credentials{"some-cart-id", "oauthom"}
transactions, err := s.GetTransactions("some-order-id", c, nil)
Expect(err).NotTo(HaveOccurred())
Expect(transactions).NotTo(BeNil())
Expect(len(transactions)).To(Equal(3))
t := transactions[0]
Expect(t).NotTo(BeNil())
Expect(t.Id).To(Equal(int64(179259969)))
Expect(t.OrderId).To(Equal(int64(450789469)))
Expect(t.Kind).To(Equal("refund"))
Expect(t.Gateway).To(Equal("bogus"))
Expect(t.Message).To(Equal(""))
Expect(t.CreatedAt).To(Equal("2005-08-05T12:59:12-04:00"))
Expect(t.Test).To(Equal(false))
Expect(t.Authorization).To(Equal("authorization-key"))
Expect(t.Status).To(Equal("success"))
Expect(t.Amount).To(Equal("209.00"))
Expect(t.Currency).To(Equal("USD"))
Expect(t.LocationId).To(Equal(""))
Expect(t.UserId).To(Equal(int64(0)))
Expect(t.ParentId).To(Equal(int64(0)))
Expect(t.DeviceId).To(Equal(int64(0)))
Expect(t.Receipt.Authorization).To(Equal(""))
Expect(t.Receipt.TestCase).To(Equal(false))
Expect(t.ErrorCode).To(Equal(""))
Expect(t.SourceName).To(Equal("web"))
})
})
})
}
开发者ID:monsooncommerce,项目名称:goshopify,代码行数:55,代码来源:transactions_test.go
示例8: TestShopifyProducts
func TestShopifyProducts(t *testing.T) {
g := Goblin(t)
RegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })
g.Describe("Products", func() {
var mockShopify *bogus.Bogus
g.BeforeEach(func() {
mockShopify = bogus.New()
mockShopify.Start()
})
g.AfterEach(func() {
mockShopify.Close()
})
g.Describe("Get All", func() {
g.It("should get a list of products from shopify", func() {
mockShopify.SetPayload([]byte(SampleProductsJson))
mockShopify.SetStatus(http.StatusOK)
host, port := mockShopify.HostPort()
s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
c := &Credentials{"some-cart-hash", "oauthom"}
p, err := s.GetProducts(c, nil)
Expect(err).NotTo(HaveOccurred())
Expect(p).NotTo(BeNil())
Expect(len(p)).To(Equal(2))
Expect(p[0].BodyHtml).To(ContainSubstring("It's the small iPod with one very big idea"))
Expect(p[0].CreatedAt).To(Equal("2015-03-28T13:31:19-04:01"))
Expect(p[0].Handle).To(Equal("ipod-nano"))
Expect(p[0].Id).To(Equal(int64(632910392)))
Expect(p[0].ProductType).To(Equal("Cult Products"))
Expect(p[0].PublishedAt).To(Equal("2007-12-31T19:00:00-05:00"))
Expect(p[0].PublishedScope).To(Equal("web"))
Expect(p[0].TemplateSuffix).To(Equal(""))
Expect(p[0].Title).To(Equal("IPod Nano - 8GB"))
Expect(p[0].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:02"))
Expect(p[0].Vendor).To(Equal("Apple"))
Expect(p[0].Tags).To(Equal("Emotive, Flash Memory, MP3, Music"))
Expect(len(p[0].Variants)).To(Equal(4))
Expect(p[0].Variants[0].Barcode).To(Equal("1234_pink"))
Expect(p[0].Variants[0].CompareAtPrice).To(Equal(""))
Expect(p[0].Variants[0].CreatedAt).To(Equal("2015-03-28T13:31:19-04:03"))
Expect(p[0].Variants[0].FulfillmentService).To(Equal("manual"))
Expect(p[0].Variants[0].Grams).To(Equal(float64(200)))
Expect(p[0].Variants[0].Id).To(Equal(int64(808950810)))
Expect(p[0].Variants[0].InventoryManagement).To(Equal("shopify"))
Expect(p[0].Variants[0].InventoryPolicy).To(Equal("continue"))
Expect(p[0].Variants[0].Option1).To(Equal("Pink"))
Expect(p[0].Variants[0].Option2).To(Equal(""))
Expect(p[0].Variants[0].Option3).To(Equal(""))
Expect(p[0].Variants[0].Position).To(Equal(1))
Expect(p[0].Variants[0].Price).To(Equal("199.00"))
Expect(p[0].Variants[0].ProductId).To(Equal(int64(632910392)))
Expect(p[0].Variants[0].RequiresShipping).To(BeTrue())
Expect(p[0].Variants[0].Sku).To(Equal("IPOD2008PINK"))
Expect(p[0].Variants[0].Taxable).To(BeTrue())
Expect(p[0].Variants[0].Title).To(Equal("Pink"))
Expect(p[0].Variants[0].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:04"))
Expect(p[0].Variants[0].InventoryQuantity).To(Equal(int64(10)))
Expect(p[0].Variants[0].OldInventoryQuantity).To(Equal(int64(10)))
Expect(p[0].Variants[0].ImageId).To(Equal(int64(562641783)))
Expect(p[0].Variants[0].Weight).To(Equal(0.2))
Expect(p[0].Variants[0].WeightUnit).To(Equal("kg"))
Expect(p[0].Variants[1].Barcode).To(Equal("1234_red"))
Expect(p[0].Variants[1].CompareAtPrice).To(Equal(""))
Expect(p[0].Variants[1].CreatedAt).To(Equal("2015-03-28T13:31:19-04:05"))
Expect(p[0].Variants[1].FulfillmentService).To(Equal("manual"))
Expect(p[0].Variants[1].Grams).To(Equal(float64(200)))
Expect(p[0].Variants[1].Id).To(Equal(int64(49148385)))
Expect(p[0].Variants[1].InventoryManagement).To(Equal("shopify"))
Expect(p[0].Variants[1].InventoryPolicy).To(Equal("continue"))
Expect(p[0].Variants[1].Option1).To(Equal("Red"))
Expect(p[0].Variants[1].Option2).To(Equal(""))
Expect(p[0].Variants[1].Option3).To(Equal(""))
Expect(p[0].Variants[1].Position).To(Equal(2))
Expect(p[0].Variants[1].Price).To(Equal("199.00"))
Expect(p[0].Variants[1].ProductId).To(Equal(int64(632910392)))
Expect(p[0].Variants[1].RequiresShipping).To(BeTrue())
Expect(p[0].Variants[1].Sku).To(Equal("IPOD2008RED"))
Expect(p[0].Variants[1].Taxable).To(BeTrue())
Expect(p[0].Variants[1].Title).To(Equal("Red"))
Expect(p[0].Variants[1].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:06"))
Expect(p[0].Variants[1].InventoryQuantity).To(Equal(int64(20)))
Expect(p[0].Variants[1].OldInventoryQuantity).To(Equal(int64(20)))
Expect(p[0].Variants[1].ImageId).To(Equal(int64(0)))
Expect(p[0].Variants[1].Weight).To(Equal(0.2))
Expect(p[0].Variants[1].WeightUnit).To(Equal("kg"))
Expect(len(p[0].Options)).To(Equal(1))
Expect(p[0].Options[0].Id).To(Equal(int64(594680422)))
Expect(p[0].Options[0].Name).To(Equal("Title"))
Expect(p[0].Options[0].Position).To(Equal(1))
//.........这里部分代码省略.........
开发者ID:monsooncommerce,项目名称:goshopify,代码行数:101,代码来源:products_test.go
注:本文中的github.com/gomicro/bogus.Bogus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论