mirror of
https://github.com/go-gitea/gitea
synced 2025-07-16 07:18:37 +00:00
Use test context in tests and new loop system in benchmarks (#33648)
Replace all contexts in tests with go1.24 t.Context() --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
package markup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
@@ -32,10 +31,10 @@ func TestRenderHelperMention(t *testing.T) {
|
||||
unittest.AssertCount(t, &user.User{Name: userNoSuch}, 0)
|
||||
|
||||
// when using general context, use user's visibility to check
|
||||
assert.True(t, FormalRenderHelperFuncs().IsUsernameMentionable(context.Background(), userPublic))
|
||||
assert.False(t, FormalRenderHelperFuncs().IsUsernameMentionable(context.Background(), userLimited))
|
||||
assert.False(t, FormalRenderHelperFuncs().IsUsernameMentionable(context.Background(), userPrivate))
|
||||
assert.False(t, FormalRenderHelperFuncs().IsUsernameMentionable(context.Background(), userNoSuch))
|
||||
assert.True(t, FormalRenderHelperFuncs().IsUsernameMentionable(t.Context(), userPublic))
|
||||
assert.False(t, FormalRenderHelperFuncs().IsUsernameMentionable(t.Context(), userLimited))
|
||||
assert.False(t, FormalRenderHelperFuncs().IsUsernameMentionable(t.Context(), userPrivate))
|
||||
assert.False(t, FormalRenderHelperFuncs().IsUsernameMentionable(t.Context(), userNoSuch))
|
||||
|
||||
// when using web context, use user.IsUserVisibleToViewer to check
|
||||
req, err := http.NewRequest("GET", "/", nil)
|
||||
|
Reference in New Issue
Block a user