summaryrefslogtreecommitdiffstats
path: root/models/issue_test.go
diff options
context:
space:
mode:
authorSandro Santilli <strk@kbt.io>2017-03-16 02:34:24 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2017-03-16 09:34:24 +0800
commit447c9b428f4cf50174ef7f3fbea56b5405f6bbf8 (patch)
tree9188395769273bd286e73ee940311216fce58073 /models/issue_test.go
parentca1c3f1926eff992a2458f26cb24ed2f35265b05 (diff)
downloadgitea-447c9b428f4cf50174ef7f3fbea56b5405f6bbf8.tar.gz
gitea-447c9b428f4cf50174ef7f3fbea56b5405f6bbf8.zip
Send notifications to partecipants in issue comments (#1217)
* Send notifications to partecipants in issue comments Closes #1216 Includes test (still failing) * Do not include "labelers" to participants Fix test to expect what GetParticipants return
Diffstat (limited to 'models/issue_test.go')
-rw-r--r--models/issue_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/models/issue_test.go b/models/issue_test.go
index 7c80258c2b..52724d07d4 100644
--- a/models/issue_test.go
+++ b/models/issue_test.go
@@ -5,6 +5,7 @@
package models
import (
+ "sort"
"testing"
"github.com/stretchr/testify/assert"
@@ -58,3 +59,26 @@ func TestGetIssuesByIDs(t *testing.T) {
testSuccess([]int64{1, 2, 3}, []int64{})
testSuccess([]int64{1, 2, 3}, []int64{NonexistentID})
}
+
+func TestGetParticipantsByIssueID(t *testing.T) {
+
+ assert.NoError(t, PrepareTestDatabase())
+
+ checkPartecipants := func(issueID int64, userIDs []int) {
+ partecipants, err := GetParticipantsByIssueID(issueID)
+ if assert.NoError(t, err) {
+ partecipantsIDs := make([]int,len(partecipants))
+ for i,u := range partecipants { partecipantsIDs[i] = int(u.ID) }
+ sort.Ints(partecipantsIDs)
+ sort.Ints(userIDs)
+ assert.Equal(t, userIDs, partecipantsIDs)
+ }
+
+ }
+
+ // User 1 is issue1 poster (see fixtures/issue.yml)
+ // User 2 only labeled issue1 (see fixtures/comment.yml)
+ // Users 3 and 5 made actual comments (see fixtures/comment.yml)
+ checkPartecipants(1, []int{3,5})
+
+}