Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Merge eb0ce6d into c90cb95
Browse files Browse the repository at this point in the history
  • Loading branch information
MatMaul committed Sep 20, 2016
2 parents c90cb95 + eb0ce6d commit f883b6a
Showing 1 changed file with 3 additions and 33 deletions.
Expand Up @@ -17,7 +17,7 @@ func authTokenPost(t *testing.T, options gophercloud.AuthOptions, scope *tokens.

client := gophercloud.ServiceClient{
ProviderClient: &gophercloud.ProviderClient{
TokenID: "12345abcdef",
TokenID: options.TokenID,
},
Endpoint: testhelper.Endpoint(),
}
Expand All @@ -42,29 +42,8 @@ func authTokenPost(t *testing.T, options gophercloud.AuthOptions, scope *tokens.
}
}

func authTokenPostErr(t *testing.T, options gophercloud.AuthOptions, scope *tokens.Scope, includeToken bool, expectedErr error) {
testhelper.SetupHTTP()
defer testhelper.TeardownHTTP()

client := gophercloud.ServiceClient{
ProviderClient: &gophercloud.ProviderClient{},
Endpoint: testhelper.Endpoint(),
}
if includeToken {
client.TokenID = "abcdef123456"
}

_, err := tokens.Create(&client, AuthOptionsExt{AuthOptions: tokens.AuthOptions{options}, TrustID: "123456"}, scope).Extract()
if err == nil {
t.Errorf("Create did NOT return an error")
}
if err != expectedErr {
t.Errorf("Create returned an unexpected error: wanted %v, got %v", expectedErr, err)
}
}

func TestTrustIDTokenID(t *testing.T) {
options := gophercloud.AuthOptions{TokenID: "old_trustee"}
options := gophercloud.AuthOptions{TokenID: "trustee_token"}
var scope *tokens.Scope
authTokenPost(t, options, scope, `
{
Expand All @@ -74,7 +53,7 @@ func TestTrustIDTokenID(t *testing.T) {
"token"
],
"token": {
"id": "12345abcdef"
"id": "trustee_token"
}
},
"scope": {
Expand All @@ -87,12 +66,3 @@ func TestTrustIDTokenID(t *testing.T) {
`)
}

func TestFailurePassword(t *testing.T) {
options := gophercloud.AuthOptions{TokenID: "fakeidnopass"}
//Service Client must have tokenId or password,
//setting include tokenId to false
//scope := &Scope{TrustID: "notenough"}
var scope *tokens.Scope
authTokenPostErr(t, options, scope, false, tokens.ErrMissingPassword)
}

0 comments on commit f883b6a

Please sign in to comment.