blob: 825e3ac992edbb9cc5d6e067b051237638034461 [file] [log] [blame]
Ash Wilson54ce2f42014-10-09 09:26:29 -04001// +build acceptance
2
3package rackspace
4
5import (
6 "testing"
7
Ash Wilson54ce2f42014-10-09 09:26:29 -04008 "github.com/rackspace/gophercloud/rackspace"
9)
10
11func TestAuthenticatedClient(t *testing.T) {
12 // Obtain credentials from the environment.
Jamie Hannaford390555a2014-10-22 17:04:03 +020013 ao, err := rackspace.AuthOptionsFromEnv()
Ash Wilson54ce2f42014-10-09 09:26:29 -040014 if err != nil {
15 t.Fatalf("Unable to acquire credentials: %v", err)
16 }
17
18 client, err := rackspace.AuthenticatedClient(ao)
19 if err != nil {
20 t.Fatalf("Unable to authenticate: %v", err)
21 }
22
23 if client.TokenID == "" {
24 t.Errorf("No token ID assigned to the client")
25 }
26
27 t.Logf("Client successfully acquired a token: %v", client.TokenID)
28}