MaxCpu: 2, MaxCpuUnits: "CORE", MaxMemory: 1024, StartCpus: 2, StatusId: 1001, Uuid: "fake-uuid", GlobalIdentifier: "fake-globalIdentifier", PrimaryBackendIpAddress: "fake-primary-backend-ip", PrimaryIpAddress: "fake-primary-ip", } }) It("Allow access to storage from virutal guest", func() { fakeClient.FakeHttpClient.DoRawHttpRequestResponse = []byte("true") resp, err := networkStorageService.AttachNetworkStorageToVirtualGuest(virtualGuest, 123) Expect(err).ToNot(HaveOccurred()) Expect(resp).To(Equal(true)) }) 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 fakeClient.FakeHttpClient.DoRawHttpRequestResponse = []byte("true") _, err := networkStorageService.AttachNetworkStorageToVirtualGuest(virtualGuest, 123) Expect(err).To(HaveOccurred()) } })