MCPcopy Index your code
hub / github.com/cli/cli / stubTreeAndBlob

Function stubTreeAndBlob

internal/skills/installer/installer_test.go:316–331  ·  view source on GitHub ↗
(reg *httpmock.Registry, treeSHA string)

Source from the content-addressed store, hash-verified

314}
315
316func stubTreeAndBlob(reg *httpmock.Registry, treeSHA string) {
317 reg.Register(
318 httpmock.REST("GET", fmt.Sprintf("repos/monalisa/octocat-skills/git/trees/%s", treeSHA)),
319 httpmock.JSONResponse(map[string]interface{}{
320 "sha": treeSHA, "truncated": false,
321 "tree": []map[string]interface{}{
322 {"path": "SKILL.md", "type": "blob", "sha": treeSHA + "-blob", "size": 10},
323 },
324 }))
325 reg.Register(
326 httpmock.REST("GET", fmt.Sprintf("repos/monalisa/octocat-skills/git/blobs/%s-blob", treeSHA)),
327 httpmock.JSONResponse(map[string]interface{}{
328 "sha": treeSHA + "-blob", "encoding": "base64",
329 "content": base64.StdEncoding.EncodeToString([]byte("# Skill")),
330 }))
331}
332
333func TestInstall(t *testing.T) {
334 var progressCount atomic.Int32

Callers 1

TestInstallFunction · 0.85

Calls 3

RESTFunction · 0.92
JSONResponseFunction · 0.92
RegisterMethod · 0.45

Tested by

no test coverage detected