summaryrefslogtreecommitdiffstats
path: root/tests/integration/user_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-03-13 14:57:30 +0800
committerGitHub <noreply@github.com>2024-03-13 06:57:30 +0000
commit67e9f0d49828f62a942ac6db04153207f88e82ee (patch)
treea2d7871a69039d3a32467d914933c695df87828e /tests/integration/user_test.go
parent9a93b1816e0bc65101e7ad7ca66786fb38a8e628 (diff)
downloadgitea-67e9f0d49828f62a942ac6db04153207f88e82ee.tar.gz
gitea-67e9f0d49828f62a942ac6db04153207f88e82ee.zip
Fix user router possbile panic (#29751)
regression from #28023
Diffstat (limited to 'tests/integration/user_test.go')
-rw-r--r--tests/integration/user_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/integration/user_test.go b/tests/integration/user_test.go
index c30733b1b0..c4544f37aa 100644
--- a/tests/integration/user_test.go
+++ b/tests/integration/user_test.go
@@ -243,6 +243,8 @@ func testExportUserGPGKeys(t *testing.T, user, expected string) {
}
func TestGetUserRss(t *testing.T) {
+ defer tests.PrepareTestEnv(t)()
+
user34 := "the_34-user.with.all.allowedChars"
req := NewRequestf(t, "GET", "/%s.rss", user34)
resp := MakeRequest(t, req, http.StatusOK)
@@ -253,6 +255,13 @@ func TestGetUserRss(t *testing.T) {
description, _ := rssDoc.ChildrenFiltered("description").Html()
assert.EqualValues(t, "&lt;p dir=&#34;auto&#34;&gt;some &lt;a href=&#34;https://commonmark.org/&#34; rel=&#34;nofollow&#34;&gt;commonmark&lt;/a&gt;!&lt;/p&gt;\n", description)
}
+
+ req = NewRequestf(t, "GET", "/non-existent-user.rss")
+ MakeRequest(t, req, http.StatusNotFound)
+
+ session := loginUser(t, "user2")
+ req = NewRequestf(t, "GET", "/non-existent-user.rss")
+ session.MakeRequest(t, req, http.StatusNotFound)
}
func TestListStopWatches(t *testing.T) {