make tests more robust when validating specific csrf token
This commit is contained in:
parent
7759e8f898
commit
1c5c0b9867
|
@ -131,7 +131,7 @@ func TestInviteConsumeInviteHTTP(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// get the corresponding token from the page
|
// 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())
|
a.Equal(1, csrfTokenElem.Length())
|
||||||
csrfName, has := csrfTokenElem.Attr("name")
|
csrfName, has := csrfTokenElem.Attr("name")
|
||||||
a.True(has, "should have a name attribute")
|
a.True(has, "should have a name attribute")
|
||||||
|
|
|
@ -92,7 +92,7 @@ func TestNoticesEditButtonVisible(t *testing.T) {
|
||||||
csrfCookie := resp.Result().Cookies()
|
csrfCookie := resp.Result().Cookies()
|
||||||
a.True(len(csrfCookie) > 0, "should have one cookie for CSRF protection validation")
|
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())
|
a.Equal(1, csrfTokenElem.Length())
|
||||||
|
|
||||||
csrfName, has := csrfTokenElem.Attr("name")
|
csrfName, has := csrfTokenElem.Attr("name")
|
||||||
|
|
Loading…
Reference in New Issue