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

Function createMockedCommandContext

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

Source from the content-addressed store, hash-verified

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