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

Function TestDetectConfiguredHelper

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

Source from the content-addressed store, hash-verified

330}
331
332func TestDetectConfiguredHelper(t *testing.T) {
333 tests := []struct {
334 name string
335 helper gitcredentials.Helper
336 helperErr error
337 want string
338 }{
339 {name: "ours", helper: gitcredentials.Helper{Cmd: "!/path/to/gh auth git-credential"}, want: "ours"},
340 {name: "other", helper: gitcredentials.Helper{Cmd: "osxkeychain"}, want: "other"},
341 {name: "none", helper: gitcredentials.Helper{}, want: "none"},
342 {name: "error", helperErr: errors.New("git config failed"), want: "error"},
343 }
344 for _, tt := range tests {
345 t.Run(tt.name, func(t *testing.T) {
346 f := GitCredentialFlow{
347 HelperConfig: &stubHelperConfig{helper: tt.helper, helperErr: tt.helperErr},
348 }
349 if got := f.DetectConfiguredHelper("example.com"); got != tt.want {
350 t.Errorf("DetectConfiguredHelper() = %q, want %q", got, tt.want)
351 }
352 })
353 }
354}
355
356func TestResultingHelperCategory_detectionErrorWithoutSetup(t *testing.T) {
357 f := GitCredentialFlow{

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected