#NEWLINE# @ mock . patch ( 'st2common.transport.reactor.TriggerDispatcher.dispatch' ) #NEWLINE# def test_timer_trace_tag_creation( self , dispatch_mock ) : #NEWLINE# #INDENT# timer = St2Timer ( ) #NEWLINE# timer . _scheduler = mock . Mock ( ) #NEWLINE# timer . _trigger_watcher = mock . Mock ( ) #NEWLINE# type_ = TIMER_TRIGGER_TYPES . keys ( ) [ 0 ] #NEWLINE# parameters = { #NEWLINE# #INDENT# 'unit' : 'seconds' , #NEWLINE# 'delta' : 1 , #NEWLINE# #UNINDENT# } #NEWLINE# trigger_db = TriggerDB ( name = 'test_trigger_1' , pack = 'dummy' , type = type_ , parameters = parameters ) #NEWLINE# timer . add_trigger ( trigger_db ) #NEWLINE# timer . _emit_trigger_instance ( trigger = trigger_db . to_serializable_dict ( ) ) #NEWLINE# self . assertEqual ( dispatch_mock . call_args [ 1 ] [ 'trace_context' ] . trace_tag , ( '%s-%s' % ( TIMER_TRIGGER_TYPES [ type_ ] [ 'name' ] , self . name ) ) )