MCPcopy Create free account
hub / github.com/Driver-C/tryssh / TestRunEncrypt_Interactive_ConfirmReadError

Function TestRunEncrypt_Interactive_ConfirmReadError

cmd/encrypt/encrypt_test.go:200–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

198}
199
200func TestRunEncrypt_Interactive_ConfirmReadError(t *testing.T) {
201 defer resetMocks()
202
203 callCount := 0
204 var fatalMsg string
205 fatalFn = func(args ...interface{}) { fatalMsg = fmt.Sprint(args...) }
206 readPasswordFn = func(_ string) ([]byte, error) {
207 callCount++
208 if callCount == 1 {
209 return []byte("password1"), nil
210 }
211 return nil, errors.New("confirm error")
212 }
213
214 runEncrypt()
215 assert.Contains(t, fatalMsg, "Failed to read password")
216}
217
218func TestRunEncrypt_Interactive_Success(t *testing.T) {
219 defer resetMocks()

Callers

nothing calls this directly

Calls 2

resetMocksFunction · 0.85
runEncryptFunction · 0.85

Tested by

no test coverage detected