summaryrefslogtreecommitdiffstats
path: root/tests/integration/api_feed_plain_text_titles_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/api_feed_plain_text_titles_test.go')
-rw-r--r--tests/integration/api_feed_plain_text_titles_test.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/integration/api_feed_plain_text_titles_test.go b/tests/integration/api_feed_plain_text_titles_test.go
new file mode 100644
index 0000000..b124778
--- /dev/null
+++ b/tests/integration/api_feed_plain_text_titles_test.go
@@ -0,0 +1,43 @@
+// Copyright 2023 The Forgejo Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package integration
+
+import (
+ "net/http"
+ "testing"
+
+ "code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/test"
+ "code.gitea.io/gitea/tests"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestFeedPlainTextTitles(t *testing.T) {
+ // This test verifies that items' titles in feeds are generated as plain text.
+ // See https://codeberg.org/forgejo/forgejo/pulls/1595
+ defer test.MockVariableValue(&setting.UI.DefaultShowFullName, true)()
+
+ t.Run("Feed plain text titles", func(t *testing.T) {
+ t.Run("Atom", func(t *testing.T) {
+ defer tests.PrepareTestEnv(t)()
+
+ req := NewRequest(t, "GET", "/user2/repo1.atom")
+ resp := MakeRequest(t, req, http.StatusOK)
+
+ data := resp.Body.String()
+ assert.Contains(t, data, "<title>the_1-user.with.all.allowedChars closed issue user2/repo1#4</title>")
+ })
+
+ t.Run("RSS", func(t *testing.T) {
+ defer tests.PrepareTestEnv(t)()
+
+ req := NewRequest(t, "GET", "/user2/repo1.rss")
+ resp := MakeRequest(t, req, http.StatusOK)
+
+ data := resp.Body.String()
+ assert.Contains(t, data, "<title>the_1-user.with.all.allowedChars closed issue user2/repo1#4</title>")
+ })
+ })
+}