2015-06-23 07:23:39 -04:00
|
|
|
package providers
|
|
|
|
|
|
|
|
import (
|
2020-05-06 00:53:33 +09:00
|
|
|
"context"
|
2015-06-23 07:23:39 -04:00
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2020-03-29 14:54:36 +01:00
|
|
|
"github.com/oauth2-proxy/oauth2-proxy/pkg/apis/sessions"
|
2017-10-23 12:23:46 -04:00
|
|
|
"github.com/stretchr/testify/assert"
|
2015-06-23 07:23:39 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestRefresh(t *testing.T) {
|
|
|
|
p := &ProviderData{}
|
2020-05-06 00:53:33 +09:00
|
|
|
refreshed, err := p.RefreshSessionIfNeeded(context.Background(), &sessions.SessionState{
|
2015-06-23 07:23:39 -04:00
|
|
|
ExpiresOn: time.Now().Add(time.Duration(-11) * time.Minute),
|
|
|
|
})
|
|
|
|
assert.Equal(t, false, refreshed)
|
|
|
|
assert.Equal(t, nil, err)
|
|
|
|
}
|