added POST OAuth2 redirect test
This commit is contained in:
		
							parent
							
								
									9d847678df
								
							
						
					
					
						commit
						d417b86fc0
					
				| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue