#NEWLINE# @ patch ( 'stripe.Event.retrieve' ) #NEWLINE# def test_webhook_with_transfer_event( self , StripeEventMock ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'created' : 1348360173 , #NEWLINE# 'data' : { #NEWLINE# #INDENT# 'object' : { #NEWLINE# #INDENT# 'amount' : 455 , #NEWLINE# 'currency' : 'usd' , #NEWLINE# 'date' : 1348876800 , #NEWLINE# 'description' : None , #NEWLINE# 'id' : 'ach_XXXXXXXXXXXX' , #NEWLINE# 'object' : 'transfer' , #NEWLINE# 'other_transfers' : [ ] , #NEWLINE# 'status' : 'pending' , #NEWLINE# 'summary' : { #NEWLINE# #INDENT# 'adjustment_count' : 0 , #NEWLINE# 'adjustment_fee_details' : [ ] , #NEWLINE# 'adjustment_fees' : 0 , #NEWLINE# 'adjustment_gross' : 0 , #NEWLINE# 'charge_count' : 1 , #NEWLINE# 'charge_fee_details' : [ { #NEWLINE# #INDENT# 'amount' : 45 , #NEWLINE# 'application' : None , #NEWLINE# 'currency' : 'usd' , #NEWLINE# 'description' : None , #NEWLINE# 'type' : 'stripe_fee' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'charge_fees' : 45 , #NEWLINE# 'charge_gross' : 500 , #NEWLINE# 'collected_fee_count' : 0 , #NEWLINE# 'collected_fee_gross' : 0 , #NEWLINE# 'currency' : 'usd' , #NEWLINE# 'net' : 455 , #NEWLINE# 'refund_count' : 0 , #NEWLINE# 'refund_fees' : 0 , #NEWLINE# 'refund_gross' : 0 , #NEWLINE# 'validation_count' : 0 , #NEWLINE# 'validation_fees' : 0 , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# 'id' : 'evt_XXXXXXXXXXXXx' , #NEWLINE# 'livemode' : True , #NEWLINE# 'object' : 'event' , #NEWLINE# 'pending_webhooks' : 1 , #NEWLINE# 'type' : 'transfer.created' , #NEWLINE# #UNINDENT# } #NEWLINE# StripeEventMock . return_value . to_dict . return_value = data #NEWLINE# msg = json . dumps ( data ) #NEWLINE# resp = Client ( ) . post ( reverse ( 'pinax_stripe_webhook' ) , six . u ( msg ) , content_type = 'application/json' ) #NEWLINE# self . assertEquals ( resp . status_code , 200 ) #NEWLINE# self . assertTrue ( Event . objects . filter ( kind = 'transfer.created' ) . exists ( ) )