httpClient, ok := c.GetHttpClient().(*slclient.HttpClient) Expect(ok).To(BeTrue()) Expect(httpClient.HTTPClient).ToNot(BeNil()) // Assign a malformed dialer to test if the HTTP client really works var errDialFailed = errors.New("dial failed") httpClient.HTTPClient = &http.Client{ Transport: &http.Transport{ Dial: func(network, addr string) (net.Conn, error) { return nil, errDialFailed }, }, } Expect(client.GetHttpClient()).ToNot(BeNil()) _, errorCode, err := client.GetHttpClient().DoRawHttpRequest("/foo", "GET", bytes.NewBufferString("random text")) if urlErr, ok := err.(*url.Error); ok { err = urlErr.Err } Expect(err).To(Equal(errDialFailed)) Expect(errorCode).To(BeNumerically(">", 400)) }) }) Context("#GetService", func() { It("returns a service with name specified", func() { accountService, err := client.GetService("SoftLayer_Account") Expect(err).ToNot(HaveOccurred()) Expect(accountService).ToNot(BeNil())