fix the session_test
It was broken. Change-Id: I03a51a6cc30c3bcc6d6ae778973b7fe374fe3272
This commit is contained in:
parent
1bc5f497bb
commit
452642dade
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user