#NEWLINE# def test_create_token_response( self ) : #NEWLINE# #INDENT# bearer = BearerToken ( self . mock_validator , expires_in = 1800 ) #NEWLINE# orig_generate_token = common . generate_token #NEWLINE# self . addCleanup ( setattr , common , 'generate_token' , orig_generate_token ) #NEWLINE# common . generate_token = ( lambda * args , **kwargs : '1234' ) #NEWLINE# ( headers , body , status_code ) = self . auth . create_token_response ( self . request , bearer ) #NEWLINE# correct_uri = 'https://b.c/p#access_token=1234&token_type=Bearer&expires_in=1800&state=xyz&scope=hello+world' #NEWLINE# self . assertEqual ( status_code , 302 ) #NEWLINE# self . assertIn ( 'Location' , headers ) #NEWLINE# self . assertURLEqual ( headers [ 'Location' ] , correct_uri , parse_fragment = True )