def test_get_parser_allowed(self):
        self.parser = resources.get_parser_for_html(VALID_PAGE_URL)
        content = self.parser.get_content()
        self.assertIn("Cogito ergo sum", content)

        with self.assertRaises(resources.URLNotParseableException):
            self.parser = resources.get_parser_for_html(BANNED_PAGE_URL)
            content = self.parser.get_content()
            self.assertNotIn("accessed", content)
Beispiel #2
0
    def test_get_parser_allowed(self):
        self.parser = resources.get_parser_for_html(VALID_PAGE_URL)
        content = self.parser.get_content()
        self.assertIn('Cogito ergo sum', content)

        with self.assertRaises(resources.URLNotParseableException):
            self.parser = resources.get_parser_for_html(BANNED_PAGE_URL)
            content = self.parser.get_content()
            self.assertNotIn('accessed', content)
    def test_unicode_page(self):
        self.parser = resources.get_parser_for_html(UNICODE_PAGE_URL)
        content = self.parser.get_content()
        self.assertIn("Paradox", content)

        title = self.parser.get_title()
        self.assertIn("Quoted string", title)
 def test_bad_urls(self):
     for url in ['http://', 'invalid.null', '//invalid.null', '//',
                 'invalid', '?test=1', 'invalid?test=1']:
         with self.assertRaises(resources.URLNotParseableException):
             self.parser = resources.get_parser_for_html(url)
             content = self.parser.get_content()
             self.assertNotIn('impsum', content)
Beispiel #5
0
    def test_unicode_page(self):
        self.parser = resources.get_parser_for_html(UNICODE_PAGE_URL)
        content = self.parser.get_content()
        self.assertIn('Paradox', content)

        title = self.parser.get_title()
        self.assertIn('Quoted string', title)
Beispiel #6
0
 def test_bad_urls(self):
     for url in [
             'http://', 'invalid.null', '//invalid.null', '//', 'invalid',
             '?test=1', 'invalid?test=1'
     ]:
         with self.assertRaises(resources.URLNotParseableException):
             self.parser = resources.get_parser_for_html(url)
             content = self.parser.get_content()
             self.assertNotIn('impsum', content)
 def test_bad_urls(self):
     for url in ["http://", "invalid.null", "//invalid.null", "//", "invalid", "?test=1", "invalid?test=1"]:
         with self.assertRaises(resources.URLNotParseableException):
             self.parser = resources.get_parser_for_html(url)
             content = self.parser.get_content()
             self.assertNotIn("impsum", content)