Provide expires_at in test fixtures.
diff --git a/openstack/client.go b/openstack/client.go
index eeeb809..e14a48b 100644
--- a/openstack/client.go
+++ b/openstack/client.go
@@ -175,15 +175,12 @@
v3Client.Endpoint = endpoint
}
- result, err := tokens3.Create(v3Client, options, nil)
+ token, err := tokens3.Create(v3Client, options, nil).Extract()
if err != nil {
return err
}
+ client.TokenID = token.ID
- client.TokenID, err = result.TokenID()
- if err != nil {
- return err
- }
client.EndpointLocator = func(opts gophercloud.EndpointOpts) (string, error) {
return v3endpointLocator(v3Client, opts)
}
diff --git a/openstack/identity/v3/tokens/requests_test.go b/openstack/identity/v3/tokens/requests_test.go
index 49b60a4..367c73c 100644
--- a/openstack/identity/v3/tokens/requests_test.go
+++ b/openstack/identity/v3/tokens/requests_test.go
@@ -29,7 +29,11 @@
testhelper.TestJSONRequest(t, r, requestJSON)
w.WriteHeader(http.StatusCreated)
- fmt.Fprintf(w, `{}`)
+ fmt.Fprintf(w, `{
+ "token": {
+ "expires_at": "2014-10-02T13:45:00.000000Z"
+ }
+ }`)
})
_, err := Create(&client, options, scope).Extract()
@@ -250,13 +254,17 @@
w.Header().Add("X-Subject-Token", "aaa111")
w.WriteHeader(http.StatusCreated)
- fmt.Fprintf(w, `{}`)
+ fmt.Fprintf(w, `{
+ "token": {
+ "expires_at": "2014-10-02T13:45:00.000000Z"
+ }
+ }`)
})
options := gophercloud.AuthOptions{UserID: "me", Password: "shhh"}
token, err := Create(&client, options, nil).Extract()
if err != nil {
- t.Errorf("Create returned an error: %v", err)
+ t.Fatalf("Create returned an error: %v", err)
}
if token.ID != "aaa111" {