(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestConfigRemoveErrors(t *testing.T) { |
| 17 | testCases := []struct { |
| 18 | args []string |
| 19 | configRemoveFunc func(context.Context, string, client.ConfigRemoveOptions) (client.ConfigRemoveResult, error) |
| 20 | expectedError string |
| 21 | }{ |
| 22 | { |
| 23 | args: []string{}, |
| 24 | expectedError: "requires at least 1 argument", |
| 25 | }, |
| 26 | { |
| 27 | args: []string{"foo"}, |
| 28 | configRemoveFunc: func(ctx context.Context, name string, options client.ConfigRemoveOptions) (client.ConfigRemoveResult, error) { |
| 29 | return client.ConfigRemoveResult{}, errors.New("error removing config") |
| 30 | }, |
| 31 | expectedError: "error removing config", |
| 32 | }, |
| 33 | } |
| 34 | for _, tc := range testCases { |
| 35 | cmd := newConfigRemoveCommand( |
| 36 | test.NewFakeCli(&fakeClient{ |
| 37 | configRemoveFunc: tc.configRemoveFunc, |
| 38 | }), |
| 39 | ) |
| 40 | cmd.SetArgs(tc.args) |
| 41 | cmd.SetOut(io.Discard) |
| 42 | cmd.SetErr(io.Discard) |
| 43 | assert.ErrorContains(t, cmd.Execute(), tc.expectedError) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | func TestConfigRemoveWithName(t *testing.T) { |
| 48 | names := []string{"foo", "bar"} |
nothing calls this directly
no test coverage detected
searching dependent graphs…