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

Function TestClientCloneUsesHostScopedAuthenticatedCommand

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

Source from the content-addressed store, hash-verified

1446}
1447
1448func TestClientCloneUsesHostScopedAuthenticatedCommand(t *testing.T) {
1449 // Given a client that records the Git command
1450 var gotArgs []string
1451 client := Client{GitPath: "path/to/git"}
1452
1453 // When an HTTPS repository is cloned
1454 _, err := client.Clone(t.Context(), "https://github.com/cli/cli", nil, recordCommandArgs(t, &gotArgs))
1455
1456 // Then Git clears existing helpers and scopes gh credentials to the repository host
1457 require.NoError(t, err)
1458 assert.Equal(t, []string{"path/to/git", "-c", "credential.https://github.com.helper=", "-c", `credential.https://github.com.helper=!"gh" auth git-credential`, "clone", "https://github.com/cli/cli"}, gotArgs)
1459}
1460
1461func TestParseCloneArgs(t *testing.T) {
1462 type wanted struct {

Callers

nothing calls this directly

Calls 3

CloneMethod · 0.95
recordCommandArgsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected