From 450cdbe7370883a16b9e7de70b2f47580447dd71 Mon Sep 17 00:00:00 2001 From: Vivek Shankar Date: Tue, 18 Jul 2023 01:24:06 +0800 Subject: [PATCH] test: Modified refresh_token flow test to catch regressions --- handler/oauth2/flow_refresh_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/handler/oauth2/flow_refresh_test.go b/handler/oauth2/flow_refresh_test.go index bed4ba581..d6a27320a 100644 --- a/handler/oauth2/flow_refresh_test.go +++ b/handler/oauth2/flow_refresh_test.go @@ -159,7 +159,11 @@ func TestRefreshFlow_HandleTokenEndpointRequest(t *testing.T) { require.NoError(t, err) areq.Form.Add("refresh_token", token) + + orReqID := areq.GetID() + "_OR" + areq.Form.Add("or_request_id", orReqID) err = store.CreateRefreshTokenSession(nil, sig, &fosite.Request{ + ID: orReqID, Client: areq.Client, GrantedScope: fosite.Arguments{"foo", "offline"}, RequestedScope: fosite.Arguments{"foo", "bar", "offline"}, @@ -177,6 +181,7 @@ func TestRefreshFlow_HandleTokenEndpointRequest(t *testing.T) { assert.NotEqual(t, url.Values{"foo": []string{"bar"}}, areq.Form) assert.Equal(t, time.Now().Add(time.Hour).UTC().Round(time.Second), areq.GetSession().GetExpiresAt(fosite.AccessToken)) assert.Equal(t, time.Now().Add(time.Hour).UTC().Round(time.Second), areq.GetSession().GetExpiresAt(fosite.RefreshToken)) + assert.EqualValues(t, areq.Form.Get("or_request_id"), areq.GetID(), "Requester ID should be replaced based on the refresh token session") }, }, {