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

Function StubUpload

internal/attachments/test.go:47–49  ·  view source on GitHub ↗

StubUpload registers one upload of name against repositoryID, answering with status and body. It matches on the query the upload carries, so a request that names the wrong repository or the wrong file matches nothing and the test fails.

(reg *httpmock.Registry, repositoryID int64, name string, status int, body string)

Source from the content-addressed store, hash-verified

45// It matches on the query the upload carries, so a request that names the wrong
46// repository or the wrong file matches nothing and the test fails.
47func StubUpload(reg *httpmock.Registry, repositoryID int64, name string, status int, body string) {
48 reg.Register(uploadMatcher(repositoryID, name), httpmock.StatusStringResponse(status, body))
49}
50
51// StubUploadToHost is StubUpload plus the host the request reached. The
52// matchers compare the path only, so the host is asserted in the responder or

Callers 4

Test_createRunFunction · 0.92
Test_createRunFunction · 0.92
Test_editRunFunction · 0.92

Calls 3

StatusStringResponseFunction · 0.92
uploadMatcherFunction · 0.85
RegisterMethod · 0.45

Tested by 4

Test_createRunFunction · 0.74
Test_createRunFunction · 0.74
Test_editRunFunction · 0.74