<s> import json <EOL> from st2actions . runners import ActionRunner <EOL> from st2common . constants . action import ( LIVEACTION_STATUS_SUCCEEDED ) <EOL> __all__ = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> def get_runner ( ) : <EOL> return MockActionRunner ( ) <EOL> class MockActionRunner ( ActionRunner ) : <EOL> def __init__ ( self ) : <EOL> super ( MockActionRunner , self ) . __init__ ( runner_id = '<STR_LIT:1>' ) <EOL> self . pre_run_called = False <EOL> self . run_called = False <EOL> self . post_run_called = False <EOL> def pre_run ( self ) : <EOL> self . pre_run_called = True <EOL> def run ( self , action_params ) : <EOL> self . run_called = True <EOL> result = { } <EOL> if self . runner_parameters . get ( '<STR_LIT>' , False ) : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> default_result = { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : action_params <EOL> } <EOL> default_context = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> } <EOL> status = self . runner_parameters . get ( '<STR_LIT>' , LIVEACTION_STATUS_SUCCEEDED ) <EOL> result = self . runner_parameters . get ( '<STR_LIT>' , default_result ) <EOL> context = self . runner_parameters . get ( '<STR_LIT>' , default_context ) <EOL> return ( status , json . dumps ( result ) , context ) <EOL> def post_run ( self , status , result ) : <EOL> self . post_run_called = True </s>
