Skip to content

Commit

Permalink
test: [AXM-571] fix failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NiedielnitsevIvan committed Jun 3, 2024
1 parent 2c48e8d commit 8affef1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lms/djangoapps/discussion/signals/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def create_message_context(comment, site):
'comment_body_text': comment.body_text,
'comment_author_id': comment.user_id,
'comment_created_at': comment.created_at, # comment_client models dates are already serialized
'comment_parent_id': getattr(comment, 'parent_id', ''),
'comment_parent_id': comment.parent_id,
'thread_id': thread.id,
'thread_title': thread.title,
'thread_author_id': thread.user_id,
Expand Down
6 changes: 3 additions & 3 deletions lms/djangoapps/discussion/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _should_send_subcomment_message(context):


def _comment_author_is_thread_author(context):
return context['comment_author_id'] == context['thread_author_id']
return context.get('comment_author_id', '') == context['thread_author_id']


def _is_content_still_reported(context):
Expand Down Expand Up @@ -267,9 +267,9 @@ def _build_message_context(context, notification_type='forum_comment'): # lint-
'post_link': post_link,
'push_notification_extra_context': {
'course_id': str(context['course_id']),
'parent_id': str(context.get('comment_parent_id', '')),
'parent_id': str(context['comment_parent_id']),
'notification_type': notification_type,
'topic_id': str(context.get('thread_commentable_id', '')),
'topic_id': str(context['thread_commentable_id']),
'thread_id': context['thread_id'],
'comment_id': context['comment_id'],
},
Expand Down
3 changes: 3 additions & 0 deletions lms/djangoapps/discussion/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def test_send_discussion_email_notification(self, user_subscribed):
'comment_body_text': comment.body_text,
'comment_created_at': ONE_HOUR_AGO,
'comment_id': comment['id'],
'comment_parent_id': comment['parent_id'],
'comment_username': self.comment_author.username,
'course_id': self.course.id,
'thread_author_id': self.thread_author.id,
Expand All @@ -292,6 +293,8 @@ def test_send_discussion_email_notification(self, user_subscribed):
'push_notification_extra_context': {
'notification_type': 'forum_response',
'topic_id': thread['commentable_id'],
'course_id': comment['course_id'],
'parent_id': str(comment['parent_id']),
'thread_id': thread['id'],
'comment_id': comment['id'],
},
Expand Down

0 comments on commit 8affef1

Please sign in to comment.