@override_settings(MACHINE_STEP_SCHEDULER=(
        'orchestra.utils.machine_step_scheduler',
        'SynchronousMachineStepScheduler'))
    def test_task_creation(self):
        Task.objects.filter(status=Task.Status.AWAITING_PROCESSING).delete()

        project = self.projects['test_human_and_machine']
        self.assertEquals(Task.objects.filter(project=project).count(),
                          0)
        create_subsequent_tasks(project)

        # Human Task was created
        self.assertEquals(Task.objects.filter(project=project).count(),
                          1)

        response = (self.clients[0].get(
            '/orchestra/api/interface/new_task_assignment/entry_level/'))
        self.assertEquals(response.status_code, 200)

        human_step = self.workflow_steps['test_workflow_2']['step4']
        task = Task.objects.get(step=human_step, project=project)
        data = {'submit_key1': 'submit_val1'}

        # user 0 submits a task
        response = self._submit_assignment(self.clients[0], task.id, data=data)
        self.assertEquals(response.status_code, 200)

        # Machine Task was created
        self.assertEquals(Task.objects.filter(project=project).count(),
                          2)
        machine_step = self.workflow_steps['test_workflow_2']['simple_machine']
        machine_task_assignment = (
            TaskAssignment.objects
            .filter(task__step=machine_step,
                    task__project=project)[0])

        self.assertTrue(machine_task_assignment.status,
                        TaskAssignment.Status.SUBMITTED)

        self.assertTrue(machine_task_assignment.in_progress_task_data,
                        {'simple': 'json'})

        self.assertTrue(machine_task_assignment.task.status,
                        Task.Status.COMPLETE)
Test human and machine task creation
dataset/ETHPy150Open unlimitedlabs/orchestra/orchestra/tests/test_dashboard.py/DashboardTestCase.test_task_creation