(t *testing.T)
| 18 | ) |
| 19 | |
| 20 | func TestNewCmdDelete(t *testing.T) { |
| 21 | tests := []struct { |
| 22 | name string |
| 23 | tty bool |
| 24 | input string |
| 25 | output DeleteOptions |
| 26 | wantErr bool |
| 27 | wantErrMsg string |
| 28 | }{ |
| 29 | { |
| 30 | name: "tty", |
| 31 | tty: true, |
| 32 | input: "123", |
| 33 | output: DeleteOptions{KeyID: "123", Confirmed: false}, |
| 34 | }, |
| 35 | { |
| 36 | name: "confirm flag tty", |
| 37 | tty: true, |
| 38 | input: "123 --yes", |
| 39 | output: DeleteOptions{KeyID: "123", Confirmed: true}, |
| 40 | }, |
| 41 | { |
| 42 | name: "shorthand confirm flag tty", |
| 43 | tty: true, |
| 44 | input: "123 -y", |
| 45 | output: DeleteOptions{KeyID: "123", Confirmed: true}, |
| 46 | }, |
| 47 | { |
| 48 | name: "no tty", |
| 49 | input: "123", |
| 50 | wantErr: true, |
| 51 | wantErrMsg: "--yes required when not running interactively", |
| 52 | }, |
| 53 | { |
| 54 | name: "confirm flag no tty", |
| 55 | input: "123 --yes", |
| 56 | output: DeleteOptions{KeyID: "123", Confirmed: true}, |
| 57 | }, |
| 58 | { |
| 59 | name: "shorthand confirm flag no tty", |
| 60 | input: "123 -y", |
| 61 | output: DeleteOptions{KeyID: "123", Confirmed: true}, |
| 62 | }, |
| 63 | { |
| 64 | name: "no args", |
| 65 | input: "", |
| 66 | wantErr: true, |
| 67 | wantErrMsg: "cannot delete: key id required", |
| 68 | }, |
| 69 | { |
| 70 | name: "too many args", |
| 71 | input: "123 456", |
| 72 | wantErr: true, |
| 73 | wantErrMsg: "too many arguments", |
| 74 | }, |
| 75 | } |
| 76 | |
| 77 | for _, tt := range tests { |
nothing calls this directly
no test coverage detected