File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -423,6 +423,27 @@ def test_code_post_auth_redirection_uri_with_querystring(self):
423423 self .assertIn ("http://example.com?foo=bar" , response ['Location' ])
424424 self .assertIn ("code=" , response ['Location' ])
425425
426+ def test_code_post_auth_failing_redirection_uri_with_querystring (self ):
427+ """
428+ Test that in case of error the querystring of the redirection uri is preserved
429+
430+ See https://github.com/evonove/django-oauth-toolkit/issues/238
431+ """
432+ self .client .login (username = "test_user" , password = "123456" )
433+
434+ form_data = {
435+ 'client_id' : self .application .client_id ,
436+ 'state' : 'random_state_string' ,
437+ 'scope' : 'read write' ,
438+ 'redirect_uri' : 'http://example.com?foo=bar' ,
439+ 'response_type' : 'code' ,
440+ 'allow' : False ,
441+ }
442+
443+ response = self .client .post (reverse ('oauth2_provider:authorize' ), data = form_data )
444+ self .assertEqual (response .status_code , 302 )
445+ self .assertEqual ("http://example.com?foo=bar&error=access_denied" , response ['Location' ])
446+
426447 def test_code_post_auth_fails_when_redirect_uri_path_is_invalid (self ):
427448 """
428449 Tests that a redirection uri is matched using scheme + netloc + path
You can’t perform that action at this time.
0 commit comments