'Tests that course block api returns student_view_data for discussion xblock'

def test_discussion_student_view_data(self):

    self.client.login(username=self.user.username, password='test')
    url = reverse('blocks_in_block_tree', kwargs={'usage_key_string': unicode(self.course_usage_key)})
    query_params = {'depth': 'all', 'username': self.user.username, 'block_types_filter': 'discussion', 'student_view_data': 'discussion'}
    response = self.client.get(url, query_params)
    self.assertEquals(response.status_code, 200)
    self.assertEquals(response.data['root'], unicode(self.course_usage_key))
    for (block_key_string, block_data) in response.data['blocks'].iteritems():
        block_key = deserialize_usage_key(block_key_string, self.course_key)
        self.assertEquals(block_data['id'], block_key_string)
        self.assertEquals(block_data['type'], block_key.block_type)
        self.assertEquals(block_data['display_name'], (self.store.get_item(block_key).display_name or ''))
        self.assertEqual(block_data['student_view_data'], {'topic_id': self.discussion_id})
