MCPcopy
hub / github.com/cli/cli / newTestManager

Function newTestManager

pkg/cmd/extension/manager_test.go:41–65  ·  view source on GitHub ↗
(dataDir, updateDir string, client *http.Client, gitClient gitClient, ios *iostreams.IOStreams)

Source from the content-addressed store, hash-verified

39}
40
41func newTestManager(dataDir, updateDir string, client *http.Client, gitClient gitClient, ios *iostreams.IOStreams) *Manager {
42 return &Manager{
43 dataDir: func() string { return dataDir },
44 updateDir: func() string { return updateDir },
45 lookPath: func(exe string) (string, error) { return exe, nil },
46 findSh: func() (string, error) { return "sh", nil },
47 newCommand: func(exe string, args ...string) *exec.Cmd {
48 args = append([]string{os.Args[0], "-test.run=TestHelperProcess", "--", exe}, args...)
49 cmd := exec.Command(args[0], args[1:]...)
50 if ios != nil {
51 cmd.Stdout = ios.Out
52 cmd.Stderr = ios.ErrOut
53 }
54 cmd.Env = []string{"GH_WANT_HELPER_PROCESS=1"}
55 return cmd
56 },
57 config: config.NewBlankConfig(),
58 io: ios,
59 client: client,
60 gitClient: gitClient,
61 platform: func() (string, string) {
62 return "windows-amd64", ".exe"
63 },
64 }
65}
66
67func TestManager_List(t *testing.T) {
68 dataDir := t.TempDir()

Calls 2

NewBlankConfigFunction · 0.92
CommandMethod · 0.80

Tested by

no test coverage detected