def new_discussion_comment_core(session, member, user, project, discussion, content, log=regular_log.default()): """ Creates a new comment. At this point we assume data has been validated so no extra checks are done to the input data. :param session: :param log: :param member: :param project: :param discussion: :param content: :return: """ comment = DiscussionComment.new(session=session, content=content, member_created_id=member.id, project_id=project.id, user_id=user.id if user else None, member_updated_id=member.id, discussion_id=discussion.id) comment_data = comment.serialize() return comment_data, log
def test_new(self): # Create mock issue discussion = data_mocking.create_discussion( { 'project_id': self.project.id, 'name': 'test', 'title': 'test', }, self.session, ) content = 'thecontent' issue_comment = DiscussionComment.new(session=self.session, content=content, discussion_id=discussion.id) self.assertIsNotNone(issue_comment) self.assertEqual(issue_comment.content, content) self.assertEqual(issue_comment.discussion_id, discussion.id)