diff options
Diffstat (limited to 'tests/integration/integration_test.go')
-rw-r--r-- | tests/integration/integration_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/integration/integration_test.go b/tests/integration/integration_test.go index f9bd352b62..18f415083c 100644 --- a/tests/integration/integration_test.go +++ b/tests/integration/integration_test.go @@ -485,6 +485,7 @@ func VerifyJSONSchema(t testing.TB, resp *httptest.ResponseRecorder, schemaFile assert.True(t, result.Valid()) } +// GetCSRF returns CSRF token from body func GetCSRF(t testing.TB, session *TestSession, urlStr string) string { t.Helper() req := NewRequest(t, "GET", urlStr) @@ -492,3 +493,11 @@ func GetCSRF(t testing.TB, session *TestSession, urlStr string) string { doc := NewHTMLParser(t, resp.Body) return doc.GetCSRF() } + +// GetCSRFFrom returns CSRF token from body +func GetCSRFFromCookie(t testing.TB, session *TestSession, urlStr string) string { + t.Helper() + req := NewRequest(t, "GET", urlStr) + session.MakeRequest(t, req, http.StatusOK) + return session.GetCookie("_csrf").Value +} |