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"))
			})
		})
	})
}
Exemplo n.º 2
0
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)))
			})
		})
	})
}
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))
			})
		})
	})
}
Exemplo n.º 4
0
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",
				},
				auth.Auth{},
			}
			err := Test(s, []string{"queue"})
			Expect(err).To(HaveOccurred())
			Expect(server.Hits()).To(Equal(1))
		})
	})
}
Exemplo n.º 5
0
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()
			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())
		})
	})
}
Exemplo n.º 6
0
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)))
				}))
				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(15)))
			})

			g.It("should not change variant quantity", func() {
				mock := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
					w.Write([]byte(SampleVariantJsonQuantity(10)))
				}))
				s := &Shopify{mock.URL}
				c := &Credentials{"some-cart-id", "oauthom"}
				id := int64(1)
				adjustAmount := int64(0)
				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(10)))
			})
		})

	})
}
Exemplo n.º 7
0
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))
				Expect(p[0].Options[0].ProductId).To(Equal(int64(632910392)))

				Expect(len(p[0].Images)).To(Equal(2))

				Expect(p[0].Images[0].CreatedAt).To(Equal("2015-03-28T13:31:19-04:07"))
				Expect(p[0].Images[0].Id).To(Equal(int64(850703190)))
				Expect(p[0].Images[0].Position).To(Equal(1))
				Expect(p[0].Images[0].ProductId).To(Equal(int64(632910392)))
				Expect(p[0].Images[0].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:08"))
				Expect(p[0].Images[0].Source).To(Equal("https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1427563879"))
				Expect(len(p[0].Images[0].VariantIds)).To(Equal(0))

				Expect(p[0].Images[1].CreatedAt).To(Equal("2015-03-28T13:31:19-04:09"))
				Expect(p[0].Images[1].Id).To(Equal(int64(562641783)))
				Expect(p[0].Images[1].Position).To(Equal(2))
				Expect(p[0].Images[1].ProductId).To(Equal(int64(632910392)))
				Expect(p[0].Images[1].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:10"))
				Expect(p[0].Images[1].Source).To(Equal("https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano-2.png?v=1427563879"))
				Expect(p[0].Images[1].VariantIds[0]).To(Equal(int64(808950810)))

				Expect(p[0].Image.CreatedAt).To(Equal("2015-03-28T13:31:19-04:11"))
				Expect(p[0].Image.Id).To(Equal(int64(850703190)))
				Expect(p[0].Image.Position).To(Equal(1))
				Expect(p[0].Image.ProductId).To(Equal(int64(632910392)))
				Expect(p[0].Image.UpdatedAt).To(Equal("2015-03-28T13:31:19-04:12"))
				Expect(p[0].Image.Source).To(Equal("https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1427563879"))
				Expect(len(p[0].Image.VariantIds)).To(Equal(0))

				Expect(len(p[1].Variants)).To(Equal(1))
				Expect(len(p[1].Options)).To(Equal(1))
				Expect(len(p[1].Images)).To(Equal(0))

				Expect(mockShopify.Hits()).To(Equal(1))
			})

			g.It("should return an offset list of products", 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"}

				params := url.Values{}
				params.Add("page", "2")

				p, err := s.GetProducts(c, params)
				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))
				Expect(p[0].Options[0].ProductId).To(Equal(int64(632910392)))

				Expect(len(p[0].Images)).To(Equal(2))

				Expect(p[0].Images[0].CreatedAt).To(Equal("2015-03-28T13:31:19-04:07"))
				Expect(p[0].Images[0].Id).To(Equal(int64(850703190)))
				Expect(p[0].Images[0].Position).To(Equal(1))
				Expect(p[0].Images[0].ProductId).To(Equal(int64(632910392)))
				Expect(p[0].Images[0].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:08"))
				Expect(p[0].Images[0].Source).To(Equal("https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1427563879"))
				Expect(len(p[0].Images[0].VariantIds)).To(Equal(0))

				Expect(p[0].Images[1].CreatedAt).To(Equal("2015-03-28T13:31:19-04:09"))
				Expect(p[0].Images[1].Id).To(Equal(int64(562641783)))
				Expect(p[0].Images[1].Position).To(Equal(2))
				Expect(p[0].Images[1].ProductId).To(Equal(int64(632910392)))
				Expect(p[0].Images[1].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:10"))
				Expect(p[0].Images[1].Source).To(Equal("https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano-2.png?v=1427563879"))
				Expect(p[0].Images[1].VariantIds[0]).To(Equal(int64(808950810)))

				Expect(p[0].Image.CreatedAt).To(Equal("2015-03-28T13:31:19-04:11"))
				Expect(p[0].Image.Id).To(Equal(int64(850703190)))
				Expect(p[0].Image.Position).To(Equal(1))
				Expect(p[0].Image.ProductId).To(Equal(int64(632910392)))
				Expect(p[0].Image.UpdatedAt).To(Equal("2015-03-28T13:31:19-04:12"))
				Expect(p[0].Image.Source).To(Equal("https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1427563879"))
				Expect(len(p[0].Image.VariantIds)).To(Equal(0))

				Expect(len(p[1].Variants)).To(Equal(1))
				Expect(len(p[1].Options)).To(Equal(1))
				Expect(len(p[1].Images)).To(Equal(0))

				Expect(mockShopify.Hits()).To(Equal(1))
			})

			g.It("should return a limited list of products", func() {
				mockShopify.SetPayload([]byte(SampleProductsLimitedJson))
				mockShopify.SetStatus(http.StatusOK)
				host, port := mockShopify.HostPort()

				s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
				c := &Credentials{"some-cart-hash", "oauthom"}
				params := url.Values{}
				params.Add("limit", "1")

				p, err := s.GetProducts(c, params)
				Expect(err).NotTo(HaveOccurred())
				Expect(p).NotTo(BeNil())
				Expect(len(p)).To(Equal(1))

				Expect(p[0].BodyHtml).To(ContainSubstring("The iPod Touch has the iPhone's multi-touch interface"))
				Expect(p[0].CreatedAt).To(Equal("2015-03-28T13:31:19-04:20"))
				Expect(p[0].Handle).To(Equal("ipod-touch"))
				Expect(p[0].Id).To(Equal(int64(921728736)))
				Expect(p[0].ProductType).To(Equal("Cult Products"))
				Expect(p[0].PublishedAt).To(Equal("2008-09-25T20:00:00-04:00"))
				Expect(p[0].PublishedScope).To(Equal("global"))
				Expect(p[0].TemplateSuffix).To(Equal(""))
				Expect(p[0].Title).To(Equal("IPod Touch 8GB"))
				Expect(p[0].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:00"))
				Expect(p[0].Vendor).To(Equal("Apple"))
				Expect(p[0].Tags).To(Equal(""))

				Expect(len(p[0].Variants)).To(Equal(1))

				Expect(p[0].Variants[0].Barcode).To(Equal("1234_black"))
				Expect(p[0].Variants[0].CompareAtPrice).To(Equal(""))
				Expect(p[0].Variants[0].CreatedAt).To(Equal("2015-03-28T13:31:19-04:00"))
				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(447654529)))
				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("Black"))
				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(921728736)))
				Expect(p[0].Variants[0].RequiresShipping).To(BeTrue())
				Expect(p[0].Variants[0].Sku).To(Equal("IPOD2009BLACK"))
				Expect(p[0].Variants[0].Taxable).To(BeTrue())
				Expect(p[0].Variants[0].Title).To(Equal("Black"))
				Expect(p[0].Variants[0].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:00"))
				Expect(p[0].Variants[0].InventoryQuantity).To(Equal(int64(13)))
				Expect(p[0].Variants[0].OldInventoryQuantity).To(Equal(int64(13)))
				Expect(p[0].Variants[0].ImageId).To(Equal(int64(0)))
				Expect(p[0].Variants[0].Weight).To(Equal(0.2))
				Expect(p[0].Variants[0].WeightUnit).To(Equal("kg"))

				Expect(len(p[0].Options)).To(Equal(1))

				Expect(p[0].Options[0].Id).To(Equal(int64(891236591)))
				Expect(p[0].Options[0].Name).To(Equal("Title"))
				Expect(p[0].Options[0].Position).To(Equal(1))
				Expect(p[0].Options[0].ProductId).To(Equal(int64(921728736)))

				Expect(len(p[0].Images)).To(Equal(0))

				Expect(mockShopify.Hits()).To(Equal(1))
			})
		})

		g.Describe("Get One", func() {
			g.It("should get a single product", func() {
				mockShopify.SetPayload([]byte(SampleProductJson))
				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.GetProduct("632910392", c, nil)
				Expect(err).NotTo(HaveOccurred())
				Expect(p).NotTo(BeNil())

				Expect(p.BodyHtml).To(ContainSubstring("It's the small iPod with one very big idea"))
				Expect(p.CreatedAt).To(Equal("2015-03-28T13:31:19-04:01"))
				Expect(p.Handle).To(Equal("ipod-nano"))
				Expect(p.Id).To(Equal(int64(632910392)))
				Expect(p.ProductType).To(Equal("Cult Products"))
				Expect(p.PublishedAt).To(Equal("2007-12-31T19:00:00-05:00"))
				Expect(p.PublishedScope).To(Equal("web"))
				Expect(p.TemplateSuffix).To(Equal(""))
				Expect(p.Title).To(Equal("IPod Nano - 8GB"))
				Expect(p.UpdatedAt).To(Equal("2015-03-28T13:31:19-04:02"))
				Expect(p.Vendor).To(Equal("Apple"))
				Expect(p.Tags).To(Equal("Emotive, Flash Memory, MP3, Music"))

				Expect(len(p.Variants)).To(Equal(4))

				Expect(p.Variants[0].Barcode).To(Equal("1234_pink"))
				Expect(p.Variants[0].CompareAtPrice).To(Equal(""))
				Expect(p.Variants[0].CreatedAt).To(Equal("2015-03-28T13:31:19-04:03"))
				Expect(p.Variants[0].FulfillmentService).To(Equal("manual"))
				Expect(p.Variants[0].Grams).To(Equal(float64(200)))
				Expect(p.Variants[0].Id).To(Equal(int64(808950810)))
				Expect(p.Variants[0].InventoryManagement).To(Equal("shopify"))
				Expect(p.Variants[0].InventoryPolicy).To(Equal("continue"))
				Expect(p.Variants[0].Option1).To(Equal("Pink"))
				Expect(p.Variants[0].Option2).To(Equal(""))
				Expect(p.Variants[0].Option3).To(Equal(""))
				Expect(p.Variants[0].Position).To(Equal(1))
				Expect(p.Variants[0].Price).To(Equal("199.00"))
				Expect(p.Variants[0].ProductId).To(Equal(int64(632910392)))
				Expect(p.Variants[0].RequiresShipping).To(BeTrue())
				Expect(p.Variants[0].Sku).To(Equal("IPOD2008PINK"))
				Expect(p.Variants[0].Taxable).To(BeTrue())
				Expect(p.Variants[0].Title).To(Equal("Pink"))
				Expect(p.Variants[0].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:04"))
				Expect(p.Variants[0].InventoryQuantity).To(Equal(int64(10)))
				Expect(p.Variants[0].OldInventoryQuantity).To(Equal(int64(10)))
				Expect(p.Variants[0].ImageId).To(Equal(int64(562641783)))
				Expect(p.Variants[0].Weight).To(Equal(0.2))
				Expect(p.Variants[0].WeightUnit).To(Equal("kg"))

				Expect(p.Variants[1].Barcode).To(Equal("1234_red"))
				Expect(p.Variants[1].CompareAtPrice).To(Equal(""))
				Expect(p.Variants[1].CreatedAt).To(Equal("2015-03-28T13:31:19-04:05"))
				Expect(p.Variants[1].FulfillmentService).To(Equal("manual"))
				Expect(p.Variants[1].Grams).To(Equal(float64(200)))
				Expect(p.Variants[1].Id).To(Equal(int64(49148385)))
				Expect(p.Variants[1].InventoryManagement).To(Equal("shopify"))
				Expect(p.Variants[1].InventoryPolicy).To(Equal("continue"))
				Expect(p.Variants[1].Option1).To(Equal("Red"))
				Expect(p.Variants[1].Option2).To(Equal(""))
				Expect(p.Variants[1].Option3).To(Equal(""))
				Expect(p.Variants[1].Position).To(Equal(2))
				Expect(p.Variants[1].Price).To(Equal("199.00"))
				Expect(p.Variants[1].ProductId).To(Equal(int64(632910392)))
				Expect(p.Variants[1].RequiresShipping).To(BeTrue())
				Expect(p.Variants[1].Sku).To(Equal("IPOD2008RED"))
				Expect(p.Variants[1].Taxable).To(BeTrue())
				Expect(p.Variants[1].Title).To(Equal("Red"))
				Expect(p.Variants[1].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:06"))
				Expect(p.Variants[1].InventoryQuantity).To(Equal(int64(20)))
				Expect(p.Variants[1].OldInventoryQuantity).To(Equal(int64(20)))
				Expect(p.Variants[1].ImageId).To(Equal(int64(0)))
				Expect(p.Variants[1].Weight).To(Equal(0.2))
				Expect(p.Variants[1].WeightUnit).To(Equal("kg"))

				Expect(len(p.Options)).To(Equal(1))

				Expect(p.Options[0].Id).To(Equal(int64(594680422)))
				Expect(p.Options[0].Name).To(Equal("Title"))
				Expect(p.Options[0].Position).To(Equal(1))
				Expect(p.Options[0].ProductId).To(Equal(int64(632910392)))

				Expect(len(p.Images)).To(Equal(2))

				Expect(p.Images[0].CreatedAt).To(Equal("2015-03-28T13:31:19-04:07"))
				Expect(p.Images[0].Id).To(Equal(int64(850703190)))
				Expect(p.Images[0].Position).To(Equal(1))
				Expect(p.Images[0].ProductId).To(Equal(int64(632910392)))
				Expect(p.Images[0].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:08"))
				Expect(p.Images[0].Source).To(Equal("https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1427563879"))
				Expect(len(p.Images[0].VariantIds)).To(Equal(0))

				Expect(p.Images[1].CreatedAt).To(Equal("2015-03-28T13:31:19-04:09"))
				Expect(p.Images[1].Id).To(Equal(int64(562641783)))
				Expect(p.Images[1].Position).To(Equal(2))
				Expect(p.Images[1].ProductId).To(Equal(int64(632910392)))
				Expect(p.Images[1].UpdatedAt).To(Equal("2015-03-28T13:31:19-04:10"))
				Expect(p.Images[1].Source).To(Equal("https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano-2.png?v=1427563879"))
				Expect(p.Images[1].VariantIds[0]).To(Equal(int64(808950810)))

				Expect(p.Image.CreatedAt).To(Equal("2015-03-28T13:31:19-04:11"))
				Expect(p.Image.Id).To(Equal(int64(850703190)))
				Expect(p.Image.Position).To(Equal(1))
				Expect(p.Image.ProductId).To(Equal(int64(632910392)))
				Expect(p.Image.UpdatedAt).To(Equal("2015-03-28T13:31:19-04:12"))
				Expect(p.Image.Source).To(Equal("https://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1427563879"))
				Expect(len(p.Image.VariantIds)).To(Equal(0))
			})
		})

		g.Describe("Count", func() {
			g.It("should get a products count", func() {
				mockShopify.SetPayload([]byte(SampleProductsCountJson))
				mockShopify.SetStatus(http.StatusOK)
				host, port := mockShopify.HostPort()

				s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
				c := &Credentials{"some-cart-hash", "oauthom"}

				count, err := s.GetProductsCount(c, nil)
				Expect(err).NotTo(HaveOccurred())
				Expect(count.Count).To(Equal(int64(20)))
			})

			g.It("should get a products count that belong to a certain collection", func() {
				mockShopify.SetPayload([]byte(SampleProductsCountCollectionJson))
				mockShopify.SetStatus(http.StatusOK)
				host, port := mockShopify.HostPort()

				s := &Shopify{fmt.Sprintf("http://%s:%s", host, port)}
				c := &Credentials{"some-cart-hash", "oauthom"}
				params := url.Values{}
				params.Add("collection_id", "841564295")

				count, err := s.GetProductsCount(c, params)
				Expect(err).NotTo(HaveOccurred())
				Expect(count.Count).To(Equal(int64(1)))
			})
		})
	})
}