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