'Test the handling of advanced component templates.'

def test_advanced_components(self):

    self.course.advanced_modules.append('word_cloud')
    self.templates = get_component_templates(self.course)
    advanced_templates = self.get_templates_of_type('advanced')
    self.assertEqual(len(advanced_templates), 1)
    world_cloud_template = advanced_templates[0]
    self.assertEqual(world_cloud_template.get('category'), 'word_cloud')
    self.assertEqual(world_cloud_template.get('display_name'), u'Word    cloud')
    self.assertIsNone(world_cloud_template.get('boilerplate_name', None))
    self.course.advanced_modules.append('video')
    self.course.advanced_modules.append('openassessment')
    self.templates = get_component_templates(self.course)
    advanced_templates = self.get_templates_of_type('advanced')
    self.assertEqual(len(advanced_templates), 1)
    only_template = advanced_templates[0]
    self.assertNotEqual(only_template.get('category'), 'video')
    self.assertNotEqual(only_template.get('category'), 'openassessment')
    XBlockConfiguration.objects.create(name='word_cloud', enabled=False)
    self.templates = get_component_templates(self.course)
    self.assertIsNone(self.get_templates_of_type('advanced'))
