-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add a --fullname arg to gitea admin user create. #34241
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
cmd/admin_user_create_test.go
Outdated
createUserN := func(name string, args []string) error { | ||
cmd := []string{"./gitea", "admin", "user", "create", "--username", name, "--email", name + "@gitea.local"} | ||
cmd = append(cmd, args...) | ||
return app.Run(cmd) | ||
} |
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.
It doesn't to test "space" behavior. You could just still use the old createUser
The "space" behavior is guaranteed by the shell CLI
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.
The string.Fields
call in the old createUser doesn't allow for spaces in arguments so it can't be used here.
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.
It doesn't to test "space" behavior. You could just still use the old createUser
The "space" behavior is guaranteed by the shell CLI
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.
If you still prefer to test the space behavior, it's better to refactor the old "createUser" to support arguments:
createUser := func(name, args ...string) error {
return app.Run(append([]string{"./gitea", "admin", "user", "create", "--username", name, "--email", name + "@gitea.local"}, args...)...)
}
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.
I made some changes in 685d98a :
- Refactor
createUser
to accept argument slice, then we can use it for general purpose, without duplicating code - Simplify the test cases, I think these 2 cases should be able to have a good coverage (same coverage as before)
Does it look good to you?
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.
Yes, that's definitely better, thank you!
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.
Thank you for the PR too! Will merge after CI passes.
857a458
to
2f1dd3d
Compare
5f2aad7
to
685d98a
Compare
* giteaofficial/main: Add API routes to lock and unlock issues (go-gitea#34165) Make ROOT_URL support using request Host header (go-gitea#32564) Valid email address should only start with alphanumeric (go-gitea#28174) Fix notify watch failure when the content is too long (go-gitea#34233) Add "--fullname" arg to gitea admin user create (go-gitea#34241) Fix various UI problems (go-gitea#34243) markup: improve code block readability and isolate copy button (go-gitea#34009) Don't assume the default wiki branch is master in the wiki API (go-gitea#34244) [skip ci] Updated translations via Crowdin Optimize the calling code of queryElems (go-gitea#34235) Actions Runner rest api (go-gitea#33873) Fix some trivial problems (go-gitea#34237) Swift files can be passed either as file or as form value (go-gitea#34068) # Conflicts: # templates/repo/wiki/revision.tmpl
No description provided.