def test_scrape_chapter_contents(self): chapter = Chapter( "Prologue", "https://forums.spacebattles.com/threads/the-last-angel.244209/#post-9354450" ) Scraper.scrape_chapter_contents(chapter) self.assertIsNotNone(chapter.text)
def test_filter_chapters(self): soup = self.tla_scraper.get_toc_as_soup() all_links = self.tla_scraper.get_links_from_soup(soup) all_chapters = Scraper.links_to_chapters(all_links) filtered_chapters = self.tla_scraper.filter_chapters(all_chapters) self.assertIsNotNone(filtered_chapters) self.assertEqual(48, len(filtered_chapters))
def test_get_page_as_soup_not_null(self): self.assertIsNotNone(Scraper.get_page_as_soup(self.GOOGLE_URL))
def test_links_to_chapters(self): soup = Scraper.get_page_as_soup(self.GOOGLE_URL) chapters = Scraper.get_links_from_soup(soup) self.assertIsNotNone(chapters) self.assertEqual(21, len(chapters))
def __init__(self, name, data, pk): Scraper.__init__(self, name) self.name = name self.data = data # Pk is unique identifier of object that will be updated self.pk = pk
def __init__(self, name, data, **kwargs): Scraper.__init__(self, name) self.data = data