#NEWLINE# def test_fetching_access_token_with_invalid_grant_type( self ) : #NEWLINE# #INDENT# self . login ( ) #NEWLINE# self . _login_and_authorize ( ) #NEWLINE# response = self . client . get ( self . redirect_url ( ) ) #NEWLINE# query = QueryDict ( urlparse . urlparse ( response [ 'Location' ] ) . query ) #NEWLINE# code = query [ 'code' ] #NEWLINE# response = self . client . post ( self . access_token_url ( ) , { #NEWLINE# #INDENT# 'grant_type' : 'invalid_grant_type' , #NEWLINE# 'client_id' : self . get_client ( ) . client_id , #NEWLINE# 'client_secret' : self . get_client ( ) . client_secret , #NEWLINE# 'code' : code , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( 400 , response . status_code ) #NEWLINE# self . assertEqual ( 'unsupported_grant_type' , json . loads ( response . content ) [ 'error' ] , response . content )