From cc73bc0b61e6a5db71bcfa40ce5d58c3d3974e5d Mon Sep 17 00:00:00 2001 From: Brian Beggs Date: Mon, 28 Sep 2015 21:03:19 -0400 Subject: [PATCH] added test to discussions_api client to test JSON response that is absent of the resp_total key --- lms/djangoapps/discussion_api/tests/test_serializers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lms/djangoapps/discussion_api/tests/test_serializers.py b/lms/djangoapps/discussion_api/tests/test_serializers.py index 365c7fbdca..56e16f1c12 100644 --- a/lms/djangoapps/discussion_api/tests/test_serializers.py +++ b/lms/djangoapps/discussion_api/tests/test_serializers.py @@ -257,6 +257,12 @@ class ThreadSerializerSerializationTest(SerializerTestMixin, SharedModuleStoreTe serialized = self.serialize(Thread(id=thread_data["id"])) self.assertEqual(serialized["response_count"], 2) + def test_response_count_missing(self): + thread_data = self.make_cs_content({}) + del thread_data["resp_total"] + self.register_get_thread_response(thread_data) + serialized = self.serialize(Thread(id=thread_data["id"])) + self.assertIsNone(serialized["response_count"], None) @ddt.ddt class CommentSerializerTest(SerializerTestMixin, SharedModuleStoreTestCase):