diff options
Diffstat (limited to 'models/issue_assignees_test.go')
-rw-r--r-- | models/issue_assignees_test.go | 11 |
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) } |