def test_dao_modify_comment(self): self.create_task_comment() TaskCommentDAO.modify_comment(user_id=1, _id=1, task_id=1, relation_id=2, comment="modified comment") # Verify that task comment was modified task_comment = TaskCommentDAO.get_task_comment(1, 1)[0] self.assertTrue(task_comment is not None) self.assertTrue(task_comment.id is not None) self.assertTrue(task_comment.task_id == 1) self.assertIsNotNone(task_comment.creation_date) self.assertIsNotNone(task_comment.creation_date) self.assertEqual(task_comment.comment, "modified comment")
def put(cls, relation_id, task_id, comment_id): """ Modifies the task comment. """ data = request.json is_valid = validate_task_comment_request_data(data) if is_valid != {}: return is_valid, HTTPStatus.BAD_REQUEST comment = data["comment"] return TaskCommentDAO.modify_comment(get_jwt_identity(), comment_id, task_id, relation_id, comment)