blob: f5adf5e4a1cd8a0e12c9b8a02815d9337a2b7d6f [file] [log] [blame]
Ash Wilson33c85f42014-09-02 14:09:14 -04001package openstack
2
3import (
4 "testing"
5
6 "github.com/rackspace/gophercloud/openstack"
7 "github.com/rackspace/gophercloud/openstack/utils"
8)
9
10func 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}