blob: f55e1559c1529e471cdd15ef83a8d9c903c33e73 [file] [log] [blame]
Ash Wilsonc25ae602014-09-02 14:41:12 -04001// +build acceptance
2
Ash Wilson33c85f42014-09-02 14:09:14 -04003package openstack
4
5import (
6 "testing"
7
8 "github.com/rackspace/gophercloud/openstack"
9 "github.com/rackspace/gophercloud/openstack/utils"
10)
11
12func 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 := openstack.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}