Ejemplo n.º 1
0
 def test_meta_refresh_no_url_redirect(self):
     config = Configuration()
     config.follow_meta_refresh = True
     article = Article('', config=config)
     html = mock_resource_with('ap_meta_refresh', 'html')
     article.download(input_html=html)
     article.parse()
     self.assertEqual(article.title, 'News from The Associated Press')
Ejemplo n.º 2
0
 def test_meta_refresh_redirect(self):
     config = Configuration()
     config.follow_meta_refresh = True
     article = Article(
         '', config=config)
     html = mock_resource_with('google_meta_refresh', 'html')
     article.download(input_html=html)
     article.parse()
     self.assertEqual(article.title, 'Example Domain')
Ejemplo n.º 3
0
 def test_meta_refresh_no_url_redirect(self):
     config = Configuration()
     config.follow_meta_refresh = True
     article = Article(
         '', config=config)
     html = mock_resource_with('ap_meta_refresh', 'html')
     article.download(html=html)
     article.parse()
     self.assertEqual(article.title, 'News from The Associated Press')
Ejemplo n.º 4
0
 def test_meta_refresh_redirect(self):
     # TODO: We actually hit example.com in this unit test ... which is bad
     # Figure out how to mock an actual redirect
     config = Configuration()
     config.follow_meta_refresh = True
     article = Article('', config=config)
     html = mock_resource_with('google_meta_refresh', 'html')
     article.download(input_html=html)
     article.parse()
     self.assertEqual(article.title, 'Example Domain')
Ejemplo n.º 5
0
 def test_meta_refresh_redirect(self):
     # TODO: We actually hit example.com in this unit test ... which is bad
     # Figure out how to mock an actual redirect
     config = Configuration()
     config.follow_meta_refresh = True
     article = Article(
         '', config=config)
     html = mock_resource_with('google_meta_refresh', 'html')
     article.download(html=html)
     article.parse()
     self.assertEqual(article.title, 'Example Domain')
Ejemplo n.º 6
0
    def test_meta_refresh_no_url_redirect(self):
        config = Configuration()
        config.follow_meta_refresh = True
        article = Article(
            '', config=config)
        html = mock_resource_with('ap_meta_refresh', 'html')
        article.download(input_html=html)
        article.parse()
        self.assertEqual(article.title, 'News from The Associated Press')

# Err Fixed: Called before the first test case of this unit begins
        @print_test
        def test_pre_download_parse(self):

            article = Article(self.article.url)
            self.assertRaises(ArticleException, article.parse)