(t *testing.T)
| 61 | } |
| 62 | |
| 63 | func TestNewCmdDelete(t *testing.T) { |
| 64 | tests := []struct { |
| 65 | name string |
| 66 | tty bool |
| 67 | input string |
| 68 | output DeleteOptions |
| 69 | wantErr bool |
| 70 | wantErrMsg string |
| 71 | }{ |
| 72 | { |
| 73 | name: "tty", |
| 74 | tty: true, |
| 75 | input: "ABC123", |
| 76 | output: DeleteOptions{KeyID: "ABC123", Confirmed: false}, |
| 77 | }, |
| 78 | { |
| 79 | name: "confirm flag tty", |
| 80 | tty: true, |
| 81 | input: "ABC123 --yes", |
| 82 | output: DeleteOptions{KeyID: "ABC123", Confirmed: true}, |
| 83 | }, |
| 84 | { |
| 85 | name: "shorthand confirm flag tty", |
| 86 | tty: true, |
| 87 | input: "ABC123 -y", |
| 88 | output: DeleteOptions{KeyID: "ABC123", Confirmed: true}, |
| 89 | }, |
| 90 | { |
| 91 | name: "no tty", |
| 92 | input: "ABC123", |
| 93 | wantErr: true, |
| 94 | wantErrMsg: "--yes required when not running interactively", |
| 95 | }, |
| 96 | { |
| 97 | name: "confirm flag no tty", |
| 98 | input: "ABC123 --yes", |
| 99 | output: DeleteOptions{KeyID: "ABC123", Confirmed: true}, |
| 100 | }, |
| 101 | { |
| 102 | name: "shorthand confirm flag no tty", |
| 103 | input: "ABC123 -y", |
| 104 | output: DeleteOptions{KeyID: "ABC123", Confirmed: true}, |
| 105 | }, |
| 106 | { |
| 107 | name: "no args", |
| 108 | input: "", |
| 109 | wantErr: true, |
| 110 | wantErrMsg: "cannot delete: key id required", |
| 111 | }, |
| 112 | { |
| 113 | name: "too many args", |
| 114 | input: "ABC123 XYZ", |
| 115 | wantErr: true, |
| 116 | wantErrMsg: "too many arguments", |
| 117 | }, |
| 118 | } |
| 119 | |
| 120 | for _, tt := range tests { |
nothing calls this directly
no test coverage detected