Skip to content

Add update-user command with documentation and tests#305

Open
duanemay wants to merge 1 commit into
masterfrom
Add-update-user
Open

Add update-user command with documentation and tests#305
duanemay wants to merge 1 commit into
masterfrom
Add-update-user

Conversation

@duanemay

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 11, 2026 22:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new uaa update-user CLI command (plus docs and tests) to update existing UAA users by first retrieving the user and then issuing an update with merged changes.

Changes:

  • Introduces update-user command implementation with support for updating names, emails, phones, and removing selected attributes.
  • Adds command documentation and links it from the main command reference.
  • Adds Ginkgo/Gomega integration tests for validation and common update scenarios.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
cmd/update_user.go Implements the update-user cobra command and update logic.
cmd/update_user_test.go Adds integration tests covering basic success/error flows and flag handling.
docs/commands/update-user.md Documents usage, flags, examples, and notes for update-user.
docs/commands.md Adds update-user to the command reference list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/update_user.go
Comment on lines +81 to +89
func UpdateUserValidation(cfg config.Config, args []string) error {
if err := cli.EnsureContextInConfig(cfg); err != nil {
return err
}
if len(args) == 0 {
return errors.New("The positional argument USERNAME must be specified.")
}
return nil
}
Comment thread cmd/update_user.go
Comment on lines +114 to +119
updateUserCmd.Flags().StringVarP(&familyName, "family_name", "", "", "family name")
updateUserCmd.Flags().StringVarP(&givenName, "given_name", "", "", "given name")
updateUserCmd.Flags().StringVarP(&origin, "origin", "o", "", "user origin")
updateUserCmd.Flags().StringSliceVarP(&emails, "emails", "", []string{}, "email addresses (multiple may be specified)")
updateUserCmd.Flags().StringSliceVarP(&phoneNumbers, "phones", "", []string{}, "phone numbers (multiple may be specified)")
updateUserCmd.Flags().StringSliceVarP(&delAttrs, "del_attrs", "", []string{}, "attributes to remove (phoneNumbers, name, etc.)")
Comment thread cmd/update_user_test.go
Comment on lines +61 to +68
// Then PUT to update user
server.RouteToHandler("PUT", "/Users/fb5f32e1-5cb3-49e6-93df-6df9c8c8bd70", CombineHandlers(
RespondWith(http.StatusOK, fixtures.MarcusUserResponse),
VerifyRequest("PUT", "/Users/fb5f32e1-5cb3-49e6-93df-6df9c8c8bd70"),
VerifyHeaderKV("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ"),
VerifyHeaderKV("Accept", "application/json"),
VerifyHeaderKV("Content-Type", "application/json"),
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants