'Test that the xblocks data is calculated correctly.'

@ddt.data(('course',), ('other_course',))
@ddt.unpack
def test_calculate_course_xblocks_data(self, course_attr):

    course = getattr(self, course_attr)
    blocks_data = _calculate_course_xblocks_data(course.id)
    expected_cache_data = getattr(self, (course_attr + '_expected_cache_data'))
    for (usage_key, __) in expected_cache_data.items():
        for (path_index, path) in enumerate(blocks_data[unicode(usage_key)]['paths']):
            for (path_item_index, path_item) in enumerate(path):
                self.assertEqual(path_item['usage_key'], expected_cache_data[usage_key][path_index][path_item_index])
