Exemplo n.º 1
0
        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)
Exemplo n.º 2
0
        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)
Exemplo n.º 3
0
    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())
Exemplo n.º 4
0
    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())