#NEWLINE# @ patch ( 'xmltodict.parse' ) #NEWLINE# @ patch ( 'requests.post' ) #NEWLINE# def test_provider_raises_redirect_needed_on_success( self , mocked_post , mocked_parser ) : #NEWLINE# #INDENT# response = MagicMock ( ) #NEWLINE# response . status_code = 200 #NEWLINE# mocked_post . return_value = mocked_parser #NEWLINE# mocked_parser . return_value = { #NEWLINE# #INDENT# 'new_transaction' : { #NEWLINE# #INDENT# 'payment_url' : 'http://payment.com' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# with self . assertRaises ( RedirectNeeded ) as exc : #NEWLINE# #INDENT# self . provider . get_form ( self . payment )