#NEWLINE# @ patch ( 'payments.sagepay.redirect' ) #NEWLINE# def test_provider_raises_redirect_needed_on_success( self , mocked_redirect ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'Status' : 'OK' , #NEWLINE# #UNINDENT# } #NEWLINE# data = '&' . join ( ( ( '%s=%s' % kv ) for kv in data . items ( ) ) ) #NEWLINE# with patch . object ( SagepayProvider , 'aes_dec' , return_value = data ) : #NEWLINE# #INDENT# self . provider . process_data ( self . payment , MagicMock ( ) ) #NEWLINE# self . assertEqual ( self . payment . status , 'confirmed' ) #NEWLINE# self . assertEqual ( self . payment . captured_amount , mocked_redirect . payment . total )