def test_wash_html_to_text(self):
        """webalert - stripping HTML markup for alert emails"""
        htparser = RecordHTMLParser()
        htparser.feed('''<style type="text/css">
                    <!--
                       div.thumbMosaic {display:inline;}
                       div.thumbMosaic span{display:none;}
                       div.thumbMosaic:hover span{display:inline;position:absolute;}
                     -->
                     </style><!--START_NOT_FOR_TEXT--><strong>Abracadabra!</strong><!--END_NOT_FOR_TEXT--><br/><a class="moreinfo" href="%(CFG_SITE_URL)s">Detailed Record</a>''' % {'CFG_SITE_URL': CFG_SITE_URL})

        self.assertEqual('\nDetailed record : <%s>' % CFG_SITE_URL, htparser.result)
예제 #2
0
    def test_wash_html_to_text(self):
        """webalert - stripping HTML markup for alert emails"""
        htparser = RecordHTMLParser()
        htparser.feed('''<style type="text/css">
                    <!--
                       div.thumbMosaic {display:inline;}
                       div.thumbMosaic span{display:none;}
                       div.thumbMosaic:hover span{display:inline;position:absolute;}
                     -->
                     </style><!--START_NOT_FOR_TEXT--><strong>Abracadabra!</strong><!--END_NOT_FOR_TEXT--><br/><a class="moreinfo" href="%(CFG_SITE_URL)s">Detailed Record</a>''' % {'CFG_SITE_URL': CFG_SITE_URL})

        self.assertEqual('\nDetailed record : <%s>' % CFG_SITE_URL, htparser.result)
 def test_character_ref_conversion(self):
     """webalert - convert character reference to text (Eg: '&#97;' -> 'a')"""
     htparser = RecordHTMLParser()
     htparser.feed('&#80;ython is co&#111;l')
     self.assertEqual('Python is cool', htparser.result)
 def test_entity_ref_conversion(self):
     """webalert - convert entity reference to text (Eg: '&lt;' -> '<')"""
     htparser = RecordHTMLParser()
     htparser.feed('<strong>a &lt; b &gt; c</strong> &copy;CERN')
     self.assertEqual('a < b > c ©CERN', htparser.result)
예제 #5
0
 def test_character_ref_conversion(self):
     """webalert - convert character reference to text (Eg: '&#97;' -> 'a')"""
     htparser = RecordHTMLParser()
     htparser.feed('&#80;ython is co&#111;l')
     self.assertEqual('Python is cool', htparser.result)
예제 #6
0
 def test_entity_ref_conversion(self):
     """webalert - convert entity reference to text (Eg: '&lt;' -> '<')"""
     htparser = RecordHTMLParser()
     htparser.feed('<strong>a &lt; b &gt; c</strong> &copy;CERN')
     self.assertEqual('a < b > c ©CERN', htparser.result)