fix: use require.Error instead of assert.Error for error assertions

This commit is contained in:
kolaente 2026-03-20 12:12:16 +01:00 committed by kolaente
parent 4b91e5efa1
commit b7a1408098
2 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import (
bgHandler "code.vikunja.io/api/pkg/modules/background/handler"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestProjectBackgroundDeletePermission(t *testing.T) {
@ -41,7 +42,7 @@ func TestProjectBackgroundDeletePermission(t *testing.T) {
)
// Should be forbidden for a read-only user
assert.Error(t, err)
require.Error(t, err)
assert.Equal(t, http.StatusForbidden, getHTTPErrorCode(err))
})
}

View File

@ -330,7 +330,7 @@ func TestTaskCommentIDOR(t *testing.T) {
"task": "1", // task accessible to testuser1
"commentid": "18", // comment belonging to task 34, NOT accessible to testuser1
})
assert.Error(t, err)
require.Error(t, err)
assertHandlerErrorCode(t, err, models.ErrCodeTaskCommentDoesNotExist)
})
}