MCPcopy
hub / github.com/cli/cli / createMockedCommandContext

Function createMockedCommandContext

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

Source from the content-addressed store, hash-verified

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