stubInstallFiles registers subtree + blob stubs for installer.Install (one skill).
(reg *httpmock.Registry, owner, repo, treeSHA, blobSHA, content string)
| 248 | |
| 249 | // stubInstallFiles registers subtree + blob stubs for installer.Install (one skill). |
| 250 | func 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). |
| 263 | func stubSkillByPath(reg *httpmock.Registry, owner, repo, sha, skillPath, skillName, treeSHA string) { |
no test coverage detected