Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ or you want to pick up new tools.
### Renaming a profile

```bash
praxis profiles rename test-x astuto-cp
praxis profiles rename test-x acme-prod
```

Credentials-only: the section keeps its URL, username, token, and
Expand Down
10 changes: 5 additions & 5 deletions cmd/profiles_manage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ func TestProfilesRename_HappyPath(t *testing.T) {
var buf bytes.Buffer
profilesRenameCmd.SetOut(&buf)
profilesRenameJSON = true
if err := profilesRenameCmd.RunE(profilesRenameCmd, []string{"test-x", "astuto-cp"}); err != nil {
if err := profilesRenameCmd.RunE(profilesRenameCmd, []string{"test-x", "acme-prod"}); err != nil {
t.Fatalf("rename err: %v", err)
}
out := buf.String()
for _, want := range []string{`"ok": true`, `"renamed_to": "astuto-cp"`, `"active_pointer_updated": true`} {
for _, want := range []string{`"ok": true`, `"renamed_to": "acme-prod"`, `"active_pointer_updated": true`} {
if !strings.Contains(out, want) {
t.Errorf("rename output missing %q\nfull: %s", want, out)
}
}
store, _ := credentials.Load()
if _, ok := store["astuto-cp"]; !ok {
if _, ok := store["acme-prod"]; !ok {
t.Error("renamed profile missing from store")
}
active, _ := credentials.ResolveActiveGlobal()
if active.Name != "astuto-cp" {
t.Errorf("active = %s, want astuto-cp", active.Name)
if active.Name != "acme-prod" {
t.Errorf("active = %s, want acme-prod", active.Name)
}
}

Expand Down