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

Function TestManager_Install_binary_unsupported

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

Source from the content-addressed store, hash-verified

1090}
1091
1092func TestManager_Install_binary_unsupported(t *testing.T) {
1093 repo := ghrepo.NewWithHost("owner", "gh-bin-ext", "example.com")
1094
1095 reg := httpmock.Registry{}
1096 defer reg.Verify(t)
1097 client := http.Client{Transport: &reg}
1098
1099 reg.Register(
1100 httpmock.REST("GET", "api/v3/repos/owner/gh-bin-ext/releases/latest"),
1101 httpmock.JSONResponse(
1102 release{
1103 Assets: []releaseAsset{
1104 {
1105 Name: "gh-bin-ext-linux-amd64",
1106 APIURL: "https://example.com/release/cool",
1107 },
1108 },
1109 }))
1110 reg.Register(
1111 httpmock.REST("GET", "api/v3/repos/owner/gh-bin-ext/releases/latest"),
1112 httpmock.JSONResponse(
1113 release{
1114 Tag: "v1.0.1",
1115 Assets: []releaseAsset{
1116 {
1117 Name: "gh-bin-ext-linux-amd64",
1118 APIURL: "https://example.com/release/cool",
1119 },
1120 },
1121 }))
1122
1123 ios, _, stdout, stderr := iostreams.Test()
1124 dataDir := t.TempDir()
1125 updateDir := t.TempDir()
1126
1127 m := newTestManager(dataDir, updateDir, &client, nil, ios)
1128
1129 err := m.Install(repo, "")
1130 assert.EqualError(t, err, "gh-bin-ext unsupported for windows-amd64.\n\nTo request support for windows-amd64, open an issue on the extension's repo by running the following command:\n\n\t`gh issue create -R owner/gh-bin-ext --title \"Add support for the windows-amd64 architecture\" --body \"This extension does not support the windows-amd64 architecture. I tried to install it on a windows-amd64 machine, and it failed due to the lack of an available binary. Would you be able to update the extension's build and release process to include the relevant binary? For more details, see <https://docs.github.com/en/github-cli/github-cli/creating-github-cli-extensions>.\"`")
1131
1132 assert.Equal(t, "", stdout.String())
1133 assert.Equal(t, "", stderr.String())
1134}
1135
1136func TestManager_Install_rosetta_fallback_not_found(t *testing.T) {
1137 repo := ghrepo.NewWithHost("owner", "gh-bin-ext", "example.com")

Callers

nothing calls this directly

Calls 10

VerifyMethod · 0.95
RegisterMethod · 0.95
NewWithHostFunction · 0.92
RESTFunction · 0.92
JSONResponseFunction · 0.92
TestFunction · 0.92
newTestManagerFunction · 0.85
EqualMethod · 0.80
InstallMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected