summaryrefslogtreecommitdiffstats
path: root/integrations/issue_test.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2019-12-01 23:57:24 +0100
committertechknowlogick <techknowlogick@gitea.io>2019-12-01 17:57:24 -0500
commit668eaf95d581f68507523563d0701000a4505055 (patch)
tree4a0bf0aea58ca92f7fde2af0881dd518861512cd /integrations/issue_test.go
parent674bc772fb213e2b79478438d16835d387865ac3 (diff)
downloadgitea-668eaf95d581f68507523563d0701000a4505055.tar.gz
gitea-668eaf95d581f68507523563d0701000a4505055.zip
[Feature] Custom Reactions (#8886)
* add [ui] Reactions * move contend check from form to go functions * use else if * check if reaction is allowed only on react (so previous custom reaction can be still removed) * use $.AllowedReactions in templates * use ctx.Flash.Error * use it there too * add redirection * back to server error because a wrong reaction is a template issue ... * add emoji list link * add docs entry * small wording nit suggestions from @jolheiser - thx * same reactions as github * fix PR reactions * handle error so template JS could check * Add Integrations Test * add REACTIONS setting to cheat-sheet doc page
Diffstat (limited to 'integrations/issue_test.go')
-rw-r--r--integrations/issue_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/integrations/issue_test.go b/integrations/issue_test.go
index 5a4b75b751..d46e35a946 100644
--- a/integrations/issue_test.go
+++ b/integrations/issue_test.go
@@ -194,6 +194,32 @@ func TestIssueCommentClose(t *testing.T) {
assert.Equal(t, "Description", val)
}
+func TestIssueReaction(t *testing.T) {
+ defer prepareTestEnv(t)()
+ session := loginUser(t, "user2")
+ issueURL := testNewIssue(t, session, "user2", "repo1", "Title", "Description")
+
+ req := NewRequest(t, "GET", issueURL)
+ resp := session.MakeRequest(t, req, http.StatusOK)
+ htmlDoc := NewHTMLParser(t, resp.Body)
+
+ req = NewRequestWithValues(t, "POST", path.Join(issueURL, "/reactions/react"), map[string]string{
+ "_csrf": htmlDoc.GetCSRF(),
+ "content": "8ball",
+ })
+ session.MakeRequest(t, req, http.StatusInternalServerError)
+ req = NewRequestWithValues(t, "POST", path.Join(issueURL, "/reactions/react"), map[string]string{
+ "_csrf": htmlDoc.GetCSRF(),
+ "content": "eyes",
+ })
+ session.MakeRequest(t, req, http.StatusOK)
+ req = NewRequestWithValues(t, "POST", path.Join(issueURL, "/reactions/unreact"), map[string]string{
+ "_csrf": htmlDoc.GetCSRF(),
+ "content": "eyes",
+ })
+ session.MakeRequest(t, req, http.StatusOK)
+}
+
func TestIssueCrossReference(t *testing.T) {
defer prepareTestEnv(t)()