MCPcopy Create free account
hub / github.com/ericls/imgdd / TestUploadHandlerRejectsOversizedFile

Function TestUploadHandlerRejectsOversizedFile

httpserver/image_handlers_test.go:120–130  ·  view source on GitHub ↗

--- Global max ---

(t *testing.T)

Source from the content-addressed store, hash-verified

118// --- Global max ---
119
120func TestUploadHandlerRejectsOversizedFile(t *testing.T) {
121 pngBytes := makePNGBytes(10, 10)
122 conf := &HttpServerConfigDef{
123 AllowUpload: true,
124 ImageMaxUploadBytes: int64(len(pngBytes) - 1),
125 }
126 req := makeMultipartRequest(t, "image", "test.png", pngBytes)
127 res := httptest.NewRecorder()
128 makeUploadHandler(conf, guestIdentityManager(), nil, nil, nil).ServeHTTP(res, req)
129 assertFileTooLarge(t, res)
130}
131
132func TestUploadHandlerAcceptsFileWithinGlobalLimit(t *testing.T) {
133 pngBytes := makePNGBytes(10, 10)

Callers

nothing calls this directly

Calls 5

makePNGBytesFunction · 0.85
makeMultipartRequestFunction · 0.85
makeUploadHandlerFunction · 0.85
guestIdentityManagerFunction · 0.85
assertFileTooLargeFunction · 0.85

Tested by

no test coverage detected