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

Function stubResolveVersion

pkg/cmd/skills/install/install_test.go:218–227  ·  view source on GitHub ↗

--- HTTP stub helpers --- stubResolveVersion registers API stubs for latest release + tag resolution.

(reg *httpmock.Registry, owner, repo, tag, sha string)

Source from the content-addressed store, hash-verified

216
217// stubResolveVersion registers API stubs for latest release + tag resolution.
218func stubResolveVersion(reg *httpmock.Registry, owner, repo, tag, sha string) {
219 reg.Register(
220 httpmock.REST("GET", fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo)),
221 httpmock.StringResponse(fmt.Sprintf(`{"tag_name": %q}`, tag)),
222 )
223 reg.Register(
224 httpmock.REST("GET", fmt.Sprintf("repos/%s/%s/git/ref/tags%%2F%s", owner, repo, tag)),
225 httpmock.StringResponse(fmt.Sprintf(`{"object": {"sha": %q, "type": "commit"}}`, sha)),
226 )
227}
228
229// stubDiscoverTree registers the single recursive-tree call used by DiscoverSkills.
230func stubDiscoverTree(reg *httpmock.Registry, owner, repo, sha, treeJSON string) {

Calls 3

RESTFunction · 0.92
StringResponseFunction · 0.92
RegisterMethod · 0.45

Tested by

no test coverage detected