Skip to content

Conversation

InfinityTwo
Copy link
Contributor

Part of #12048

Outline of Solution
Added the unit tests for GetUsageStatisticsActionTest for PostgreSQL.

Copy link
Contributor

@jasonqiu212 jasonqiu212 left a comment

Choose a reason for hiding this comment

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

lgtm! good work

@jasonqiu212
Copy link
Contributor

Was thinking if we can explore abstracting the access control tests in sqlui/webapi/BaseActionTest.java, like in the old tests. Currently, I feel like there's a lot of repeated code for testing access control

@jasonqiu212 jasonqiu212 added the s.FinalReview The PR is ready for final review label Feb 27, 2025
@InfinityTwo
Copy link
Contributor Author

Was thinking if we can explore abstracting the access control tests in sqlui/webapi/BaseActionTest.java, like in the old tests. Currently, I feel like there's a lot of repeated code for testing access control

Hmm, great idea, I was thinking of it as well instead of copy pasting it for each new migrated test. I think the next time I work on it, I'll add the abstraction and do a refactor of the PRs.

Do you think we should make it similar to the previous method names such as verifyOnlyAdminsCanAccess() or should we have one method for it all, and pass in 6? boolean parameters for each user type?

@jasonqiu212
Copy link
Contributor

@InfinityTwo That would be great! thank you!!

Let's follow the previous method names (i.e., having 1 method for each role). I think this follows open-closed principle more (please correct me if i'm wrong..), since if we have additional user types, we just simply add a new method, and the old methods do not need to be modified.

If we have 1 method for all roles, and pass in boolean parameters for each role, adding a new user type means we need to change all of the method calls' arguments to add in the new boolean for the new role.

Copy link
Contributor

@domoberzin domoberzin left a comment

Choose a reason for hiding this comment

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

LGTM!

@domoberzin domoberzin added s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging and removed s.FinalReview The PR is ready for final review labels Feb 28, 2025
@domoberzin domoberzin merged commit e9a0ea0 into TEAMMATES:master Feb 28, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants