'Checks that html for the StructuredTagsAside is generated correctly'

def test_preview_html(self):

    request = RequestFactory().get('/dummy-url')
    request.user = UserFactory()
    request.session = {}
    context = {'reorderable_items': set(), 'read_only': True}
    problem_html = get_preview_fragment(request, self.problem, context).content
    parser = etree.HTMLParser()
    tree = etree.parse(StringIO(problem_html), parser)
    main_div_nodes = tree.xpath('/html/body/div/section/div')
    self.assertEquals(len(main_div_nodes), 1)
    div_node = main_div_nodes[0]
    self.assertEquals(div_node.get('data-init'), 'StructuredTagsInit')
    self.assertEquals(div_node.get('data-runtime-class'), 'PreviewRuntime')
    self.assertEquals(div_node.get('data-block-type'), 'tagging_aside')
    self.assertEquals(div_node.get('data-runtime-version'), '1')
    self.assertIn('xblock_asides-v1', div_node.get('class'))
    select_nodes = div_node.xpath("div//select[@multiple='multiple']")
    self.assertEquals(len(select_nodes), 2)
    select_node1 = select_nodes[0]
    self.assertEquals(select_node1.get('name'), self.aside_tag_dif)
    option_nodes1 = select_node1.xpath('option')
    self.assertEquals(len(option_nodes1), 3)
    option_values1 = [opt_elem.text for opt_elem in option_nodes1]
    self.assertEquals(option_values1, ['Easy', 'Hard', 'Medium'])
    select_node2 = select_nodes[1]
    self.assertEquals(select_node2.get('name'), self.aside_tag_lo)
    self.assertEquals(select_node2.get('multiple'), 'multiple')
    option_nodes2 = select_node2.xpath('option')
    self.assertEquals(len(option_nodes2), 3)
    option_values2 = [opt_elem.text for opt_elem in option_nodes2 if opt_elem.text]
    self.assertEquals(option_values2, ['Learned    a    few    things', 'Learned    everything', 'Learned    nothing'])
    self.assertNotRegexpMatches(problem_html, 'data-block-type=[\\"\\\']acid_aside[\\"\\\']')
    video_html = get_preview_fragment(request, self.video, context).content
    self.assertNotRegexpMatches(video_html, '<select')
