mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Make wiki pages visit fast (#32732)
This commit is contained in:
@@ -6,15 +6,18 @@ package integration
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -50,3 +53,23 @@ func TestRepoCloneWiki(t *testing.T) {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func Test_RepoWikiPages(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
url := "/user2/repo1/wiki/?action=_pages"
|
||||
req := NewRequest(t, "GET", url)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
doc := NewHTMLParser(t, resp.Body)
|
||||
expectedPagePaths := []string{
|
||||
"Home", "Page-With-Image", "Page-With-Spaced-Name", "Unescaped-File",
|
||||
}
|
||||
doc.Find("tr").Each(func(i int, s *goquery.Selection) {
|
||||
firstAnchor := s.Find("a").First()
|
||||
href, _ := firstAnchor.Attr("href")
|
||||
pagePath := strings.TrimPrefix(href, "/user2/repo1/wiki/")
|
||||
|
||||
assert.EqualValues(t, expectedPagePaths[i], pagePath)
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user