Exemplo n.º 1
0
    def setUp(self):
        super().setUp()
        setup_models(self)

        machine_workflow_version = (
            self.workflow_versions['machine_workflow_version'])
        self.step = machine_workflow_version.steps.get(slug='machine_step')
        self.assertIsNotNone(self.step)
        self.step.execution_function = {
            'path': 'orchestra.tests.helpers.workflow.machine_task_function',
        }
        self.step.save()
        patcher = patch(
            'orchestra.tests.helpers.workflow.machine_task_function',
            return_value={'data': ''})
        self.machine_function_mock = patcher.start()
        self.addCleanup(patcher.stop)

        self.project = ProjectFactory(
            workflow_version=machine_workflow_version)
        create_subsequent_tasks(self.project)
        self.task = self.project.tasks.first()
        self.assertIsNotNone(self.task)

        # Since create_subsequent_tasks will automatically run the machine task
        # we need to reset the task each time it's called
        self._reset_task()
Exemplo n.º 2
0
    def setUp(self):
        super().setUp()
        setup_models(self)
        self.worker = Worker.objects.get(user__username='******')
        self.worker.user.is_staff = True
        self.worker.user.save()
        self.request_client.login(username=self.worker.user.username,
                                  password='******')
        self.full_todo_list_template = TodoListTemplateFactory(
            slug='full-template-slug',
            name='Full template name',
            description='Full template description',
            conditional_property_function={
                'path': 'orchestra.tests.test_todos'
                '._get_test_conditional_props'
            },
            todos=TODO_TEMPLATE_NESTED_TODOS)
        self.empty_todo_list_template = TodoListTemplateFactory(
            slug='empty-template-slug',
            name='Empty template name',
            description='Empty template description',
            conditional_property_function={
                'path': 'orchestra.tests.test_todos'
                '._get_test_conditional_props'
            },
            todos={})

        self.import_url_name = (
            'orchestra:todos:import_todo_list_template_from_spreadsheet')
        self.template_admin_name = 'admin:orchestra_todolisttemplate_change'
        self.export_url_name = 'admin:orchestra_todolisttemplate_actions'
Exemplo n.º 3
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = self.workers[0]
     self.comm_type = (
         CommunicationPreference.CommunicationType.TASK_STATUS_CHANGE.value)
     self.recipient_list = [self.worker.user.email]
Exemplo n.º 4
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = self.workers[0]
     self.comm_type = (CommunicationPreference.CommunicationType
                       .TASK_STATUS_CHANGE.value)
     self.recipient_list = [self.worker.user.email]
Exemplo n.º 5
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.workflow_version = WorkflowVersionFactory()
     self.step = StepFactory(
         slug='step-slug',
         workflow_version=self.workflow_version)
     self.project = ProjectFactory(
         workflow_version=self.workflow_version)
Exemplo n.º 6
0
    def setUp(self):
        super().setUp()
        setup_models(self)
        self.worker = self.workers[0]
        self.worker.user.is_superuser = True
        self.worker.user.save()

        self.request_client = RequestClient(username=self.worker.user.username,
                                            password='******')
        self.url = reverse('orchestra:bots:staffbot')
Exemplo n.º 7
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = self.workers[0]
     self.worker.user.is_superuser = True
     self.worker.user.save()
     patcher = patch(('orchestra.bots.staffbot.StaffBot'
                      '._send_staffing_request_by_slack'))
     patcher.start()
     self.addCleanup(patcher.stop)
Exemplo n.º 8
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = Worker.objects.get(user__username='******')
     self.request_client.login(username=self.worker.user.username,
                               password='******')
     self.list_create_url = reverse('orchestra:todos:todos')
     self.list_details_url_name = 'orchestra:todos:todo'
     self.tasks = Task.objects.filter(assignments__worker=self.worker)
     self.task = self.tasks[0]
     self.todo_description = 'Let us do this'
Exemplo n.º 9
0
    def setUp(self):
        super().setUp()
        setup_models(self)
        self.worker = self.workers[0]
        self.worker.user.is_superuser = True
        self.worker.user.save()

        self.request_client = RequestClient(username=self.worker.user.username,
                                            password='******')
        self.url = reverse('orchestra:bots:staffbot')
        self.staffbot = StaffBot()
