handlers: always return pagination parameters in list (#4373)
* handlers/targets: always return pagination parameters in list * handlers/authmethods: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/accounts: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/authtokens: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/credentiallibraries: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/credentials: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * 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. * handlers/groups: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/host_catalogs: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/host_sets: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/hosts: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/managed_groups: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/roles: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/scopes: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/sessions: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so. * handlers/users: test for pagination parameters Note that this already always returned the pagination parameters, but now we have a test that it does so.
This commit is contained in:
1 parent
4068829509
commit
e95eda7ca2
24 files changed
+471
-33
No files matched your search
@@ -1645,7 +1645,7 @@ func TestListPagination(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
orgNoAms, _ := iam.TestScopes(t, iamRepo)
|
||||
org, proj := iam.TestScopes(t, iamRepo)
|
||||
org, proj := iam.TestScopes(t, iamRepo, iam.WithSkipDefaultRoleCreation(true))
|
||||
databaseWrapper, err := kmsCache.GetWrapper(context.Background(), org.GetPublicId(), kms.KeyPurposeDatabase)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -2020,4 +2020,29 @@ func TestListPagination(t *testing.T) {
|
||||
cmpOptions...,
|
||||
),
|
||||
)
|
||||
|
||||
// Create unauthenticated user
|
||||
unauthAt := authtoken.TestAuthToken(t, conn, kmsCache, org.GetPublicId())
|
||||
unauthR := iam.TestRole(t, conn, proj.GetPublicId())
|
||||
_ = iam.TestUserRole(t, conn, unauthR.GetPublicId(), unauthAt.GetIamUserId())
|
||||
|
||||
// Make a request with the unauthenticated user,
|
||||
// ensure the response contains the pagination parameters.
|
||||
requestInfo = authpb.RequestInfo{
|
||||
TokenFormat: uint32(requestauth.AuthTokenTypeBearer),
|
||||
PublicId: unauthAt.GetPublicId(),
|
||||
Token: unauthAt.GetToken(),
|
||||
}
|
||||
requestContext = context.WithValue(context.Background(), requests.ContextRequestInformationKey, &requests.RequestContext{})
|
||||
ctx = requestauth.NewVerifierContext(requestContext, iamRepoFn, tokenRepoFn, serversRepoFn, kmsCache, &requestInfo)
|
||||
|
||||
got, err = s.ListAuthMethods(ctx, &pbs.ListAuthMethodsRequest{
|
||||
ScopeId: "global",
|
||||
Recursive: true,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Empty(t, got.Items)
|
||||
assert.Equal(t, "created_time", got.SortBy)
|
||||
assert.Equal(t, "desc", got.SortDir)
|
||||
assert.Equal(t, "complete", got.ResponseType)
|
||||
}
|
||||
Reference in new issue
Block a user