#NEWLINE# @ patch ( 'eventtracker.tasks._get_carrot_object' ) #NEWLINE# def test_track_sends_event( get_carrot_object ) : #NEWLINE# #INDENT# get_carrot_object . return_value = get_carrot_object #NEWLINE# args = ( 'event' , { #NEWLINE# #INDENT# 'some' : 'params' , #NEWLINE# #UNINDENT# } ) #NEWLINE# track ( * args ) #NEWLINE# tools . assert_true ( get_carrot_object . send . called ) #NEWLINE# ( cargs , ckwargs ) = get_carrot_object . send . call_args #NEWLINE# tools . assert_equals ( 1 , len ( cargs ) ) #NEWLINE# cargs = get_carrot_object [ 0 ] #NEWLINE# tools . assert_equals ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , ckwargs ) #NEWLINE# tools . assert_equals ( args [ 0 ] , cargs [ 0 ] ) #NEWLINE# tools . assert_true ( ( time ( ) > cargs [ 1 ] > ( time ( ) - 1 ) ) ) #NEWLINE# tools . assert_equals ( args [ 1 ] , cargs [ 2 ] )