Exemplo n.º 10
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = self.workers[0]
     self.worker.user.is_superuser = True
     self.worker.user.save()
     patcher = patch(
         ('orchestra.bots.staffbot.StaffBot'
          '._send_staffing_request_by_slack'))
     patcher.start()
     self.addCleanup(patcher.stop)
Exemplo n.º 11
0
    def setUp(self):
        super().setUp()
        setup_models(self)
        self.url = reverse('orchestra:communication_preference_settings')
        self.user = self.authenticate_user()

        worker = self.workers[0]
        worker.user = self.user
        worker.save()
        # Update this to handle multiple prefs when we have them
        self.comm_pref = CommunicationPreference.objects.filter(
            worker=worker).first()
Exemplo n.º 12
0
 def setUp(self):
     super().setUp()
     self.request_client = APIClient(enforce_csrf_checks=True)
     self.request_client.force_authenticate(user=SignedUser())
     setup_models(self)
     self.workflow_version = WorkflowVersionFactory()
     self.step = StepFactory(slug='step-slug',
                             workflow_version=self.workflow_version)
     self.project = ProjectFactory(workflow_version=self.workflow_version)
     self.list_url = reverse('orchestra:api:todo-api-list')
     self.todo = TodoFactory(project=self.project)
     self.todo_with_step = TodoFactory(project=self.project, step=self.step)
Exemplo n.º 13
0
    def setUp(self):
        super().setUp()
        setup_models(self)
        self.url = reverse('orchestra:communication_preference_settings')
        self.request_client, self.user = self.authenticate_user()

        worker = self.workers[0]
        worker.user = self.user
        worker.save()
        # Update this to handle multiple prefs when we have them
        self.comm_pref = CommunicationPreference.objects.filter(
            worker=worker).first()
Exemplo n.º 14
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = Worker.objects.get(user__username='******')
     self.request_client.login(username=self.worker.user.username,
                               password='******')
     self.url = reverse('orchestra:orchestra:time_entries')
     self.tasks = Task.objects.filter(assignments__worker=self.worker)
     self.task = self.tasks[0]
     self.assignment = (self.task.assignments.filter(worker=self.worker)
                        .first())
     self.time_entry_data = {'date': '2016-05-01',
                             'time_worked': '00:30:00',
                             'description': 'test description'}
Exemplo n.º 15
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = Worker.objects.get(user__username='******')
     self.request_client.login(username=self.worker.user.username,
                               password='******')
     self.url = reverse('orchestra:orchestra:time_entries')
     self.tasks = Task.objects.filter(assignments__worker=self.worker)
     self.task = self.tasks[0]
     self.assignment = (self.task.assignments.filter(worker=self.worker)
                        .first())
     self.time_entry_data = {'date': '2016-05-01',
                             'time_worked': '00:30:00',
                             'description': 'test description'}
Exemplo n.º 16
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = Worker.objects.get(user__username='******')
     self.request_client.login(username=self.worker.user.username,
                               password='******')
     self.list_create_url = reverse('orchestra:todos:todo_qas')
     self.worker_task_recent_todo_qas_url = reverse(
         'orchestra:todos:worker_task_recent_todo_qas')
     self.list_details_url_name = 'orchestra:todos:todo_qa'
     self.tasks = Task.objects.filter(assignments__worker=self.worker)
     self.task_0 = self.tasks[0]
     self.task_1 = self.tasks[1]
     self.todo = TodoFactory(task=self.task_0)
     self.comment = 'Test comment'
    def setUp(self):
        super().setUp()
        setup_models(self)
        self.project_admin_group = Group.objects.create(name='project_admins')
        user = (UserFactory(username='******',
                            first_name='project_management',
                            last_name='project_management',
                            password='******',
                            email='*****@*****.**'))
        self.worker = WorkerFactory(user=user)
        user.groups.add(self.project_admin_group)

        self.api_client = Client()
        self.api_client.login(
            username='******', password='******')
Exemplo n.º 18
0
    def setUp(self):
        super().setUp()
        setup_models(self)
        self.project_admin_group = Group.objects.create(name='project_admins')
        user = (UserFactory(username='******',
                            first_name='project_management',
                            last_name='project_management',
                            password='******',
                            email='*****@*****.**'))
        self.worker = WorkerFactory(user=user)
        user.groups.add(self.project_admin_group)

        self.api_client = Client()
        self.api_client.login(username='******',
                              password='******')
