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