(t *testing.T, commands mockedCommands)
| 2148 | } |
| 2149 | |
| 2150 | func 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 | |
| 2168 | func TestClientRemoteURL(t *testing.T) { |
| 2169 | tests := []struct { |
no outgoing calls
no test coverage detected