#NEWLINE# def test_invoice_ready_signal_fired( self ) : #NEWLINE# #INDENT# zebra_webhook_invoice_ready . connect ( self . _signal_reciever ) #NEWLINE# self . assertEqual ( c . signal_kwargs , None ) #NEWLINE# test_post_data = { #NEWLINE# #INDENT# 'json' : simplejson . dumps ( { #NEWLINE# #INDENT# 'customer' : 1083 , #NEWLINE# 'event' : 'invoice_ready' , #NEWLINE# 'invoice' : { #NEWLINE# #INDENT# 'total' : 1500 , #NEWLINE# 'subtotal' : 3000 , #NEWLINE# 'lines' : { #NEWLINE# #INDENT# 'invoiceitems' : [ { #NEWLINE# #INDENT# 'id' : 'ii_N17xcRJUtn' , #NEWLINE# 'amount' : 1000 , #NEWLINE# 'date' : 1303586118 , #NEWLINE# 'currency' : 'usd' , #NEWLINE# 'description' : 'One-time setup fee' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'subscriptions' : [ { #NEWLINE# #INDENT# 'amount' : 2000 , #NEWLINE# 'period' : { #NEWLINE# #INDENT# 'start' : 1304588585 , #NEWLINE# 'end' : 1307266985 , #NEWLINE# #UNINDENT# } , #NEWLINE# 'plan' : { #NEWLINE# #INDENT# 'amount' : 2000 , #NEWLINE# 'interval' : 'month' , #NEWLINE# 'object' : 'plan' , #NEWLINE# 'id' : 'p_Mr2NgWECmJ' , #NEWLINE# 'id' : 'premium' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# 'object' : 'invoice' , #NEWLINE# 'discount' : { #NEWLINE# #INDENT# 'code' : '50OFF' , #NEWLINE# 'percent_off' : 50 , #NEWLINE# #UNINDENT# } , #NEWLINE# 'date' : 1304588585 , #NEWLINE# 'period_start' : 1304588585 , #NEWLINE# 'id' : 'in_jN6A1g8N76' , #NEWLINE# 'period_end' : 1304588585 , #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' ] [ 'invoice' ] [ 'date' ] , 1304588585 )