def test_api_post_request(self): hub = _create_hub('http://pubsubhubbub.appspot.com') team = self._create_team() process = self._create_process(team) request_key = self._create_request(process) first_step = process.get_start_step() stat_tasks = get_tasks('request-statistics', 1) for task in stat_tasks: params = task['params'] self.assertEqual(params['request_key'], request_key) create_tasks = get_tasks('execution-creation', 1) for task in create_tasks: params = task['params'] if params['team_key'] != 'None': self.assertEqual(params['team_key'], team.id) found_member = False for member in team.members: if member == params['member']: found_member = True break self.assertTrue(found_member, 'Team member "%s" was ' \ 'not found' % params['member']) self.assertEqual(params['request_key'], request_key) self.assertEqual(params['step_key'], first_step.id) hub_tasks = get_tasks('step-callback', 1) for task in hub_tasks: params = task['params'] self.assertEqual(params['step_key'], first_step.id) self.assertEqual(params['callback_url'], hub.url)
def run_queue(self, queue_name): """Run a specific task queue by importing it's TaskHandler class.""" TaskHandler = None if queue_name == 'execution-creation': from flomosa.queue.execution_creation import TaskHandler elif queue_name == 'execution-process': from flomosa.queue.execution_process import TaskHandler elif queue_name == 'mail-request-notify': from flomosa.queue.mail.request_notify import TaskHandler elif queue_name == 'process-callback': from flomosa.queue.process_callback import TaskHandler elif queue_name == 'request-callback': from flomosa.queue.request_callback import TaskHandler elif queue_name == 'request-statistics': from flomosa.queue.request_statistics import TaskHandler elif queue_name == 'step-callback': from flomosa.queue.step_callback import TaskHandler elif queue_name == 'mail-request-complete': from flomosa.queue.mail.request_complete import TaskHandler elif queue_name == 'mail-request-reminder': from flomosa.queue.mail.request_reminder import TaskHandler elif queue_name == 'mail-request-step': from flomosa.queue.mail.request_step import TaskHandler elif queue_name == 'mail-request-confirmation': from flomosa.queue.mail.request_confirmation import TaskHandler if TaskHandler: self.handler_class = TaskHandler tasks = get_tasks(queue_name) for task in tasks: self.handle('post', params=task['params'], headers=task['headers'])