def test_lessthan(self): """ Tests that `<` in text context is handled properly """ self.assertEqual( OpenEndedChild.sanitize_html(self.text_lessthan_noencd), self.text_lessthan_encode)
def test_combined(self): """ tests a combination of inputs """ test_input = u"{}\n{}\n{}\n\n{}{}\n{}".format( self.link_text, self.text, self.script_dirty, self.embed_dirty, self.text_lessthan_noencd, self.img_dirty) test_output = u"{}<br/>{}<br/>{}<br/><br/>{}{}<br/>{}".format( self.link_atag, self.text, self.script_clean, self.embed_clean, self.text_lessthan_encode, self.img_clean) self.assertEqual(OpenEndedChild.sanitize_html(test_input), test_output)
def test_combined(self): """ tests a combination of inputs """ test_input = u"{}\n{}\n{}\n\n{}{}\n{}".format(self.link_text, self.text, self.script_dirty, self.embed_dirty, self.text_lessthan_noencd, self.img_dirty) test_output = u"{}<br/>{}<br/>{}<br/><br/>{}{}<br/>{}".format(self.link_atag, self.text, self.script_clean, self.embed_clean, self.text_lessthan_encode, self.img_clean) self.assertEqual(OpenEndedChild.sanitize_html(test_input), test_output)
def test_linkify(self): """ tests the replace_newlines function """ self.assertEqual(OpenEndedChild.sanitize_html(self.link_text), self.link_atag)
def test_lessthan(self): """ Tests that `<` in text context is handled properly """ self.assertEqual(OpenEndedChild.sanitize_html(self.text_lessthan_noencd), self.text_lessthan_encode)
def test_text(self): """ Test for passing through text unchanged, including unicode """ self.assertEqual(OpenEndedChild.sanitize_html(self.text), self.text)
def test_iframe(self): """ Basic test for passing through iframe, but stripping bad attr """ self.assertEqual(OpenEndedChild.sanitize_html(self.iframe_dirty), self.iframe_clean)
def test_embed(self): """ Basic test for passing through embed, but stripping bad attr """ self.assertEqual(OpenEndedChild.sanitize_html(self.embed_dirty), self.embed_clean)
def test_script(self): """ Basic test for stripping <script> """ self.assertEqual(OpenEndedChild.sanitize_html(self.script_dirty), self.script_clean)