(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func TestRunEncrypt_Interactive_PasswordMismatch(t *testing.T) { |
| 172 | defer resetMocks() |
| 173 | |
| 174 | callCount := 0 |
| 175 | var fatalMsg string |
| 176 | fatalFn = func(args ...interface{}) { fatalMsg = fmt.Sprint(args...) } |
| 177 | readPasswordFn = func(_ string) ([]byte, error) { |
| 178 | callCount++ |
| 179 | if callCount == 1 { |
| 180 | return []byte("password1"), nil |
| 181 | } |
| 182 | return []byte("password2"), nil |
| 183 | } |
| 184 | |
| 185 | runEncrypt() |
| 186 | assert.Contains(t, fatalMsg, "do not match") |
| 187 | } |
| 188 | |
| 189 | func TestRunEncrypt_Interactive_ReadError(t *testing.T) { |
| 190 | defer resetMocks() |
nothing calls this directly
no test coverage detected