#NEWLINE# def test_recurring_payment_failed_signal_fired( self ) : #NEWLINE# #INDENT# zebra_webhook_recurring_payment_failed . connect ( self . _signal_reciever ) #NEWLINE# self . assertEqual ( self . signal_kwargs , None ) #NEWLINE# test_post_data = { #NEWLINE# #INDENT# 'json' : simplejson . dumps ( { #NEWLINE# #INDENT# 'customer' : 1083 , #NEWLINE# 'livemode' : True , #NEWLINE# 'event' : 'recurring_payment_failed' , #NEWLINE# 'attempt' : 2 , #NEWLINE# 'invoice' : { #NEWLINE# #INDENT# 'attempted' : True , #NEWLINE# 'charge' : 'ch_sUmNHkMiag' , #NEWLINE# 'closed' : False , #NEWLINE# 'customer' : '1083' , #NEWLINE# 'date' : 1305525584 , #NEWLINE# 'id' : 'in_jN6A1g8N76' , #NEWLINE# 'object' : 'invoice' , #NEWLINE# 'paid' : True , #NEWLINE# 'period_end' : 1305525584 , #NEWLINE# 'period_start' : 1305525584 , #NEWLINE# 'subtotal' : 2000 , #NEWLINE# 'total' : 2000 , #NEWLINE# 'lines' : { #NEWLINE# #INDENT# 'subscriptions' : [ { #NEWLINE# #INDENT# 'period' : { #NEWLINE# #INDENT# 'start' : 1305525584 , #NEWLINE# 'end' : 1308203984 , #NEWLINE# #UNINDENT# } , #NEWLINE# 'plan' : { #NEWLINE# #INDENT# 'object' : 'plan' , #NEWLINE# 'name' : 'Premium plan' , #NEWLINE# 'id' : 'premium' , #NEWLINE# 'interval' : 'month' , #NEWLINE# 'amount' : 2000 , #NEWLINE# #UNINDENT# } , #NEWLINE# 'amount' : 2000 , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# 'payment' : { #NEWLINE# #INDENT# 'time' : 1297887533 , #NEWLINE# 'card' : { #NEWLINE# #INDENT# 'type' : 'Visa' , #NEWLINE# 'last4' : '4242' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'success' : False , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) , #NEWLINE# #UNINDENT# } #NEWLINE# c = Client ( ) #NEWLINE# response = c . post ( reverse ( 'zebra:webhooks' ) , test_post_data ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# self . assertEqual ( self . signal_kwargs [ 'full_json' ] [ 'customer' ] , 1083 )