#NEWLINE# def test_invalid_scope( self ) : #NEWLINE# #INDENT# self . validator . get_default_redirect_uri . return_value = 'https://i.b/cb' #NEWLINE# self . validator . validate_scopes . return_value = False #NEWLINE# self . validator . authenticate_client . side_effect = self . set_client #NEWLINE# self . assertRaises ( errors . InvalidScopeError , self . web . validate_authorization_request , 'https://i.b/auth?response_type=code&client_id=foo' ) #NEWLINE# self . assertRaises ( errors . InvalidScopeError , self . mobile . validate_authorization_request , 'https://i.b/auth?response_type=token&client_id=foo' ) #NEWLINE# ( _ , body , _ ) = self . legacy . create_token_response ( 'https://i.b/token' , body = 'grant_type=password&username=foo&password=bar' ) #NEWLINE# self . assertEqual ( 'invalid_scope' , json . loads ( body ) [ 'error' ] ) #NEWLINE# ( _ , body , _ ) = self . backend . create_token_response ( 'https://i.b/token' , body = 'grant_type=client_credentials' ) #NEWLINE# self . assertEqual ( 'invalid_scope' , json . loads ( body ) [ 'error' ] )