(t *testing.T)
| 960 | } |
| 961 | |
| 962 | func TestProcessCookieRefreshNotSet(t *testing.T) { |
| 963 | pcTest, err := NewProcessCookieTestWithOptionsModifiers(func(opts *options.Options) { |
| 964 | opts.Cookie.Expire = time.Duration(23) * time.Hour |
| 965 | }) |
| 966 | if err != nil { |
| 967 | t.Fatal(err) |
| 968 | } |
| 969 | |
| 970 | reference := time.Now().Add(time.Duration(-2) * time.Hour) |
| 971 | |
| 972 | startSession := &sessions.SessionState{Email: "michael.bland@gsa.gov", AccessToken: "my_access_token", CreatedAt: &reference} |
| 973 | err = pcTest.SaveSession(startSession) |
| 974 | assert.NoError(t, err) |
| 975 | |
| 976 | session, err := pcTest.LoadCookiedSession() |
| 977 | assert.Equal(t, nil, err) |
| 978 | if session.Age() < time.Duration(-2)*time.Hour { |
| 979 | t.Errorf("cookie too young %v", session.Age()) |
| 980 | } |
| 981 | assert.Equal(t, startSession.Email, session.Email) |
| 982 | } |
| 983 | |
| 984 | func TestProcessCookieFailIfCookieExpired(t *testing.T) { |
| 985 | pcTest, err := NewProcessCookieTestWithOptionsModifiers(func(opts *options.Options) { |
nothing calls this directly
no test coverage detected