diff options
author | 6543 <6543@obermui.de> | 2019-12-31 09:21:21 +0100 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-12-31 03:21:21 -0500 |
commit | 9600c27085df3f895b2128f1b77aa0ce0b57e7f2 (patch) | |
tree | 9dfbbf44126e7c39b77558ec943c8a2b9a717b10 /integrations | |
parent | 655aea13a5ad5dd51bcaafd1b96ecce2673f0312 (diff) | |
download | gitea-9600c27085df3f895b2128f1b77aa0ce0b57e7f2.tar.gz gitea-9600c27085df3f895b2128f1b77aa0ce0b57e7f2.zip |
[API] Fix 9544 | return 200 when reaction already exist (#9550)
* add ErrReactionAlreadyExist
* extend CreateReaction
* reaction already exist = 200
* extend FindReactionsOptions
* refactor swagger options/definitions
* fix swagger-validate
* Update models/error.go
Co-Authored-By: zeripath <art27@cantab.net>
* fix test PART1
* extend FindReactionsOptions with UserID option
* catch error on test
* fix test PART2
* format ...
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_issue_reaction_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/integrations/api_issue_reaction_test.go b/integrations/api_issue_reaction_test.go index c474f7bad2..1906b8d090 100644 --- a/integrations/api_issue_reaction_test.go +++ b/integrations/api_issue_reaction_test.go @@ -47,7 +47,7 @@ func TestAPIIssuesReactions(t *testing.T) { Reaction: "rocket", }) resp = session.MakeRequest(t, req, http.StatusCreated) - var apiNewReaction api.ReactionResponse + var apiNewReaction api.Reaction DecodeJSON(t, resp, &apiNewReaction) //Add existing reaction @@ -56,10 +56,10 @@ func TestAPIIssuesReactions(t *testing.T) { //Get end result of reaction list of issue #1 req = NewRequestf(t, "GET", urlStr) resp = session.MakeRequest(t, req, http.StatusOK) - var apiReactions []*api.ReactionResponse + var apiReactions []*api.Reaction DecodeJSON(t, resp, &apiReactions) - expectResponse := make(map[int]api.ReactionResponse) - expectResponse[0] = api.ReactionResponse{ + expectResponse := make(map[int]api.Reaction) + expectResponse[0] = api.Reaction{ User: user2.APIFormat(), Reaction: "eyes", Created: time.Unix(1573248003, 0), @@ -107,7 +107,7 @@ func TestAPICommentReactions(t *testing.T) { Reaction: "+1", }) resp = session.MakeRequest(t, req, http.StatusCreated) - var apiNewReaction api.ReactionResponse + var apiNewReaction api.Reaction DecodeJSON(t, resp, &apiNewReaction) //Add existing reaction @@ -116,15 +116,15 @@ func TestAPICommentReactions(t *testing.T) { //Get end result of reaction list of issue #1 req = NewRequestf(t, "GET", urlStr) resp = session.MakeRequest(t, req, http.StatusOK) - var apiReactions []*api.ReactionResponse + var apiReactions []*api.Reaction DecodeJSON(t, resp, &apiReactions) - expectResponse := make(map[int]api.ReactionResponse) - expectResponse[0] = api.ReactionResponse{ + expectResponse := make(map[int]api.Reaction) + expectResponse[0] = api.Reaction{ User: user2.APIFormat(), Reaction: "laugh", Created: time.Unix(1573248004, 0), } - expectResponse[1] = api.ReactionResponse{ + expectResponse[1] = api.Reaction{ User: user1.APIFormat(), Reaction: "laugh", Created: time.Unix(1573248005, 0), |