blob: 4ac99c4d082a2a3491571ba29a63c910ab12aa73 [file] [log] [blame]
Ash Wilson42156912014-09-02 14:08:22 -04001// +build acceptance
2
3package v3
4
5import (
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
13func 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}