Skip to content

test: add grants test for auth-token resource #5588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 66 commits into
base: llb-normalized-grants-tests-only
Choose a base branch
from

Conversation

elimt
Copy link

@elimt elimt commented Mar 7, 2025

test: add grants test for auth-token resource

  • add test that tests the grants for the auth-token resource with different actions, scopes and output fields
  • Fix bug where the ParentScopeId is not set when fetching output fields for a resource. Output fields were not being respected for children grant scopes.

@elimt elimt added this to the 0.20.x milestone Mar 7, 2025
@elimt elimt requested review from bosorawis and dkanney March 7, 2025 20:50
@elimt elimt requested a review from a team as a code owner March 7, 2025 20:50
@elimt elimt force-pushed the elimt-auth-tokens-grants-test branch from 89e5134 to aae3126 Compare March 7, 2025 20:52
}
}

func TestGrants_Read(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test that covers output_fields=* to verify that all the fields are being returned properly in the happy path case?

if tc.wantErr != nil {
require.ErrorIs(t, finalErr, tc.wantErr)
return
testcases := []struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a few negative tests for missing permissions, tests with specific scope grants, and tests with specific resource ID grants?

}
}

func TestGrants_ReadSelf(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a case that covers grants with specific resource ID?

}
}

func TestGrants_DeleteSelf(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests for specific resource ID grants

Copy link
Collaborator

@bosorawis bosorawis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changes LGTM! I'd like to see a few more test cases covering grants with specific IDs - specifically for ...-self calls where the granted resource ID doesn't match the user's token

bosorawis and others added 6 commits March 18, 2025 08:53
* Fix bug where the `ParentScopeId` is not set when fetching output fields for a resource. Output fields were not being respected for children grant scopes.
- add test that tests the grants for the auth-token resource with different actions, scopes and output fields
@elimt elimt force-pushed the elimt-auth-tokens-grants-test branch from 85c9230 to 0fcf4e5 Compare March 21, 2025 15:12
Base automatically changed from bosorawis-prototype-grant-test to llb-normalized-grants-tests-only March 26, 2025 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants