make tests more robust when validating specific csrf token

This commit is contained in:
cblgh 2021-04-19 16:03:12 +02:00
parent 7759e8f898
commit 1c5c0b9867
2 changed files with 2 additions and 2 deletions

View File

@ -131,7 +131,7 @@ func TestInviteConsumeInviteHTTP(t *testing.T) {
})
// get the corresponding token from the page
csrfTokenElem := doc.Find("input[name='gorilla.csrf.Token']")
csrfTokenElem := doc.Find(`form[action="/invite/consume"] input[name="gorilla.csrf.Token"]`)
a.Equal(1, csrfTokenElem.Length())
csrfName, has := csrfTokenElem.Attr("name")
a.True(has, "should have a name attribute")

View File

@ -92,7 +92,7 @@ func TestNoticesEditButtonVisible(t *testing.T) {
csrfCookie := resp.Result().Cookies()
a.True(len(csrfCookie) > 0, "should have one cookie for CSRF protection validation")
csrfTokenElem := doc.Find("input[type=hidden]")
csrfTokenElem := doc.Find(`form[action="/fallback/finalize"] input[type="hidden"]`)
a.Equal(1, csrfTokenElem.Length())
csrfName, has := csrfTokenElem.Attr("name")