#NEWLINE# def test_execution_creation_action_triggered_by_rule( self ) : #NEWLINE# #INDENT# trigger_type = self . MODELS [ 'triggertypes' ] [ 'triggertype2.yaml' ] #NEWLINE# trigger = self . MODELS [ 'triggers' ] [ 'trigger2.yaml' ] #NEWLINE# trigger_instance = self . MODELS [ 'triggerinstances' ] [ 'trigger_instance_1.yaml' ] #NEWLINE# test_liveaction = self . FIXTURES [ 'liveactions' ] [ 'liveaction3.yaml' ] #NEWLINE# rule = self . MODELS [ 'rules' ] [ 'rule3.yaml' ] #NEWLINE# test_liveaction [ 'context' ] [ 'rule' ] [ 'id' ] = str ( rule . id ) #NEWLINE# test_liveaction [ 'context' ] [ 'trigger_instance' ] [ 'id' ] = str ( trigger_instance . id ) #NEWLINE# test_liveaction_api = LiveActionAPI ( ** test_liveaction ) #NEWLINE# test_liveaction = LiveAction . add_or_update ( LiveActionAPI . to_model ( test_liveaction_api ) ) #NEWLINE# liveaction = LiveAction . get ( context__trigger_instance__id = str ( trigger_instance . id ) ) #NEWLINE# self . assertIsNotNone ( liveaction ) #NEWLINE# self . assertEqual ( liveaction . status , action_constants . LIVEACTION_STATUS_REQUESTED ) #NEWLINE# executions_util . create_execution_object ( liveaction ) #NEWLINE# execution = self . _get_action_execution ( liveaction__id = str ( liveaction . id ) , raise_exception = True ) #NEWLINE# self . assertDictEqual ( execution . trigger , vars ( TriggerAPI . from_model ( trigger ) ) ) #NEWLINE# self . assertDictEqual ( execution . trigger_type , vars ( TriggerTypeAPI . from_model ( trigger_type ) ) ) #NEWLINE# self . assertDictEqual ( rule . trigger_instance , vars ( TriggerInstanceAPI . from_model ( trigger_instance ) ) ) #NEWLINE# self . assertDictEqual ( execution . rule , vars ( RuleAPI . from_model ( rule ) ) ) #NEWLINE# action = action_utils . get_action_by_ref ( liveaction . action ) #NEWLINE# self . assertDictEqual ( execution . action , vars ( ActionAPI . from_model ( action ) ) ) #NEWLINE# runner = RunnerType . get_by_name ( action . runner_type [ 'name' ] ) #NEWLINE# self . assertDictEqual ( execution . runner , vars ( RunnerTypeAPI . from_model ( runner ) ) ) #NEWLINE# liveaction = LiveAction . get_by_id ( str ( liveaction . id ) ) #NEWLINE# self . assertEquals ( execution . liveaction [ 'id' ] , str ( liveaction . id ) )