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