当前位置: 首页>>代码示例>>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;未经允许,请勿转载。