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

Function TestManager_Install_not_installable

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

Source from the content-addressed store, hash-verified

944}
945
946func TestManager_Install_not_installable(t *testing.T) {
947 dataDir := t.TempDir()
948 updateDir := t.TempDir()
949
950 reg := httpmock.Registry{}
951 defer reg.Verify(t)
952 client := http.Client{Transport: &reg}
953
954 ios, _, _, _ := iostreams.Test()
955
956 m := newTestManager(dataDir, updateDir, &client, nil, ios)
957
958 reg.Register(
959 httpmock.REST("GET", "repos/owner/gh-some-ext/releases/latest"),
960 httpmock.JSONResponse(
961 release{
962 Assets: []releaseAsset{
963 {
964 Name: "not-a-binary",
965 APIURL: "https://example.com/release/cool",
966 },
967 },
968 }))
969 reg.Register(
970 httpmock.REST("GET", "repos/owner/gh-some-ext/contents/gh-some-ext"),
971 httpmock.StatusStringResponse(404, "not found"))
972
973 repo := ghrepo.New("owner", "gh-some-ext")
974
975 err := m.Install(repo, "")
976 assert.EqualError(t, err, "extension is not installable: no usable release artifact or script found in owner/gh-some-ext")
977}
978
979func TestManager_Install_git_pinned(t *testing.T) {
980 dataDir := t.TempDir()

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
RegisterMethod · 0.95
TestFunction · 0.92
RESTFunction · 0.92
JSONResponseFunction · 0.92
StatusStringResponseFunction · 0.92
NewFunction · 0.92
newTestManagerFunction · 0.85
InstallMethod · 0.65

Tested by

no test coverage detected