コード例 #1
0
ファイル: test.py プロジェクト: vicould/Crawler
class CrawlerTest(unittest.TestCase):
    def setUp(self):
        self.first_links = ['http://localhost/']
        self.crawler = Crawler(base_url=self.first_links)


    def test_initial_link(self):
        links = []
        result_queue = self.crawler.get_links_to_visit()
        try:
            while True:
                links.append(result_queue.get_nowait())
        except Empty:
            pass

        self.assertEqual(links, self.first_links)


    def test_protocol_failure(self):
        print '\nyou should soon have a CRITICAL log message'
        self.assertRaises(SystemExit, Crawler, base_url=['ftp://localhost'])
コード例 #2
0
ファイル: test.py プロジェクト: vicould/Crawler
 def setUp(self):
     self.first_links = ['http://localhost/']
     self.crawler = Crawler(base_url=self.first_links)