diff options
author | 6543 <6543@obermui.de> | 2019-12-07 23:04:19 +0100 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-12-07 17:04:19 -0500 |
commit | 37e10d4543c1e516e1a721d72c0054fefceb9499 (patch) | |
tree | f824b014a135d3bcf243d5bb3e87cab3de225c90 /models/issue_reaction_test.go | |
parent | ee7df7ba8c5e6a4b32b0c4048d2b535d8df3cbe9 (diff) | |
download | gitea-37e10d4543c1e516e1a721d72c0054fefceb9499.tar.gz gitea-37e10d4543c1e516e1a721d72c0054fefceb9499.zip |
[API] Add Reactions (#9220)
* reject reactions wich ar not allowed
* dont duble check CreateReaction now throw ErrForbiddenIssueReaction
* add /repos/{owner}/{repo}/issues/comments/{id}/reactions endpoint
* add Find Functions
* fix some swagger stuff + add issue reaction endpoints + GET ReactionList now use FindReactions...
* explicite Issue Only Reaction for FindReactionsOptions with "-1" commentID
* load issue; load user ...
* return error again
* swagger def canged after LINT
* check if user has ben loaded
* add Tests
* better way of comparing results
* add suggestion
* use different issue for test
(dont interfear with integration test)
* test dont compare Location on timeCompare
* TEST: add forbidden dubble add
* add comments in code to explain
* add settings.UI.ReactionsMap
so if !setting.UI.ReactionsMap[opts.Type] works
Diffstat (limited to 'models/issue_reaction_test.go')
-rw-r--r-- | models/issue_reaction_test.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/models/issue_reaction_test.go b/models/issue_reaction_test.go index bbd8cf29fe..1189b389e9 100644 --- a/models/issue_reaction_test.go +++ b/models/issue_reaction_test.go @@ -81,22 +81,22 @@ func TestIssueReactionCount(t *testing.T) { user4 := AssertExistsAndLoadBean(t, &User{ID: 4}).(*User) ghost := NewGhostUser() - issue1 := AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue) + issue := AssertExistsAndLoadBean(t, &Issue{ID: 2}).(*Issue) - addReaction(t, user1, issue1, nil, "heart") - addReaction(t, user2, issue1, nil, "heart") - addReaction(t, user3, issue1, nil, "heart") - addReaction(t, user3, issue1, nil, "+1") - addReaction(t, user4, issue1, nil, "+1") - addReaction(t, user4, issue1, nil, "heart") - addReaction(t, ghost, issue1, nil, "-1") - - err := issue1.loadReactions(x) + addReaction(t, user1, issue, nil, "heart") + addReaction(t, user2, issue, nil, "heart") + addReaction(t, user3, issue, nil, "heart") + addReaction(t, user3, issue, nil, "+1") + addReaction(t, user4, issue, nil, "+1") + addReaction(t, user4, issue, nil, "heart") + addReaction(t, ghost, issue, nil, "-1") + + err := issue.loadReactions(x) assert.NoError(t, err) - assert.Len(t, issue1.Reactions, 7) + assert.Len(t, issue.Reactions, 7) - reactions := issue1.Reactions.GroupByType() + reactions := issue.Reactions.GroupByType() assert.Len(t, reactions["heart"], 4) assert.Equal(t, 2, reactions["heart"].GetMoreUserCount()) assert.Equal(t, user1.DisplayName()+", "+user2.DisplayName(), reactions["heart"].GetFirstUsers()) |