'A ClearableFileInput should escape name, filename and URL when
rendering HTML. Refs #15182.'

def test_html_escaped(self):

    @python_2_unicode_compatible
    class StrangeFieldFile(object, ):
        url = u'something?chapter=1&sect=2&copy=3&lang=en'
        def __str__(self):
            return u'something<div    onclick="alert(\'oops\')">.jpg'
    widget = ClearableFileInput()
    field = StrangeFieldFile()
    output = widget.render(u'my<div>file', field)
    self.assertFalse((field.url in output))
    self.assertTrue((u'href="something?chapter=1&amp;sect=2&amp;copy=3&amp;lang=en"' in output))
    self.assertFalse((six.text_type(field) in output))
    self.assertTrue((u'something&lt;div    onclick=&quot;alert(&#39;oops&#39;)&quot;&gt;.jpg' in output))
    self.assertTrue((u'my&lt;div&gt;file' in output))
    self.assertFalse((u'my<div>file' in output))
