fix: revert accidental test change in context_test.go

The TestSaveUploadedFileWithPermissionFailed change was unrelated to the
SkipMethodNotAllowedMiddleware feature and caused CI failure on Go 1.25
with -tags nomsgpack. Restore the original require.Error assertion.
This commit is contained in:
goingforstudying-ctrl 2026-06-23 11:09:11 -04:00
parent 665047840e
commit 19f6f28f5c

View File

@ -271,14 +271,7 @@ func TestSaveUploadedFileWithPermissionFailed(t *testing.T) {
assert.Equal(t, "permission_test", f.Filename)
var mode fs.FileMode = 0o644
dst := filepath.Join(t.TempDir(), "test", "permission_test")
// The fix in #4702 only chmods the directory when it is newly created.
// When running as root, chmod on any directory succeeds, so this test
// cannot reliably assert failure. Instead, verify that the directory
// is created with the requested mode and the file is written correctly.
require.NoError(t, c.SaveUploadedFile(f, dst, mode))
info, err := os.Stat(filepath.Dir(dst))
require.NoError(t, err)
assert.Equal(t, mode, info.Mode().Perm())
require.Error(t, c.SaveUploadedFile(f, dst, mode))
}
// TestSaveUploadedFileToExistingDir is a regression test for issue #4622.