MCPcopy Create free account
hub / github.com/cli/cli / TestPrompt_expiring_stop

Function TestPrompt_expiring_stop

pkg/cmd/auth/shared/git_credential_test.go:254–273  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

252}
253
254func TestPrompt_expiring_stop(t *testing.T) {
255 ios, _, _, _ := iostreams.Test()
256 f := GitCredentialFlow{
257 IO: ios,
258 Prompter: &prompter.PrompterMock{
259 SelectFunc: func(_, _ string, options []string) (int, error) {
260 return slices.Index(options, "Cancel"), nil
261 },
262 },
263 HelperConfig: &stubHelperConfig{helper: gitcredentials.Helper{Cmd: "osxkeychain"}},
264 }
265
266 err := f.Prompt("github.com", true)
267 if !errors.Is(err, ErrExpiringSetupCredHelperCancelled) {
268 t.Errorf("Prompt() error = %v, want ErrExpiringSetupCredHelperCancelled", err)
269 }
270 if f.ShouldSetup() {
271 t.Error("ShouldSetup() = true, want false after stopping the sign-in")
272 }
273}
274
275func TestPrompt_expiring_alreadyOurs(t *testing.T) {
276 selectCalled := false

Callers

nothing calls this directly

Calls 5

PromptMethod · 0.95
ShouldSetupMethod · 0.95
TestFunction · 0.92
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected