(t *testing.T)
| 61 | } |
| 62 | |
| 63 | func TestDelInteractive(t *testing.T) { |
| 64 | is := is.New(t) |
| 65 | |
| 66 | cfg := &storageMock{ |
| 67 | NamesFunc: func() []string { |
| 68 | return []string{"work"} |
| 69 | }, |
| 70 | DeleteProfileFunc: func(profile string) bool { |
| 71 | return true |
| 72 | }, |
| 73 | SaveFunc: func(filename string) error { |
| 74 | return nil |
| 75 | }, |
| 76 | } |
| 77 | |
| 78 | var b bytes.Buffer |
| 79 | |
| 80 | cmd := delCommand(cfg, func(_ []string, _ io.Reader, _ io.Writer) (string, error) { |
| 81 | return "work", nil |
| 82 | }) |
| 83 | |
| 84 | cmd.SetOut(&b) |
| 85 | cmd.SetArgs(nil) |
| 86 | err := cmd.Execute() |
| 87 | |
| 88 | is.NoErr(err) |
| 89 | is.Equal(len(cfg.DeleteProfileCalls()), 1) |
| 90 | is.Equal(cfg.DeleteProfileCalls()[0].Profile, "work") |
| 91 | is.Equal(len(cfg.SaveCalls()), 1) |
| 92 | is.Equal(trim(b.String()), "Successfully removed `work` profile.") |
| 93 | } |
| 94 | |
| 95 | func TestDelInteractiveCancelled(t *testing.T) { |
| 96 | is := is.New(t) |
nothing calls this directly
no test coverage detected