MCPcopy
hub / github.com/cli/cli / TestManager_Install_local_no_executable_found

Function TestManager_Install_local_no_executable_found

pkg/cmd/extension/manager_test.go:798–821  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

796}
797
798func TestManager_Install_local_no_executable_found(t *testing.T) {
799 dataDir := t.TempDir()
800 updateDir := t.TempDir()
801 ios, _, stdout, stderr := iostreams.Test()
802 m := newTestManager(dataDir, updateDir, nil, nil, ios)
803 fakeExtensionName := "gh-local-ext"
804
805 // Create a temporary directory to simulate the local extension repo
806 localDir := filepath.Join(dataDir, fakeExtensionName)
807 require.NoError(t, os.MkdirAll(localDir, 0755))
808
809 // Create a temporary directory to simulate the local extension update state
810 extensionUpdatePath := filepath.Join(updateDir, fakeExtensionName)
811 require.NoError(t, stubExtensionUpdate(extensionUpdatePath))
812
813 // Intentionally not creating an executable in the local extension repo
814 // to simulate an attempt to install a local extension without an executable
815
816 err := m.InstallLocal(localDir)
817 require.ErrorAs(t, err, new(*ErrExtensionExecutableNotFound))
818 assert.Equal(t, "", stdout.String())
819 assert.Equal(t, "", stderr.String())
820 require.NoDirExistsf(t, extensionUpdatePath, "update directory should be removed")
821}
822
823func TestManager_Install_git(t *testing.T) {
824 dataDir := t.TempDir()

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
newTestManagerFunction · 0.85
stubExtensionUpdateFunction · 0.85
JoinMethod · 0.80
EqualMethod · 0.80
InstallLocalMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected