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

Function newTestManager

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

Source from the content-addressed store, hash-verified

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

Calls 2

NewMockConfigFunction · 0.92
CommandMethod · 0.80

Tested by

no test coverage detected