本文整理匯總了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)
}
}
示例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}
}
示例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))
})
})