'Tests all comments retrieved have user profile image details if called in requested_fields'

def test_profile_image_requested_field(self):

    self.register_get_user_response(self.user)
    cs_comment_child = self.make_comment_data(u'test_child_comment', self.comment_id, children=[])
    cs_comment = self.make_comment_data(self.comment_id, None, [cs_comment_child])
    cs_thread = make_minimal_cs_thread({u'id': self.thread_id, u'course_id': unicode(self.course.id), u'children': [cs_comment]})
    self.register_get_thread_response(cs_thread)
    self.register_get_comment_response(cs_comment)
    self.create_profile_image(self.user, get_profile_image_storage())
    response = self.client.get(self.url, {u'requested_fields': u'profile_image'})
    self.assertEqual(response.status_code, 200)
    response_comments = json.loads(response.content)[u'results']
    for response_comment in response_comments:
        expected_profile_data = self.get_expected_user_profile(response_comment[u'author'])
        response_users = response_comment[u'users']
        self.assertEqual(expected_profile_data, response_users[response_comment[u'author']])
