fix incorrect body of TestACLEndpoint_PolicyBatchRead

Lifted from PR #5307 as it was an unrelated drive-by fix on that PR anyway.

s/token/policy/
This commit is contained in:
R.B. Boyer 2019-02-21 15:49:22 -06:00 committed by R.B. Boyer
parent 360e3acc7c
commit c2a30c5fdd
1 changed files with 11 additions and 11 deletions

View File

@ -1150,32 +1150,32 @@ func TestACLEndpoint_PolicyBatchRead(t *testing.T) {
testrpc.WaitForLeader(t, s1.RPC, "dc1") testrpc.WaitForLeader(t, s1.RPC, "dc1")
t1, err := upsertTestToken(codec, "root", "dc1") p1, err := upsertTestPolicy(codec, "root", "dc1")
require.NoError(t, err) require.NoError(t, err)
t2, err := upsertTestToken(codec, "root", "dc1") p2, err := upsertTestPolicy(codec, "root", "dc1")
require.NoError(t, err) require.NoError(t, err)
acl := ACL{srv: s1} acl := ACL{srv: s1}
tokens := []string{t1.AccessorID, t2.AccessorID} policies := []string{p1.ID, p2.ID}
req := structs.ACLTokenBatchGetRequest{ req := structs.ACLPolicyBatchGetRequest{
Datacenter: "dc1", Datacenter: "dc1",
AccessorIDs: tokens, PolicyIDs: policies,
QueryOptions: structs.QueryOptions{Token: "root"}, QueryOptions: structs.QueryOptions{Token: "root"},
} }
resp := structs.ACLTokenBatchResponse{} resp := structs.ACLPolicyBatchResponse{}
err = acl.TokenBatchRead(&req, &resp) err = acl.PolicyBatchRead(&req, &resp)
require.NoError(t, err) require.NoError(t, err)
var retrievedTokens []string var retrievedPolicies []string
for _, v := range resp.Tokens { for _, v := range resp.Policies {
retrievedTokens = append(retrievedTokens, v.AccessorID) retrievedPolicies = append(retrievedPolicies, v.ID)
} }
require.EqualValues(t, retrievedTokens, tokens) require.EqualValues(t, retrievedPolicies, policies)
} }
func TestACLEndpoint_PolicySet(t *testing.T) { func TestACLEndpoint_PolicySet(t *testing.T) {