def test_mapped_by_and_validated_by_is_set_after_validating_all(self):
        if self.skip_tests:
            return

        ValidatorService.validate_all_tasks(self.test_project.id, self.test_user.id)

        for task in self.test_project.tasks:
            self.assertEqual(task.mapped_by, self.test_user.id)
            self.assertEqual(task.validated_by, self.test_user.id)
    def test_validate_all_sets_counters_correctly(self):
        if self.skip_tests:
            return

        # Act
        ValidatorService.validate_all_tasks(self.test_project.id, self.test_user.id)

        # Assert
        self.assertEqual(self.test_project.tasks_validated, self.test_project.total_tasks)
        self.assertEqual(self.test_project.tasks_mapped, self.test_project.total_tasks)
    def test_mapped_by_and_validated_by_are_null_after_invalidating_all(self):
        if self.skip_tests:
            return

        ValidatorService.validate_all_tasks(self.test_project.id, self.test_user.id)
        ValidatorService.invalidate_all_tasks(self.test_project.id, self.test_user.id)

        for task in self.test_project.tasks:
            self.assertIsNone(task.mapped_by)
            self.assertIsNone(task.validated_by)
Beispiel #4
0
 def post(self, project_id):
     """
     Validate all mapped tasks on a project
     ---
     tags:
         - project-admin
     produces:
         - application/json
     parameters:
         - in: header
           name: Authorization
           description: Base64 encoded session token
           required: true
           type: string
           default: Token sessionTokenHere==
         - name: project_id
           in: path
           description: The unique project ID
           required: true
           type: integer
           default: 1
     responses:
         200:
             description: All mapped tasks validated
         401:
             description: Unauthorized - Invalid credentials
         500:
             description: Internal Server Error
     """
     try:
         ValidatorService.validate_all_tasks(project_id,
                                             tm.authenticated_user_id)
         return {"Success": "All tasks validated"}, 200
     except Exception as e:
         error_msg = f'Project GET - unhandled error: {str(e)}'
         current_app.logger.critical(error_msg)
         return {"error": error_msg}, 500