[API] Expose allowed Reactions (#11735)

* [API] Expose allowed Reactions

* dont be in soutch a rush

* add TEST

* use ElementsMatch

Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
6543 2020-06-04 11:16:53 +02:00 committed by GitHub
parent 2842f6cf42
commit b534a5164f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 0 deletions

View file

@ -11,11 +11,27 @@ import (
"time"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"github.com/stretchr/testify/assert"
)
func TestAPIAllowedReactions(t *testing.T) {
defer prepareTestEnv(t)()
type allowed []string
a := new(allowed)
req := NewRequest(t, "GET", "/api/v1/settings/allowed_reactions")
resp := MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, resp, &a)
assert.Len(t, *a, len(setting.UI.Reactions))
assert.ElementsMatch(t, setting.UI.Reactions, *a)
}
func TestAPIIssuesReactions(t *testing.T) {
defer prepareTestEnv(t)()