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