(t *testing.T)
| 81 | } |
| 82 | |
| 83 | func TestClientAuthenticatedCommandScopesCredentialHelperToPattern(t *testing.T) { |
| 84 | // Given a client with an explicit gh executable |
| 85 | client := Client{ |
| 86 | GhPath: "path/to/gh", |
| 87 | GitPath: "path/to/git", |
| 88 | } |
| 89 | |
| 90 | // When an authenticated command is created for one credential pattern |
| 91 | cmd, err := client.AuthenticatedCommand(t.Context(), CredentialPattern{pattern: "https://github.com"}, "fetch") |
| 92 | |
| 93 | // Then existing helpers are cleared and gh receives credentials only for that pattern |
| 94 | require.NoError(t, err) |
| 95 | assert.Equal(t, []string{"path/to/git", "-c", "credential.https://github.com.helper=", "-c", `credential.https://github.com.helper=!"path/to/gh" auth git-credential`, "fetch"}, cmd.Args) |
| 96 | } |
| 97 | |
| 98 | func TestClientAuthenticatedCommandDefaultsToGhOnPath(t *testing.T) { |
| 99 | // Given a client without an explicit gh executable |
nothing calls this directly
no test coverage detected