(t *testing.T, commands mockedCommands)
| 2152 | } |
| 2153 | |
| 2154 | func 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 | |
| 2172 | func TestClientRemoteURL(t *testing.T) { |
| 2173 | tests := []struct { |
no outgoing calls
no test coverage detected