Exemplo n.º 19
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = Worker.objects.get(user__username='******')
     self.request_client.login(username=self.worker.user.username,
                               password='******')
     self.todolist_template_list_url = reverse(
         'orchestra:todos:todolist_templates')
     self.todolist_template_detail_url_name = \
         'orchestra:todos:todolist_template'
     self.todolist_template_slug = 'test_todolist_template_slug'
     self.todolist_template_name = 'test_todolist_template_name'
     self.todolist_template_description = \
         'test_todolist_template_description'
     self.tasks = Task.objects.filter(assignments__worker=self.worker)
     self.task = self.tasks[0]
Exemplo n.º 20
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = Worker.objects.get(user__username='******')
     self.request_client.login(username=self.worker.user.username,
                               password='******')
     self.list_create_url = reverse('orchestra:todos:todos-list')
     self.list_details_url_name = 'orchestra:todos:todos-detail'
     self.workflow_version = WorkflowVersionFactory()
     self.step = StepFactory(slug='step-slug',
                             workflow_version=self.workflow_version)
     self.project = ProjectFactory(workflow_version=self.workflow_version)
     tasks = Task.objects.filter(assignments__worker=self.worker)
     task = tasks[0]
     task.project = self.project
     task.step = self.step
     task.save()
     self.todo_title = 'Let us do this'
     self.deadline = parse('2018-01-16T07:03:00+00:00')
Exemplo n.º 21
0
    def setUp(self):
        super().setUp()
        setup_models(self)
        self.worker = Worker.objects.get(user__username='******')
        self.tasks = Task.objects.filter(assignments__worker=self.worker)
        self.task = self.tasks[0]
        self.assignment = (self.task.assignments.filter(worker=self.worker)
                           .first())
        self.time_entry_data = {'date': '2016-05-01',
                                'time_worked': '00:30:00',
                                'description': 'test description'}
        self.time = timezone.now()

        def fake_now():
            """ Patch timezone.now so we can test timer. """
            return self.time

        patcher = patch('orchestra.utils.time_tracking.timezone.now', fake_now)
        self.addCleanup(patcher.stop)
        patcher.start()
Exemplo n.º 22
0
    def setUp(self):
        super().setUp()
        setup_models(self)
        self.worker = Worker.objects.get(user__username='******')
        self.tasks = Task.objects.filter(assignments__worker=self.worker)
        self.task = self.tasks[0]
        self.assignment = (self.task.assignments.filter(
            worker=self.worker).first())
        self.time_entry_data = {
            'date': '2016-05-01',
            'time_worked': '00:30:00',
            'description': 'test description'
        }
        self.time = timezone.now()

        def fake_now():
            """ Patch timezone.now so we can test timer. """
            return self.time

        patcher = patch('orchestra.utils.time_tracking.timezone.now', fake_now)
        self.addCleanup(patcher.stop)
        patcher.start()
Exemplo n.º 23
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = Worker.objects.get(user__username='******')
     self.request_client.login(username=self.worker.user.username,
                               password='******')
     self.todolist_template_list_url = reverse(
         'orchestra:todos:todolist_templates')
     self.todolist_template_detail_url_name = \
         'orchestra:todos:todolist_template'
     self.todolist_template_slug = 'test_todolist_template_slug'
     self.todolist_template_name = 'test_todolist_template_name'
     self.todolist_template_description = \
         'test_todolist_template_description'
     self.workflow_version = WorkflowVersionFactory()
     self.step = StepFactory(slug='step-slug',
                             workflow_version=self.workflow_version)
     self.project = ProjectFactory(workflow_version=self.workflow_version)
     self.project2 = ProjectFactory()
     tasks = Task.objects.filter(assignments__worker=self.worker)
     self.task = tasks[0]
     self.task.project = self.project
     self.task.step = self.step
     self.task.save()
