Add update-user command with documentation and tests#305
Open
duanemay wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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-usercommand 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 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 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 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"), | ||
| )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.