Fix bug in discussion API comment update

This bug caused any attempt to update a comment with a non-null
parent_id to result in a 500 error without applying the update. The bug
was introduced in commit 2c7590d197.
This commit is contained in:
Greg Price
2015-06-12 22:19:01 -04:00
parent 5ceea7a0a9
commit 3c48585c8e
2 changed files with 5 additions and 8 deletions

View File

@@ -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",