Exemplo n.º 24
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.worker = Worker.objects.get(user__username='******')
     self.request_client.login(username=self.worker.user.username,
                               password='******')
     self.list_create_url = reverse('orchestra:todos:todo_qas')
     self.worker_task_recent_todo_qas_url = reverse(
         'orchestra:todos:worker_task_recent_todo_qas')
     self.list_details_url_name = 'orchestra:todos:todo_qa'
     self.project0 = ProjectFactory()
     self.project1 = ProjectFactory()
     self.step = StepFactory(slug='some-slug')
     tasks = Task.objects.filter(assignments__worker=self.worker)
     self.task_0 = tasks[0]
     self.task_0.project = self.project0
     self.task_0.step = self.step
     self.task_0.save()
     self.task_1 = tasks[1]
     self.task_1.project = self.project1
     self.task_1.step = self.step
     self.task_1.save()
     self.todo = TodoFactory(project=self.project0, step=self.step)
     self.comment = 'Test comment'
Exemplo n.º 25
0
 def setUp(self):  # noqa
     super(ProjectPropertiesTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 26
0
 def setUp(self):  # noqa
     super(ProjectPropertiesTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 27
0
 def setUp(self):  # noqa
     super(BasicNotificationsTestCase, self).setUp()
     setup_models(self)
 def setUp(self):
     super(MachineStepSchedulerTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 29
0
 def setUp(self):
     super(MachineStepSchedulerTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 30
0
 def setUp(self):
     super(ModelsTestCase, self).setUp()
     setup_models(self)
     self.workers[0] = Worker.objects.get(user__username="******")
Exemplo n.º 31
0
 def setUp(self):
     super(ModelsTestCase, self).setUp()
     setup_models(self)
     self.workers[0] = Worker.objects.get(user__username='******')
Exemplo n.º 32
0
 def setUp(self):  # noqa
     super(ProjectAPITestCase, self).setUp()
     setup_models(self)
     self.api_client = APIClient(enforce_csrf_checks=True)
     self.api_client.force_authenticate(user=SignedUser())
Exemplo n.º 33
0
 def setUp(self):
     super(AdminTestCase, self).setUp()
     # Can't put this in self.setUp since test workflows don't work for
     # the form save test (see comment below)
     setup_models(self)
Exemplo n.º 34
0
 def setUp(self):  # noqa
     super(ProjectAPIAuthTestCase, self).setUp()
     setup_models(self)
     self.authentication = OrchestraProjectAPIAuthentication()
Exemplo n.º 35
0
 def setUp(self):  # noqa
     super(ProjectAPIAuthTestCase, self).setUp()
     setup_models(self)
     self.authentication = OrchestraProjectAPIAuthentication()
Exemplo n.º 36
0
 def setUp(self):  # noqa
     super(ProjectAPITestCase, self).setUp()
     setup_models(self)
     self.api_client = APIClient(enforce_csrf_checks=True)
     self.api_client.force_authenticate(user=SignedUser())
Exemplo n.º 37
0
 def setUp(self):  # noqa
     super().setUp()
     setup_models(self)
Exemplo n.º 38
0
 def setUp(self):  # noqa
     super(BasicTaskLifeCycleTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 39
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.api_client = APIClient(enforce_csrf_checks=True)
     self.api_client.force_authenticate(user=SignedUser())
Exemplo n.º 40
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.authentication = OrchestraProjectAPIAuthentication()
Exemplo n.º 41
0
 def setUp(self):  # noqa
     super(AnalyticsTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 42
0
 def setUp(self):
     super().setUp()
     setup_models(self)
Exemplo n.º 43
0
 def setUp(self):  # noqa
     super(DashboardTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 44
0
 def setUp(self):
     super(AdminTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 45
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.authentication = OrchestraProjectAPIAuthentication()
Exemplo n.º 46
0
 def setUp(self):  # noqa
     super().setUp()
     setup_models(self)
Exemplo n.º 47
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.workers[0] = Worker.objects.get(user__username='******')
     self.worker = self.workers[0]
Exemplo n.º 48
0
 def setUp(self):
     super().setUp()
     setup_models(self)
Exemplo n.º 49
0
 def setUp(self):  # noqa
     super(DashboardTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 50
0
 def setUp(self):  # noqa
     super(BasicNotificationsTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 51
0
 def setUp(self):  # noqa
     super(AnalyticsTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 52
0
 def setUp(self):  # noqa
     super(BasicTaskLifeCycleTestCase, self).setUp()
     setup_models(self)
Exemplo n.º 53
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.api_client = APIClient(enforce_csrf_checks=True)
     self.api_client.force_authenticate(user=SignedUser())