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

Function stubInstallFiles

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

stubInstallFiles registers subtree + blob stubs for installer.Install (one skill).

(reg *httpmock.Registry, owner, repo, treeSHA, blobSHA, content string)

Source from the content-addressed store, hash-verified

248
249// stubInstallFiles registers subtree + blob stubs for installer.Install (one skill).
250func stubInstallFiles(reg *httpmock.Registry, owner, repo, treeSHA, blobSHA, content string) {
251 encoded := base64.StdEncoding.EncodeToString([]byte(content))
252 reg.Register(
253 httpmock.REST("GET", fmt.Sprintf("repos/%s/%s/git/trees/%s", owner, repo, treeSHA)),
254 httpmock.StringResponse(fmt.Sprintf(`{"tree": [{"path": "SKILL.md", "type": "blob", "sha": %q, "size": 50}]}`, blobSHA)),
255 )
256 reg.Register(
257 httpmock.REST("GET", fmt.Sprintf("repos/%s/%s/git/blobs/%s", owner, repo, blobSHA)),
258 httpmock.StringResponse(fmt.Sprintf(`{"sha": %q, "content": %q, "encoding": "base64"}`, blobSHA, encoded)),
259 )
260}
261
262// stubSkillByPath registers stubs for DiscoverSkillByPath (contents API + tree).
263func stubSkillByPath(reg *httpmock.Registry, owner, repo, sha, skillPath, skillName, treeSHA string) {

Calls 3

RESTFunction · 0.92
StringResponseFunction · 0.92
RegisterMethod · 0.45

Tested by

no test coverage detected