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)
| 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. |
| 47 | func 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 |