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