def __init__(self, action_dict): assert_type(action_dict, dict, "action specification") try: self.action_type = action_dict['type'] except KeyError: raise InvalidScenarioFileFormat('Encountered action without type\n'+str(action_dict)) try: self.callback = ACTIONS.get(self.action_type) except KeyError: raise InvalidScenarioFileFormat('Found invalid action type: %s' % self.action_type) self.arguments = action_dict.get('arguments', [])
def print_scenario_actions(): print('Available scenario actions and their arguments:') for action in ACTIONS.registry: arguments = inspect.getargspec(ACTIONS.get(action))[0][1:] # exclude session print('{:-12s} {}'.format(action, arguments or ''))