diff --git a/lms/djangoapps/discussion_api/api.py b/lms/djangoapps/discussion_api/api.py index a14bcae278..2b4c7e9bbc 100644 --- a/lms/djangoapps/discussion_api/api.py +++ b/lms/djangoapps/discussion_api/api.py @@ -85,11 +85,7 @@ def _get_comment_and_context(request, comment_id): """ try: cc_comment = Comment(id=comment_id).retrieve() - _, context = _get_thread_and_context( - request, - cc_comment["thread_id"], - cc_comment["parent_id"] - ) + _, context = _get_thread_and_context(request, cc_comment["thread_id"]) return cc_comment, context except CommentClientRequestError: raise Http404 diff --git a/lms/djangoapps/discussion_api/tests/test_api.py b/lms/djangoapps/discussion_api/tests/test_api.py index be157a4273..663e02824a 100644 --- a/lms/djangoapps/discussion_api/tests/test_api.py +++ b/lms/djangoapps/discussion_api/tests/test_api.py @@ -1689,13 +1689,14 @@ class UpdateCommentTest(CommentsServiceMockMixin, UrlResetMixin, ModuleStoreTest for request in httpretty.httpretty.latest_requests: self.assertEqual(request.method, "GET") - def test_basic(self): - self.register_comment() + @ddt.data(None, "test_parent") + def test_basic(self, parent_id): + self.register_comment({"parent_id": parent_id}) actual = update_comment(self.request, "test_comment", {"raw_body": "Edited body"}) expected = { "id": "test_comment", "thread_id": "test_thread", - "parent_id": None, # TODO: we can't get this without retrieving from the thread :-( + "parent_id": parent_id, "author": self.user.username, "author_label": None, "created_at": "2015-06-03T00:00:00Z",