jrperritt | 95b74c8 | 2015-07-28 20:39:27 -0600 | [diff] [blame] | 1 | // +build acceptance |
| 2 | |
| 3 | package v2 |
| 4 | |
| 5 | import ( |
| 6 | "os" |
| 7 | "testing" |
| 8 | |
jrperritt | 95b74c8 | 2015-07-28 20:39:27 -0600 | [diff] [blame] | 9 | "github.com/rackspace/gophercloud/rackspace/identity/v2/tokens" |
| 10 | th "github.com/rackspace/gophercloud/testhelper" |
| 11 | ) |
| 12 | |
jrperritt | 95b74c8 | 2015-07-28 20:39:27 -0600 | [diff] [blame] | 13 | func TestTokenAuth(t *testing.T) { |
| 14 | authedClient := createClient(t, true) |
| 15 | token := authedClient.TokenID |
| 16 | |
| 17 | tenantID := os.Getenv("RS_TENANT_ID") |
| 18 | if tenantID == "" { |
| 19 | t.Skip("You must set RS_TENANT_ID environment variable to run this test") |
| 20 | } |
| 21 | |
| 22 | authOpts := tokens.AuthOptions{} |
| 23 | authOpts.TenantID = tenantID |
jrperritt | fbc0409 | 2016-02-17 15:24:11 -0600 | [diff] [blame] | 24 | authOpts.TokenID = token |
jrperritt | 95b74c8 | 2015-07-28 20:39:27 -0600 | [diff] [blame] | 25 | |
| 26 | _, err := tokens.Create(authedClient, authOpts).ExtractToken() |
| 27 | th.AssertNoErr(t, err) |
| 28 | } |