(t *testing.T, hostname string, exitStatus int, verifyLogout func())
| 1292 | } |
| 1293 | |
| 1294 | func stubCredentialReject(t *testing.T, hostname string, exitStatus int, verifyLogout func()) *git.Client { |
| 1295 | t.Helper() |
| 1296 | cs, restoreRun := run.Stub() |
| 1297 | t.Cleanup(func() { restoreRun(t) }) |
| 1298 | if hostname != "" { |
| 1299 | cs.Register(`git credential reject`, exitStatus, "", func([]string) { verifyLogout() }) |
| 1300 | } |
| 1301 | prepareCmd := run.PrepareCmd |
| 1302 | run.PrepareCmd = func(cmd *exec.Cmd) run.Runnable { |
| 1303 | require.Equal(t, []string{"credential", "reject"}, cmd.Args[1:]) |
| 1304 | require.NotNil(t, cmd.Stdin) |
| 1305 | input, err := io.ReadAll(cmd.Stdin) |
| 1306 | require.NoError(t, err) |
| 1307 | require.Equal(t, "protocol=https\nhost="+hostname+"\n", string(input)) |
| 1308 | return prepareCmd(cmd) |
| 1309 | } |
| 1310 | return &git.Client{GitPath: "some/path/git"} |
| 1311 | } |
| 1312 | |
| 1313 | type logoutLockErrorAuthConfig struct { |
| 1314 | gh.AuthConfig |
no test coverage detected