def test_givenHTMLWithMultipleApartmentPlacardsReturnListWithMultipleApartments( self): html_soup = Scraper.get_html_text(self.test_response) apartments = Scraper.parse_soup_for_placards(html_soup) self.assertEqual(3, len(apartments))
def test_givenHTMLResponseReturnsABeautifulSoupObject(self): html_soup = Scraper.get_html_text(self.test_response) self.assertIs(type(html_soup), BeautifulSoup)
def test_givenHTMLWithApartmentPlacardReturnListWithOneApartment(self): html_soup = Scraper.get_html_text(self.test_response) apartment = Scraper.parse_soup_for_placards(html_soup)[0] self.assertEqual(self.test_apartment.url, apartment.url) self.assertEqual(self.test_apartment.location, apartment.location) self.assertEqual(self.test_apartment.rent, apartment.rent)
def test_givenBlankResponseReturnBlankString(self): html_soup = '' self.assertEqual('', Scraper.get_html_text(html_soup))