@@ -6,43 +6,10 @@ import (
6
6
"os"
7
7
"testing"
8
8
9
- "github.com/rackspace/gophercloud"
10
- "github.com/rackspace/gophercloud/acceptance/tools"
11
- "github.com/rackspace/gophercloud/rackspace"
12
9
"github.com/rackspace/gophercloud/rackspace/identity/v2/tokens"
13
10
th "github.com/rackspace/gophercloud/testhelper"
14
11
)
15
12
16
- func rackspaceAuthOptions (t * testing.T ) gophercloud.AuthOptions {
17
- // Obtain credentials from the environment.
18
- options , err := rackspace .AuthOptionsFromEnv ()
19
- th .AssertNoErr (t , err )
20
- options = tools .OnlyRS (options )
21
-
22
- if options .Username == "" {
23
- t .Fatal ("Please provide a Rackspace username as RS_USERNAME." )
24
- }
25
- if options .APIKey == "" {
26
- t .Fatal ("Please provide a Rackspace API key as RS_API_KEY." )
27
- }
28
-
29
- return options
30
- }
31
-
32
- func createClient (t * testing.T , auth bool ) * gophercloud.ServiceClient {
33
- ao := rackspaceAuthOptions (t )
34
-
35
- provider , err := rackspace .NewClient (ao .IdentityEndpoint )
36
- th .AssertNoErr (t , err )
37
-
38
- if auth {
39
- err = rackspace .Authenticate (provider , ao )
40
- th .AssertNoErr (t , err )
41
- }
42
-
43
- return rackspace .NewIdentityV2 (provider )
44
- }
45
-
46
13
func TestTokenAuth (t * testing.T ) {
47
14
authedClient := createClient (t , true )
48
15
token := authedClient .TokenID
@@ -54,7 +21,7 @@ func TestTokenAuth(t *testing.T) {
54
21
55
22
authOpts := tokens.AuthOptions {}
56
23
authOpts .TenantID = tenantID
57
- authOpts .Token = token
24
+ authOpts .TokenID = token
58
25
59
26
_ , err := tokens .Create (authedClient , authOpts ).ExtractToken ()
60
27
th .AssertNoErr (t , err )
0 commit comments