MCPcopy
hub / github.com/cli/cli / TestManager_Install_binary_unsupported

Function TestManager_Install_binary_unsupported

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

Source from the content-addressed store, hash-verified

1014}
1015
1016func TestManager_Install_binary_unsupported(t *testing.T) {
1017 repo := ghrepo.NewWithHost("owner", "gh-bin-ext", "example.com")
1018
1019 reg := httpmock.Registry{}
1020 defer reg.Verify(t)
1021 client := http.Client{Transport: &reg}
1022
1023 reg.Register(
1024 httpmock.REST("GET", "api/v3/repos/owner/gh-bin-ext/releases/latest"),
1025 httpmock.JSONResponse(
1026 release{
1027 Assets: []releaseAsset{
1028 {
1029 Name: "gh-bin-ext-linux-amd64",
1030 APIURL: "https://example.com/release/cool",
1031 },
1032 },
1033 }))
1034 reg.Register(
1035 httpmock.REST("GET", "api/v3/repos/owner/gh-bin-ext/releases/latest"),
1036 httpmock.JSONResponse(
1037 release{
1038 Tag: "v1.0.1",
1039 Assets: []releaseAsset{
1040 {
1041 Name: "gh-bin-ext-linux-amd64",
1042 APIURL: "https://example.com/release/cool",
1043 },
1044 },
1045 }))
1046
1047 ios, _, stdout, stderr := iostreams.Test()
1048 dataDir := t.TempDir()
1049 updateDir := t.TempDir()
1050
1051 m := newTestManager(dataDir, updateDir, &client, nil, ios)
1052
1053 err := m.Install(repo, "")
1054 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>.\"`")
1055
1056 assert.Equal(t, "", stdout.String())
1057 assert.Equal(t, "", stderr.String())
1058}
1059
1060func TestManager_Install_rosetta_fallback_not_found(t *testing.T) {
1061 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.45

Tested by

no test coverage detected