def get(self): """ Gets any locked task on the project for the logged in user --- tags: - mapping produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== responses: 200: description: Task user is working on 401: description: Unauthorized - Invalid credentials 404: description: User is not working on any tasks 500: description: Internal Server Error """ try: locked_tasks = ProjectService.get_task_for_logged_in_user( token_auth.current_user()) return locked_tasks.to_primitive(), 200 except Exception as e: error_msg = f"UsersQueriesOwnLockedAPI - unhandled error: {str(e)}" current_app.logger.critical(error_msg) return {"Error": error_msg}, 500
def test_user_not_permitted_to_map_if_already_locked_tasks( self, mock_project, mock_user_tasks ): # Arrange mock_project.return_value = Project() mock_user_tasks.return_value = LockedTasksForUser() # Act / Assert self.assertFalse(ProjectService.get_task_for_logged_in_user(1).locked_tasks)