diff --git a/apis/record_auth_test.go b/apis/record_auth_test.go index ceb71d90..b4f7c150 100644 --- a/apis/record_auth_test.go +++ b/apis/record_auth_test.go @@ -1703,6 +1703,28 @@ func TestRecordAuthOAuth2Redirect(t *testing.T) { } }, }, + { + Name: "(POST) client with @oauth2 subscription", + Method: http.MethodPost, + Url: "/api/oauth2-redirect", + Body: strings.NewReader("code=123&state=" + clientStubs[7]["c3"].Id()), + RequestHeaders: map[string]string{ + "content-type": "application/x-www-form-urlencoded", + }, + BeforeTestFunc: beforeTestFunc(clientStubs[7], map[string][]string{ + "c3": {`"state":"` + clientStubs[7]["c3"].Id(), `"code":"123"`}, + }), + ExpectedStatus: http.StatusTemporaryRedirect, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, res *http.Response) { + app.Store().Get("cancelFunc").(context.CancelFunc)() + + checkSuccessRedirect(t, app, res) + + if clientStubs[7]["c3"].HasSubscription("@oauth2") { + t.Fatalf("Expected oauth2 subscription to be removed") + } + }, + }, } for _, scenario := range scenarios {