def test_parse_all_links_using_links_tag_parser_in_page_for_the_given_url( self): page_url = "http://asamplepage.com" html_content = "An html page with links" page_links = [ Link(url="/about", label="A link", parent_url="http://asamplepage.com"), Link("http://aurl.com", "A link", parent_url="http://asamplepage.com") ] mock_client = mock() mock_parser = mock() when(mock_client).get_html_page(page_url).thenReturn(html_content) when(mock_parser).parse(ANY(LinkTagParser), eq(html_content)).thenReturn(page_links) scraper = LinkScraper(mock_client, mock_parser) links = scraper.scrape_links(page_url) self.assertEquals(2, len(links)) self.assertCountEqual(page_links, links)
def testShouldNotSatisfyIfArgDoesNotMatchGivenValue(self): self.assertFalse(eq("foo").matches("bar"))
def testShouldSatisfyIfArgMatchesGivenValue(self): self.assertTrue(eq("foo").matches("foo"))