(t *testing.T)
| 330 | } |
| 331 | |
| 332 | func 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 | |
| 356 | func TestResultingHelperCategory_detectionErrorWithoutSetup(t *testing.T) { |
| 357 | f := GitCredentialFlow{ |
nothing calls this directly
no test coverage detected