#NEWLINE# @ mock . patch ( 'requests.post' ) #NEWLINE# def test_request( self , post_mock ) : #NEWLINE# #INDENT# self . api_client . secret_key = '3c4941c1-890b-5690-0c44f037ed1c' #NEWLINE# self . api_client . get_api_uri = mock . MagicMock ( return_value = 'https://plesk/api' ) #NEWLINE# post_mock . return_value = mock . MagicMock ( text = '<?xml version="1.0" ?><packet>ok</packet>' ) #NEWLINE# request = { #NEWLINE# #INDENT# 'packet' : 'test' , #NEWLINE# #UNINDENT# } #NEWLINE# expected_request = '<?xml version="1.0" ?><packet>test</packet>' #NEWLINE# response = self . api_client . request ( request ) #NEWLINE# self . assertEqual ( 'ok' , response [ 'packet' ] ) #NEWLINE# post_mock . assert_called_once_with ( 'https://plesk/api' , data = self , headers = mock . ANY , verify = mock . ANY )