1
0
Fork 0
mirror of https://github.com/Luzifer/nginx-sso.git synced 2024-12-21 05:11:17 +00:00
nginx-sso/vendor/github.com/gorilla/sessions/cookie_go111_test.go
Knut Ahlers 9b3c895c04
Update dependencies
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2019-04-22 06:44:07 +02:00

29 lines
614 B
Go

// +build go1.11
package sessions
import (
"net/http"
"testing"
)
// Test for setting SameSite field in new http.Cookie from name, value
// and options
func TestNewCookieFromOptionsSameSite(t *testing.T) {
tests := []struct {
sameSite http.SameSite
}{
{http.SameSiteDefaultMode},
{http.SameSiteLaxMode},
{http.SameSiteStrictMode},
}
for i, v := range tests {
options := &Options{
SameSite: v.sameSite,
}
cookie := newCookieFromOptions("", "", options)
if cookie.SameSite != v.sameSite {
t.Fatalf("%v: bad cookie sameSite: got %v, want %v", i+1, cookie.SameSite, v.sameSite)
}
}
}