Ash Wilson | 4215691 | 2014-09-02 14:08:22 -0400 | [diff] [blame] | 1 | // +build acceptance |
| 2 | |
| 3 | package v3 |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/rackspace/gophercloud" |
| 9 | identity3 "github.com/rackspace/gophercloud/openstack/identity/v3" |
| 10 | "github.com/rackspace/gophercloud/openstack/utils" |
| 11 | ) |
| 12 | |
| 13 | func TestGetToken(t *testing.T) { |
| 14 | // Obtain credentials from the environment. |
| 15 | ao, err := utils.AuthOptions() |
| 16 | if err != nil { |
| 17 | t.Fatalf("Unable to acquire credentials: %v", err) |
| 18 | } |
| 19 | |
| 20 | client := identity3.NewClient(&gophercloud.ProviderClient{ |
| 21 | Options: ao, |
| 22 | }, ao.IdentityEndpoint+"/v3/") |
| 23 | |
| 24 | // Attempt to acquire a token. |
| 25 | token, err := client.GetToken(ao) |
| 26 | if err != nil { |
| 27 | t.Fatalf("Unable to get token: %v", err) |
| 28 | } |
| 29 | |
| 30 | t.Logf("Acquired token: %s", token.ID) |
| 31 | } |