git.iko.soy/typeable/oauth2-proxy
on master help sign in
Adding additional asserts to the TestAzureProviderREdeemReturnsIdToken to ensure that the refresh token and expires on date are both being set
commit0c541f6f5e339021a75b5477e49dce18e20500a8 authorleyshon <leyshon@gmail.com> dateThu 29 Aug 2019, 15:01 (7 years ago) parentc8a89ec
1 file changed+6−2
providers/azure_test.go+6−2
providers/azure_test.go+6−2
@@ -5,6 +5,7 @@ import (
55 "net/http/httptest"
66 "net/url"
77 "testing"
8+ "time"
89
910 "github.com/pusher/oauth2_proxy/pkg/apis/sessions"
1011 "github.com/stretchr/testify/assert"
@@ -205,7 +206,8 @@ func TestAzureProviderGetEmailAddressIncorrectOtherMails(t *testing.T) {
205206}
206207
207208func TestAzureProviderRedeemReturnsIdToken(t *testing.T) {
208− b := testAzureBackend(`{ "id_token": "testtoken1234" }`)
209+ b := testAzureBackend(`{ "id_token": "testtoken1234", "expires_on": "1136239445", "refresh_token": "refresh1234" }`)
210+ timestamp, err := time.Parse(time.RFC3339, "2006-01-02T22:04:05Z")
209211 defer b.Close()
210212
211213 bURL, _ := url.Parse(b.URL)
@@ -214,4 +216,6 @@ func TestAzureProviderRedeemReturnsIdToken(t *testing.T) {
214216 s, err := p.Redeem("https://localhost", "1234")
215217 assert.Equal(t, nil, err)
216218 assert.Equal(t, "testtoken1234", s.IDToken)
217−}
219+ assert.Equal(t, timestamp, s.ExpiresOn.UTC())
220+ assert.Equal(t, "refresh1234", s.RefreshToken)
221+}