Esempio n. 1
0
    def test_method_attach(self):
        """Scraper attach method to create driver.

        The state attached will be True.
        """
        scraper = Scraper()

        scraper.scraper_attach()

        assert scraper.attached is True
Esempio n. 2
0
 def test_scraper_method_chaining(self):
     """Scraper's method"""
     scraper = Scraper()
     assert isinstance(scraper.scraper_attach(), Scraper)
     assert isinstance(scraper.scraper_detach(), Scraper)
     assert isinstance(scraper.scraper_clear(), Scraper)
     assert isinstance(scraper.scraper_restart(), Scraper)
Esempio n. 3
0
    def test_method_detach(self):
        """Scraper detach method to destroy driver."""
        scraper = Scraper()
        scraper.scraper_attach()
        assert scraper.attached is True

        scraper.scraper_detach()

        assert scraper.attached is False
Esempio n. 4
0
    def test_initial_attach(self):
        """Initial with scraper_attach()"""
        scraper = Scraper(attach=True)

        assert scraper.attached is True
Esempio n. 5
0
 def test_initial(self):
     Scraper()
Esempio n. 6
0
    def test_attribute_activated(self):
        """The default attached is False."""
        scraper = Scraper()

        assert scraper.attached is False
Esempio n. 7
0
 def scraping(self, task: Task, scraper: Scraper) -> str:
     return scraper.get(url=task.url)