(t *testing.T)
| 1446 | } |
| 1447 | |
| 1448 | func 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 | |
| 1461 | func TestParseCloneArgs(t *testing.T) { |
| 1462 | type wanted struct { |
nothing calls this directly
no test coverage detected