mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 14:53:34 +01:00
Add integration test
This commit is contained in:
parent
3fab07e0bc
commit
68cc61b537
1 changed files with 26 additions and 10 deletions
|
@ -1106,18 +1106,34 @@ func TestCommitRefComment(t *testing.T) {
|
||||||
func TestIssueFilterNoFollow(t *testing.T) {
|
func TestIssueFilterNoFollow(t *testing.T) {
|
||||||
defer tests.PrepareTestEnv(t)()
|
defer tests.PrepareTestEnv(t)()
|
||||||
|
|
||||||
|
// Check that every link in the filter list has rel="nofollow".
|
||||||
|
t.Run("Issue lists", func(t *testing.T) {
|
||||||
req := NewRequest(t, "GET", "/user2/repo1/issues")
|
req := NewRequest(t, "GET", "/user2/repo1/issues")
|
||||||
resp := MakeRequest(t, req, http.StatusOK)
|
resp := MakeRequest(t, req, http.StatusOK)
|
||||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
|
|
||||||
// Check that every link in the filter list has rel="nofollow".
|
filterLinks := htmlDoc.Find(".issue-list-toolbar-right a[href*=\"?q=\"], .labels-list a[href*=\"?q=\"]")
|
||||||
filterLinks := htmlDoc.Find(".issue-list-toolbar-right a[href*=\"?q=\"]")
|
|
||||||
assert.Positive(t, filterLinks.Length())
|
assert.Positive(t, filterLinks.Length())
|
||||||
filterLinks.Each(func(i int, link *goquery.Selection) {
|
filterLinks.Each(func(i int, link *goquery.Selection) {
|
||||||
rel, has := link.Attr("rel")
|
rel, has := link.Attr("rel")
|
||||||
assert.True(t, has)
|
assert.True(t, has)
|
||||||
assert.Equal(t, "nofollow", rel)
|
assert.Equal(t, "nofollow", rel)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("Issue page", func(t *testing.T) {
|
||||||
|
req := NewRequest(t, "GET", "/user2/repo1/issues/1")
|
||||||
|
resp := MakeRequest(t, req, http.StatusOK)
|
||||||
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
|
|
||||||
|
filterLinks := htmlDoc.Find(".timeline .labels-list a[href*=\"?labels=\"], .issue-content-right .labels-list a[href*=\"?labels=\"]")
|
||||||
|
assert.Positive(t, filterLinks.Length())
|
||||||
|
filterLinks.Each(func(i int, link *goquery.Selection) {
|
||||||
|
rel, has := link.Attr("rel")
|
||||||
|
assert.True(t, has)
|
||||||
|
assert.Equal(t, "nofollow", rel)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIssueForm(t *testing.T) {
|
func TestIssueForm(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue