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

Function createMockedCommandContext

git/client_test.go:2153–2169  ·  view source on GitHub ↗
(t *testing.T, commands mockedCommands)

Source from the content-addressed store, hash-verified

2151}
2152
2153func createMockedCommandContext(t *testing.T, commands mockedCommands) commandCtx {
2154 marshaledCommands, err := json.Marshal(commands)
2155 require.NoError(t, err)
2156
2157 // invokes helper within current test binary, emulating desired behavior
2158 return func(ctx context.Context, exe string, args ...string) *exec.Cmd {
2159 cmd := exec.CommandContext(context.Background(), os.Args[0], "-test.run=TestCommandMocking", "--")
2160 cmd.Env = []string{
2161 "GH_WANT_HELPER_PROCESS_RICH=1",
2162 fmt.Sprintf("GH_HELPER_PROCESS_RICH_COMMANDS=%s", string(marshaledCommands)),
2163 }
2164
2165 cmd.Args = append(cmd.Args, exe)
2166 cmd.Args = append(cmd.Args, args...)
2167 return cmd
2168 }
2169}
2170
2171func TestClientRemoteURL(t *testing.T) {
2172 tests := []struct {

Callers 7

TestClientPushDefaultFunction · 0.85
TestClientFetchFunction · 0.85
TestClientPullFunction · 0.85
TestClientPushFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected