mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-04 14:46:57 -05:00
Improve wiki user title test (#24559)
The `..` should be covered by TestUserTitleToWebPath. Otherwise, if the random string is "..", it causes unnecessary failure in TestUserWebGitPathConsistency
This commit is contained in:
parent
bc888e5f92
commit
db582d97ef
@ -34,6 +34,9 @@ func TestUserTitleToWebPath(t *testing.T) {
|
|||||||
UserTitle string
|
UserTitle string
|
||||||
}
|
}
|
||||||
for _, test := range []test{
|
for _, test := range []test{
|
||||||
|
{"unnamed", ""},
|
||||||
|
{"unnamed", "."},
|
||||||
|
{"unnamed", ".."},
|
||||||
{"wiki-name", "wiki name"},
|
{"wiki-name", "wiki name"},
|
||||||
{"title.md.-", "title.md"},
|
{"title.md.-", "title.md"},
|
||||||
{"wiki-name.-", "wiki-name"},
|
{"wiki-name.-", "wiki-name"},
|
||||||
@ -118,7 +121,7 @@ func TestUserWebGitPathConsistency(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userTitle := strings.TrimSpace(string(b[:l]))
|
userTitle := strings.TrimSpace(string(b[:l]))
|
||||||
if userTitle == "" || userTitle == "." {
|
if userTitle == "" || userTitle == "." || userTitle == ".." {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
webPath := UserTitleToWebPath("", userTitle)
|
webPath := UserTitleToWebPath("", userTitle)
|
||||||
|
Loading…
Reference in New Issue
Block a user