2015-06-23 11:23:39 +00:00
|
|
|
package providers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2019-05-05 12:33:13 +00:00
|
|
|
"github.com/pusher/oauth2_proxy/pkg/apis/sessions"
|
2017-10-23 16:23:46 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
2015-06-23 11:23:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestRefresh(t *testing.T) {
|
|
|
|
p := &ProviderData{}
|
2019-05-05 12:33:13 +00:00
|
|
|
refreshed, err := p.RefreshSessionIfNeeded(&sessions.SessionState{
|
2015-06-23 11:23:39 +00:00
|
|
|
ExpiresOn: time.Now().Add(time.Duration(-11) * time.Minute),
|
|
|
|
})
|
|
|
|
assert.Equal(t, false, refreshed)
|
|
|
|
assert.Equal(t, nil, err)
|
|
|
|
}
|