_, err := accountService.GetVirtualGuests() Expect(err).To(HaveOccurred()) } }) }) }) Context("#GetVirtualGuestsByFilter", func() { BeforeEach(func() { fakeClient.FakeHttpClient.DoRawHttpRequestResponse, err = testhelpers.ReadJsonTestFixtures("services", "SoftLayer_Account_Service_getVirtualGuests.json") Expect(err).ToNot(HaveOccurred()) }) It("returns an array of datatypes.SoftLayer_Virtual_Guest", func() { virtualGuests, err := accountService.GetVirtualGuestsByFilter("fake-filter") Expect(err).ToNot(HaveOccurred()) Expect(virtualGuests).ToNot(BeNil()) }) 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 := accountService.GetVirtualGuests() Expect(err).To(HaveOccurred()) } })