Tranfser all cookies in tests

This commit is contained in:
Joel Speed 2019-05-16 17:13:14 +01:00 committed by Brian Van Klaveren
parent 93df7d9132
commit a7693cc72a

View File

@ -115,8 +115,9 @@ var _ = Describe("NewSessionStore", func() {
err := ss.Save(saveResp, req, session)
Expect(err).ToNot(HaveOccurred())
resultCookie := saveResp.Result().Cookies()[0]
request.AddCookie(resultCookie)
for _, c := range saveResp.Result().Cookies() {
request.AddCookie(c)
}
err = ss.Clear(response, request)
Expect(err).ToNot(HaveOccurred())
})
@ -177,14 +178,18 @@ var _ = Describe("NewSessionStore", func() {
err := ss.Save(saveResp, req, session)
Expect(err).ToNot(HaveOccurred())
resultCookie := saveResp.Result().Cookies()[0]
request.AddCookie(resultCookie)
resultCookies := saveResp.Result().Cookies()
for _, c := range resultCookies {
request.AddCookie(c)
}
err = ss.Clear(response, request)
Expect(err).ToNot(HaveOccurred())
// The following should only be for server stores
loadReq := httptest.NewRequest("GET", "http://example.com/", nil)
loadReq.AddCookie(resultCookie)
for _, c := range resultCookies {
loadReq.AddCookie(c)
}
loadedAfterClear, err = ss.Load(loadReq)
})