コード例 #1
0
			itemPrices, err := productPackageService.GetItemPricesBySize(222, 20)
			Expect(err).ToNot(HaveOccurred())
			Expect(len(itemPrices)).To(Equal(1))
			Expect(itemPrices[0].Id).To(Equal(123))
			Expect(itemPrices[0].Item.Id).To(Equal(456))
		})
	})

	Context("#GetItems", func() {
		BeforeEach(func() {
			fakeClient.DoRawHttpRequestResponse, err = testhelpers.ReadJsonTestFixtures("services", "SoftLayer_Product_Package_getItems.json")
			Expect(err).ToNot(HaveOccurred())
		})

		It("returns an array of datatypes.SoftLayer_Product_Item", func() {
			productItems, err := productPackageService.GetItems(222)
			Expect(err).ToNot(HaveOccurred())
			Expect(len(productItems)).To(Equal(2))
			Expect(productItems[0].Id).To(Equal(123))
			Expect(productItems[0].Prices[0].Id).To(Equal(456))
		})
	})

	Context("#GetItemsByType", func() {

		BeforeEach(func() {
			response, err := testhelpers.ReadJsonTestFixtures("services", "SoftLayer_Product_Package_getAllObjects_virtual_server.json")
			fakeClient.DoRawHttpRequestResponses = append(fakeClient.DoRawHttpRequestResponses, response)

			Expect(err).ToNot(HaveOccurred())
		})
コード例 #2
0
					_, err := productPackageService.GetItemPrices(0, "")
					Expect(err).To(HaveOccurred())
				}
			})
		})
	})

	Context("#GetItems", func() {
		BeforeEach(func() {
			fakeClient.FakeHttpClient.DoRawHttpRequestResponse, err = testhelpers.ReadJsonTestFixtures("services", "SoftLayer_Product_Package_getItems.json")
			Expect(err).ToNot(HaveOccurred())
		})

		It("returns an array of datatypes.SoftLayer_Product_Item without filters", func() {
			productItems, err := productPackageService.GetItems(222, "")
			Expect(err).ToNot(HaveOccurred())
			Expect(len(productItems)).To(Equal(2))
			Expect(productItems[0].Id).To(Equal(123))
			Expect(productItems[0].Prices[0].Id).To(Equal(456))
		})

		It("returns an array of datatypes.SoftLayer_Product_Item with filter", func() {
			productItems, err := productPackageService.GetItems(222, "fake-filters")
			Expect(err).ToNot(HaveOccurred())
			Expect(len(productItems)).To(Equal(2))
			Expect(productItems[0].Id).To(Equal(123))
			Expect(productItems[0].Prices[0].Id).To(Equal(456))
		})

		Context("when HTTP client returns error codes 40x or 50x", func() {