當前位置: 首頁>>代碼示例>>Golang>>正文


Golang FakeSoftLayerClient.DoRawHttpRequestResponses方法代碼示例

本文整理匯總了Golang中github.com/maximilien/softlayer-go/client/fakes.FakeSoftLayerClient.DoRawHttpRequestResponses方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeSoftLayerClient.DoRawHttpRequestResponses方法的具體用法?Golang FakeSoftLayerClient.DoRawHttpRequestResponses怎麽用?Golang FakeSoftLayerClient.DoRawHttpRequestResponses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/maximilien/softlayer-go/client/fakes.FakeSoftLayerClient的用法示例。


在下文中一共展示了FakeSoftLayerClient.DoRawHttpRequestResponses方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: SetTestFixturesForFakeSoftLayerClient

func SetTestFixturesForFakeSoftLayerClient(fakeSoftLayerClient *fakesslclient.FakeSoftLayerClient, fileNames []string) {
	workingDir, err := os.Getwd()
	Expect(err).ToNot(HaveOccurred())

	for _, fileName := range fileNames {
		fileContents, err := ReadJsonTestFixtures(filepath.Join(workingDir, "..", ".."), "softlayer", fileName)
		Expect(err).ToNot(HaveOccurred())

		fakeSoftLayerClient.DoRawHttpRequestResponses = append(fakeSoftLayerClient.DoRawHttpRequestResponses, fileContents)
	}
}
開發者ID:digideskweb,項目名稱:bosh-softlayer-cpi,代碼行數:11,代碼來源:tests_helpers.go

示例2: readJsonTestFixtures

func readJsonTestFixtures(fakeClient *slclientfakes.FakeSoftLayerClient) {
	blockDeviceTemplateGroups, err := common.ReadJsonTestFixtures("services", "SoftLayer_Account_Service_getBlockDeviceTemplateGroups.json")
	Expect(err).ToNot(HaveOccurred())

	getObject, err := common.ReadJsonTestFixtures("services", "SoftLayer_Virtual_Guest_Block_Device_Template_Group_Service_getObject.json")
	Expect(err).ToNot(HaveOccurred())

	getDatacenters, err := common.ReadJsonTestFixtures("services", "SoftLayer_Virtual_Guest_Block_Device_Template_Group_Service_getDatacenters.json")
	Expect(err).ToNot(HaveOccurred())

	fakeClient.DoRawHttpRequestResponses = [][]byte{blockDeviceTemplateGroups, getObject, getDatacenters}
}
開發者ID:jianqiu,項目名稱:bosh-softlayer-stemcells,代碼行數:12,代碼來源:light_stemcell_vgbdgt_cmd_test.go

示例3:

		})

		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())
		})

		It("returns an array of datatypes.SoftLayer_Product_Item", func() {
			response, err := testhelpers.ReadJsonTestFixtures("services", "SoftLayer_Product_Package_getItems.json")
			fakeClient.DoRawHttpRequestResponses = append(fakeClient.DoRawHttpRequestResponses, response)

			productItems, err := productPackageService.GetItemsByType("VIRTUAL_SERVER_INSTANCE")
			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))
		})
	})
開發者ID:cheyang,項目名稱:softlayer-go,代碼行數:31,代碼來源:softlayer_product_package_test.go


注:本文中的github.com/maximilien/softlayer-go/client/fakes.FakeSoftLayerClient.DoRawHttpRequestResponses方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。