mirror of
https://github.com/simon987/Simple-Incremental-Search-Tool.git
synced 2025-04-19 02:06:45 +00:00
23 lines
626 B
Python
23 lines
626 B
Python
from unittest import TestCase
|
|
|
|
from parsing import GenericFileParser, Sha1CheckSumCalculator, ExtensionMimeGuesser
|
|
from crawler import Crawler
|
|
|
|
|
|
class CrawlerTest(TestCase):
|
|
|
|
def test_dir_walk(self):
|
|
c = Crawler([GenericFileParser([Sha1CheckSumCalculator()], ExtensionMimeGuesser())])
|
|
|
|
c.crawl("test_folder")
|
|
|
|
self.assertEqual(len(c.documents), 28)
|
|
|
|
def test_get_parser_by_ext(self):
|
|
|
|
c = Crawler([GenericFileParser([Sha1CheckSumCalculator()], ExtensionMimeGuesser())])
|
|
|
|
self.assertIsInstance(c.get_parser_by_ext("any"), GenericFileParser)
|
|
|
|
# todo add more parsers here
|