MCPcopy
hub / github.com/moby/moby / errorMock

Function errorMock

client/client_mock_test.go:134–138  ·  view source on GitHub ↗
(statusCode int, message string)

Source from the content-addressed store, hash-verified

132}
133
134func errorMock(statusCode int, message string) func(req *http.Request) (*http.Response, error) {
135 return mockJSONResponse(statusCode, nil, common.ErrorResponse{
136 Message: message,
137 })
138}
139
140func mockJSONResponse[T any](statusCode int, headers http.Header, resp T) func(req *http.Request) (*http.Response, error) {
141 respBody, err := json.Marshal(&resp)

Callers 15

TestConfigUpdateErrorFunction · 0.85
TestNetworkConnectErrorFunction · 0.85
TestPluginPushErrorFunction · 0.85
TestImageInspectErrorFunction · 0.85
TestImageListErrorFunction · 0.85
TestCheckpointListErrorFunction · 0.85
TestServiceCreateErrorFunction · 0.85
TestTaskListErrorFunction · 0.85
TestExecCreateErrorFunction · 0.85

Calls 1

mockJSONResponseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…