mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-01-22 05:19:26 +02:00
f7b28cb1d3
* Drop SessionStateJSON wrapper * Use EncrpytInto/DecryptInto to reduce sessionstate Co-authored-by: Henry Jenkins <henry@henryjenkins.name>
22 lines
456 B
Go
22 lines
456 B
Go
package providers
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/oauth2-proxy/oauth2-proxy/pkg/apis/sessions"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRefresh(t *testing.T) {
|
|
p := &ProviderData{}
|
|
|
|
expires := time.Now().Add(time.Duration(-11) * time.Minute)
|
|
refreshed, err := p.RefreshSessionIfNeeded(context.Background(), &sessions.SessionState{
|
|
ExpiresOn: &expires,
|
|
})
|
|
assert.Equal(t, false, refreshed)
|
|
assert.Equal(t, nil, err)
|
|
}
|