aboutsummaryrefslogtreecommitdiffstats
path: root/services/issue/assignee_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 /services/issue/assignee_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 'services/issue/assignee_test.go')
-rw-r--r--services/issue/assignee_test.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/services/issue/assignee_test.go b/services/issue/assignee_test.go
index d3d7ad74f8..ff4d7029eb 100644
--- a/services/issue/assignee_test.go
+++ b/services/issue/assignee_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
@@ -20,21 +21,23 @@ func TestDeleteNotPassedAssignee(t *testing.T) {
// Fake issue with assignees
issue, err := models.GetIssueWithAttrsByID(1)
assert.NoError(t, err)
+ assert.EqualValues(t, 1, len(issue.Assignees))
user1, err := user_model.GetUserByID(1) // This user is already assigned (see the definition in fixtures), so running UpdateAssignee should unassign him
assert.NoError(t, err)
// Check if he got removed
- isAssigned, err := models.IsUserAssignedToIssue(issue, user1)
+ isAssigned, err := models.IsUserAssignedToIssue(db.DefaultContext, issue, user1)
assert.NoError(t, err)
assert.True(t, isAssigned)
// Clean everyone
err = DeleteNotPassedAssignee(issue, user1, []*user_model.User{})
assert.NoError(t, err)
+ assert.EqualValues(t, 0, len(issue.Assignees))
// Check they're gone
- assignees, err := models.GetAssigneesByIssue(issue)
- assert.NoError(t, err)
- assert.Empty(t, assignees)
+ assert.NoError(t, issue.LoadAssignees(db.DefaultContext))
+ assert.EqualValues(t, 0, len(issue.Assignees))
+ assert.Empty(t, issue.Assignee)
}