#NEWLINE# def test_put_calls_requests( self ) : #NEWLINE# #INDENT# '\n        JsonApiRequest.put should call requests.get and return the JSON result\n        ' #NEWLINE# with patch ( 'requests.put' ) as requests_mock , response_context ( ) as response_mock : #NEWLINE# #INDENT# requests_mock . return_value = response_mock #NEWLINE# request = JsonApiRequest ( 'http://www.example.com' , 'admin' , 's3cr3t' ) #NEWLINE# data = request . put ( 'ham/eggs' , { #NEWLINE# #INDENT# 'ham' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# requests_mock . assert_called_with ( 'http://www.example.com/api/ham/eggs' , '{"ham": true}' , headers = { #NEWLINE# #INDENT# 'Content-type' : 'application/json' , #NEWLINE# 'Accept' : 'application/json' , #NEWLINE# #UNINDENT# } , auth = ( 'admin' , 's3cr3t' ) ) #NEWLINE# self . assertEqual ( self , { #NEWLINE# #INDENT# 'spam' : True , #NEWLINE# #UNINDENT# } )