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

Function TestClientPushUsesAuthenticatedUpstreamCommand

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

Source from the content-addressed store, hash-verified

1354}
1355
1356func TestClientPushUsesAuthenticatedUpstreamCommand(t *testing.T) {
1357 // Given a client that records the Git command
1358 var gotArgs []string
1359 client := Client{GitPath: "path/to/git"}
1360
1361 // When a branch is pushed
1362 err := client.Push(t.Context(), "origin", "trunk", recordCommandArgs(t, &gotArgs))
1363
1364 // Then Git clears existing helpers, scopes gh credentials, and sets the upstream
1365 require.NoError(t, err)
1366 assert.Equal(t, []string{"path/to/git", "-c", "credential.helper=", "-c", `credential.helper=!"gh" auth git-credential`, "push", "--set-upstream", "origin", "trunk"}, gotArgs)
1367}
1368
1369func TestClientCloneCreatesWorkingRepositoryInModifiedRepoDir(t *testing.T) {
1370 // Given a local remote with a trunk commit and an empty destination parent

Callers

nothing calls this directly

Calls 3

PushMethod · 0.95
recordCommandArgsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected