diff --git a/openstack/auth.go b/openstack/auth.go index 63cf8e5..40af41b 100644 --- a/openstack/auth.go +++ b/openstack/auth.go @@ -89,10 +89,10 @@ func DoAuthRequest(authopts AuthOpts) (AuthRef, error) { rbody, err := ioutil.ReadAll(resp.Body) if err != nil { - return nil, errors.New("aaa") + return nil, errors.New("error reading response body") } if err = json.Unmarshal(rbody, &auth); err != nil { - return nil, errors.New("bbb") + return nil, errors.New("error unmarshalling response body") } return auth, nil diff --git a/openstack/session_test.go b/openstack/session_test.go index 3c9ed33..1981f19 100644 --- a/openstack/session_test.go +++ b/openstack/session_test.go @@ -17,6 +17,7 @@ package openstack_test import ( "encoding/json" + "io/ioutil" "net/http" "testing" @@ -40,7 +41,7 @@ func TestSessionGet(t *testing.T) { expected := TestStruct{ID: "id1", Name: "Chris"} actual := TestStruct{} - s, _ := openstack.NewSession(nil, "", nil) + s, _ := openstack.NewSession(nil, nil, nil) var headers http.Header = http.Header{} headers.Set("X-Auth-Token", tokn) headers.Set("Accept", "application/json") @@ -51,7 +52,12 @@ func TestSessionGet(t *testing.T) { } testUtil.IsNil(t, err) - if err = json.Unmarshal(resp.Body, &actual); err != nil { + rbody, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Error(err) + } + + if err = json.Unmarshal(rbody, &actual); err != nil { t.Error(err) }