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

Function TestClientAuthenticatedCommandDefaultsToGhOnPath

git/client_test.go:98–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestClientAuthenticatedCommandDefaultsToGhOnPath(t *testing.T) {
99 // Given a client without an explicit gh executable
100 client := Client{GitPath: "path/to/git"}
101
102 // When an authenticated command is created
103 cmd, err := client.AuthenticatedCommand(t.Context(), AllMatchingCredentialsPattern, "fetch")
104
105 // Then gh is resolved from PATH by the credential helper
106 require.NoError(t, err)
107 assert.Equal(t, []string{"path/to/git", "-c", "credential.helper=", "-c", `credential.helper=!"gh" auth git-credential`, "fetch"}, cmd.Args)
108}
109
110func TestClientAuthenticatedCommandRejectsEmptyCredentialPattern(t *testing.T) {
111 // Given a client and an empty host-scoped credential pattern

Callers

nothing calls this directly

Calls 2

AuthenticatedCommandMethod · 0.95
EqualMethod · 0.80

Tested by

no test coverage detected