def poll(task_id): task = Task(TASK_TEMPLATE) # Wait for the first 2 polls if mock_get.call_count < 3: task.state = STATE_WAITING # Running for the next 10 elif mock_get.call_count < 13: task.state = STATE_RUNNING # Finally finish else: task.state = STATE_FINISHED return Response(200, task)
def poll(task_id): task = Task(TASK_TEMPLATE) # Wait for the first 2 polls if mock_get.call_count < 3: task.state = STATE_WAITING # Running for the next 10 elif mock_get.call_count < 13: task.state = STATE_RUNNING # Finally finish else: task.state = STATE_ERROR return Response(200, task)
def test_display_status_postponed(self): # Setup postponed_task = Task(TASK_TEMPLATE) postponed_task.response = RESPONSE_POSTPONED postponed_task.state = STATE_WAITING # Test status._display_status(self.context, self.renderer, [postponed_task]) # Verify expected_tags = ['ctrl-c', 'postponed'] self.assertEqual(expected_tags, self.prompt.get_write_tags())