예제 #1
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)
예제 #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)
예제 #3
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)
 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)
예제 #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)
예제 #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)
예제 #7
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)