'Tests profile_image in requested_fields for thread created with anonymous user'

def test_profile_image_requested_field_anonymous_user(self):

    source_threads = [self.create_source_thread({u'user_id': None, u'username': None, u'anonymous': True, u'anonymous_to_peers': True})]
    self.register_get_user_response(self.user, upvoted_ids=[u'test_thread'])
    self.register_get_threads_response(source_threads, page=1, num_pages=1)
    response = self.client.get(self.url, {u'course_id': unicode(self.course.id), u'requested_fields': u'profile_image'})
    self.assertEqual(response.status_code, 200)
    response_thread = json.loads(response.content)[u'results'][0]
    self.assertIsNone(response_thread[u'author'])
    self.assertEqual({}, response_thread[u'users'])
