-
Notifications
You must be signed in to change notification settings - Fork 31
Only convert user and group names to lowercase in API methods #1125
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
Conversation
3v1n0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanup!
| // authd uses lowercase user and group names | ||
| uInfo.Name = strings.ToLower(uInfo.Name) | ||
| for i, g := range uInfo.Groups { | ||
| uInfo.Groups[i].Name = strings.ToLower(g.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is already tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove leftover golden files from tests that don't exist anymore by
running
git rm -r internal/**/testdata/golden
TESTS_UPDATE_GOLDEN=1 go test ./internal/...
We use underscores instead of spaces in test names.
Immediately convert username to lowercase, for consistency with how it's done in the other methods.
We use underscores instead of spaces in test names.
For consistency with the other *_with_uppercase test cases.
The tests change DB content, so we should also check the result.
We now only convert user and group names to lowercase in public API methods. In all other functions, we assume that the names are already in lowercase, to avoid repeatedly converting the same name to lowercase in each layer of our code.
6de67e4 to
8066a69
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1125 +/- ##
==========================================
- Coverage 87.79% 87.78% -0.01%
==========================================
Files 89 89
Lines 6151 6150 -1
Branches 111 111
==========================================
- Hits 5400 5399 -1
Misses 695 695
Partials 56 56 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
As discussed in #1082 (comment), we now only convert user and group names to lowercase in public API methods. In all other functions, we assume that the names are already in lowercase, to avoid repeatedly converting the same name to lowercase in each layer of our code.