summaryrefslogtreecommitdiffstats
path: root/models/issue_assignees_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-05-20 22:08:52 +0800
committerGitHub <noreply@github.com>2022-05-20 22:08:52 +0800
commitfd7d83ace60258acf7139c4c787aa8af75b7ba8c (patch)
tree50038348ec10485f72344f3ac80324e04abc1283 /models/issue_assignees_test.go
parentd81e31ad7826a81fc7139f329f250594610a274b (diff)
downloadgitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.tar.gz
gitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.zip
Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context * remove some unnecessary wrap functions
Diffstat (limited to 'models/issue_assignees_test.go')
-rw-r--r--models/issue_assignees_test.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/models/issue_assignees_test.go b/models/issue_assignees_test.go
index 41a3ad86e3..80317e1604 100644
--- a/models/issue_assignees_test.go
+++ b/models/issue_assignees_test.go
@@ -7,6 +7,7 @@ package models
import (
"testing"
+ "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
@@ -37,28 +38,28 @@ func TestUpdateAssignee(t *testing.T) {
assert.NoError(t, err)
// Check if he got removed
- isAssigned, err := IsUserAssignedToIssue(issue, user1)
+ isAssigned, err := IsUserAssignedToIssue(db.DefaultContext, issue, user1)
assert.NoError(t, err)
assert.False(t, isAssigned)
// Check if they're all there
- assignees, err := GetAssigneesByIssue(issue)
+ err = issue.LoadAssignees(db.DefaultContext)
assert.NoError(t, err)
var expectedAssignees []*user_model.User
expectedAssignees = append(expectedAssignees, user2, user3)
- for in, assignee := range assignees {
+ for in, assignee := range issue.Assignees {
assert.Equal(t, assignee.ID, expectedAssignees[in].ID)
}
// Check if the user is assigned
- isAssigned, err = IsUserAssignedToIssue(issue, user2)
+ isAssigned, err = IsUserAssignedToIssue(db.DefaultContext, issue, user2)
assert.NoError(t, err)
assert.True(t, isAssigned)
// This user should not be assigned
- isAssigned, err = IsUserAssignedToIssue(issue, &user_model.User{ID: 4})
+ isAssigned, err = IsUserAssignedToIssue(db.DefaultContext, issue, &user_model.User{ID: 4})
assert.NoError(t, err)
assert.False(t, isAssigned)
}