MCPcopy
hub / github.com/cli/cli / TestManager_Install_not_installable

Function TestManager_Install_not_installable

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

Source from the content-addressed store, hash-verified

868}
869
870func TestManager_Install_not_installable(t *testing.T) {
871 dataDir := t.TempDir()
872 updateDir := t.TempDir()
873
874 reg := httpmock.Registry{}
875 defer reg.Verify(t)
876 client := http.Client{Transport: &reg}
877
878 ios, _, _, _ := iostreams.Test()
879
880 m := newTestManager(dataDir, updateDir, &client, nil, ios)
881
882 reg.Register(
883 httpmock.REST("GET", "repos/owner/gh-some-ext/releases/latest"),
884 httpmock.JSONResponse(
885 release{
886 Assets: []releaseAsset{
887 {
888 Name: "not-a-binary",
889 APIURL: "https://example.com/release/cool",
890 },
891 },
892 }))
893 reg.Register(
894 httpmock.REST("GET", "repos/owner/gh-some-ext/contents/gh-some-ext"),
895 httpmock.StatusStringResponse(404, "not found"))
896
897 repo := ghrepo.New("owner", "gh-some-ext")
898
899 err := m.Install(repo, "")
900 assert.EqualError(t, err, "extension is not installable: no usable release artifact or script found in owner/gh-some-ext")
901}
902
903func TestManager_Install_git_pinned(t *testing.T) {
904 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