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

Function TestClientFetchUsesAuthenticatedCommand

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

Source from the content-addressed store, hash-verified

1238}
1239
1240func TestClientFetchUsesAuthenticatedCommand(t *testing.T) {
1241 // Given a client that records the Git command
1242 var gotArgs []string
1243 client := Client{GitPath: "path/to/git"}
1244
1245 // When a remote branch is fetched
1246 err := client.Fetch(t.Context(), "origin", "trunk", recordCommandArgs(t, &gotArgs))
1247
1248 // Then Git clears existing helpers and scopes gh credentials to all hosts
1249 require.NoError(t, err)
1250 assert.Equal(t, []string{"path/to/git", "-c", "credential.helper=", "-c", `credential.helper=!"gh" auth git-credential`, "fetch", "origin", "trunk"}, gotArgs)
1251}
1252
1253func TestClientPullFastForwardsCurrentBranch(t *testing.T) {
1254 // Given a local branch behind its remote and a client defaulting to a different repository

Callers

nothing calls this directly

Calls 3

FetchMethod · 0.95
recordCommandArgsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected