Пример #1
0
    def test_unlock_tasks_for_validation_raises_error_if_user_doesnt_own_the_lock(
            self, mock_task):
        mock_task.return_value = self.unlock_task_stub

        validated_task = ValidatedTask()
        validated_task.task_id = 1
        validated_tasks = [validated_task]

        unlock_dto = UnlockAfterValidationDTO()
        unlock_dto.project_id = 1
        unlock_dto.validated_tasks = validated_tasks
        unlock_dto.user_id = 12

        # Act / Assert
        with self.assertRaises(ValidatorServiceError):
            ValidatorService.unlock_tasks_after_validation(unlock_dto)
Пример #2
0
    def test_unlock_tasks_for_validation_raises_error_if_task_not_found(
            self, mock_task):
        # Arrange
        mock_task.return_value = None

        validated_task = ValidatedTask()
        validated_task.task_id = 1
        validated_tasks = [validated_task]

        unlock_dto = UnlockAfterValidationDTO()
        unlock_dto.project_id = 1
        unlock_dto.validated_tasks = validated_tasks

        # Act / Assert
        with self.assertRaises(NotFound):
            ValidatorService.unlock_tasks_after_validation(unlock_dto)
Пример #3
0
    def test_unlock_tasks_for_validation_raises_error_if_task_not_locked(
            self, mock_task):
        # Arrange
        self.unlock_task_stub.task_locked = False
        mock_task.return_value = self.unlock_task_stub

        validated_task = ValidatedTask()
        validated_task.task_id = 1
        validated_tasks = [validated_task]

        unlock_dto = UnlockAfterValidationDTO()
        unlock_dto.project_id = 1
        unlock_dto.validated_tasks = validated_tasks

        # Act / Assert
        with self.assertRaises(ValidatorServiceError):
            ValidatorService.unlock_tasks_after_validation(unlock_dto)