handlers/credentialstores: test for pagination parameters

Note that this already always returned the pagination parameters,
but now we have a test that it does so.
pull/4373/head
Johan Brandhorst-Satzkorn 2 years ago
parent 87816167bc
commit 003bb12ef7

@ -2008,4 +2008,26 @@ func TestListPagination(t *testing.T) {
protocmp.IgnoreFields(&pbs.ListCredentialStoresResponse{}, "list_token"),
),
)
// Create unauthenticated user
unauthAt := authtoken.TestAuthToken(t, conn, kms, o.GetPublicId())
unauthR := iam.TestRole(t, conn, prj.GetPublicId())
_ = iam.TestUserRole(t, conn, unauthR.GetPublicId(), unauthAt.GetIamUserId())
// Make a request with the unauthenticated user,
// ensure the response is 403 forbidden.
requestInfo = authpb.RequestInfo{
TokenFormat: uint32(auth.AuthTokenTypeBearer),
PublicId: unauthAt.GetPublicId(),
Token: unauthAt.GetToken(),
}
requestContext = context.WithValue(context.Background(), requests.ContextRequestInformationKey, &requests.RequestContext{})
ctx = auth.NewVerifierContext(requestContext, iamRepoFn, tokenRepoFn, serversRepoFn, kms, &requestInfo)
_, err = s.ListCredentialStores(ctx, &pbs.ListCredentialStoresRequest{
ScopeId: "global",
Recursive: true,
})
require.Error(err)
assert.ErrorIs(handlers.ForbiddenError(), err)
}

Loading…
Cancel
Save