template = datatypes.SoftLayer_Hardware_Template{
				Hostname:                     "softlayer",
				Domain:                       "testing.com",
				ProcessorCoreAmount:          2,
				MemoryCapacity:               2,
				HourlyBillingFlag:            true,
				OperatingSystemReferenceCode: "UBUNTU_LATEST",
				Datacenter: &datatypes.Datacenter{
					Name: "ams01",
				},
			}
		})

		It("creates a new SoftLayer_Virtual_Guest instance", func() {
			hardware, err := hardwareService.CreateObject(template)
			Expect(err).ToNot(HaveOccurred())
			Expect(hardware.Id).To(Equal(123))
			Expect(hardware.Hostname).To(Equal("softlayer"))
			Expect(hardware.Domain).To(Equal("testing.com"))
			Expect(hardware.BareMetalInstanceFlag).To(Equal(1))
			Expect(hardware.GlobalIdentifier).To(Equal("abcdefg"))
		})

		Context("when HTTP client returns error codes 40x or 50x", func() {
			It("fails for error code 40x", func() {
				errorCodes := []int{400, 401, 499}
				for _, errorCode := range errorCodes {
					fakeClient.FakeHttpClient.DoRawHttpRequestInt = errorCode

					_, err := hardwareService.CreateObject(template)