'Test for calling get_preview_html. Ensures data-usage-id is correctly set and
asides are correctly excluded because they are not enabled.'

@XBlockAside.register_temp_plugin(AsideTestType, 'test_aside')
def test_preview_no_asides(self):

    course = CourseFactory.create(default_store=ModuleStoreEnum.Type.split)
    html = ItemFactory.create(parent_location=course.location, category='html', data={'data': '<html>foobar</html>'})
    config = StudioConfig.current()
    config.enabled = False
    config.save()
    request = RequestFactory().get('/dummy-url')
    request.user = UserFactory()
    request.session = {}
    context = {'reorderable_items': set(), 'read_only': True}
    html = get_preview_fragment(request, html, context).content
    self.assertNotRegexpMatches(html, 'data-block-type=[\\"\\\']test_aside[\\"\\\']')
    self.assertNotRegexpMatches(html, 'Aside    rendered')
