stubInstallFiles registers subtree + blob stubs for installer.Install (one skill).
(reg *httpmock.Registry, owner, repo, treeSHA, blobSHA, content string)
| 235 | |
| 236 | // stubInstallFiles registers subtree + blob stubs for installer.Install (one skill). |
| 237 | func stubInstallFiles(reg *httpmock.Registry, owner, repo, treeSHA, blobSHA, content string) { |
| 238 | encoded := base64.StdEncoding.EncodeToString([]byte(content)) |
| 239 | reg.Register( |
| 240 | httpmock.REST("GET", fmt.Sprintf("repos/%s/%s/git/trees/%s", owner, repo, treeSHA)), |
| 241 | httpmock.StringResponse(fmt.Sprintf(`{"tree": [{"path": "SKILL.md", "type": "blob", "sha": %q, "size": 50}]}`, blobSHA)), |
| 242 | ) |
| 243 | reg.Register( |
| 244 | httpmock.REST("GET", fmt.Sprintf("repos/%s/%s/git/blobs/%s", owner, repo, blobSHA)), |
| 245 | httpmock.StringResponse(fmt.Sprintf(`{"sha": %q, "content": %q, "encoding": "base64"}`, blobSHA, encoded)), |
| 246 | ) |
| 247 | } |
| 248 | |
| 249 | // stubSkillByPath registers stubs for DiscoverSkillByPath (contents API + tree). |
| 250 | func stubSkillByPath(reg *httpmock.Registry, owner, repo, sha, skillPath, skillName, treeSHA string) { |
no test coverage detected