#NEWLINE# @ patch ( 'djstripe.models.Invoice.sync_from_stripe_data' ) #NEWLINE# @ patch ( 'stripe.Invoice.retrieve' , return_value = 'key' ) #NEWLINE# def test_handle_event_payment_succeeded( self , invoice_retrieve_mock , sync_invoice_mock ) : #NEWLINE# #INDENT# fake_event = Event ( kind = 'invoice.payment_succeeded' , validated_message = { #NEWLINE# #INDENT# 'data' : { #NEWLINE# #INDENT# 'object' : { #NEWLINE# #INDENT# 'id' : 'lock' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# invoice_webhook_handler ( invoice_retrieve_mock , fake_event . message [ 'data' ] , 'invoice' , 'payment_failed' ) #NEWLINE# invoice_retrieve_mock . assert_called_once_with ( 'lock' ) #NEWLINE# sync_invoice_mock . assert_called_once_with ( 'key' , send_receipt = True )