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}
}
コード例 #2
0
			Context("when all required options are missing", func() {
				BeforeEach(func() {
					options.VersionFlag = ""
				})

				It("fails with warning that version is missing", func() {
					err = cmd.CheckOptions()
					Expect(err.Error()).To(ContainSubstring("must pass a version"))
				})
			})
		})

		Context("running command", func() {
			BeforeEach(func() {
				fakeClient.DoRawHttpRequestResponse, err = common.ReadJsonTestFixtures("services", "SoftLayer_Virtual_Disk_Image_getObject.json")
				Expect(err).ToNot(HaveOccurred())
			})

			Describe("#Run", func() {
				It("runs the command", func() {
					err = cmd.Run()
					Expect(err).ToNot(HaveOccurred())
				})
			})
		})
	})

	Context("Light Stemcell Command interface", func() {
		BeforeEach(func() {
			fakeClient.DoRawHttpRequestResponse, err = common.ReadJsonTestFixtures("services", "SoftLayer_Virtual_Disk_Image_getObject.json")