Ash Wilson | 54ce2f4 | 2014-10-09 09:26:29 -0400 | [diff] [blame^] | 1 | // +build acceptance |
| 2 | |
| 3 | package rackspace |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/rackspace/gophercloud/openstack/utils" |
| 9 | "github.com/rackspace/gophercloud/rackspace" |
| 10 | ) |
| 11 | |
| 12 | func TestAuthenticatedClient(t *testing.T) { |
| 13 | // Obtain credentials from the environment. |
| 14 | ao, err := utils.AuthOptions() |
| 15 | if err != nil { |
| 16 | t.Fatalf("Unable to acquire credentials: %v", err) |
| 17 | } |
| 18 | |
| 19 | client, err := rackspace.AuthenticatedClient(ao) |
| 20 | if err != nil { |
| 21 | t.Fatalf("Unable to authenticate: %v", err) |
| 22 | } |
| 23 | |
| 24 | if client.TokenID == "" { |
| 25 | t.Errorf("No token ID assigned to the client") |
| 26 | } |
| 27 | |
| 28 | t.Logf("Client successfully acquired a token: %v", client.TokenID) |
| 29 | } |