aboutsummaryrefslogtreecommitdiffstats
path: root/services/issue/assignee_test.go
diff options
context:
space:
mode:
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)
}