def test_short_drug_name(): """ Tests that the get_url function does not search for drug names shorter than 4 characters """ scraper = DrugRatingzScraper() url = scraper.get_url('ACE') assert not url
def test_get_url_real_drug_name(): """ Tests that the get_url function returns the correct url for a standard drug name ('actos') """ scraper = DrugRatingzScraper() url = scraper.get_url('actos') assert url == 'https://www.drugratingz.com/reviews/340/Drug-Actos.html'
def test_drug_name_with_space(): """ Tests that the get_url function returns the correct url for a drug name that includes a space """ scraper = DrugRatingzScraper() url = scraper.get_url('Ortho Tri-Cyclen Lo ') assert url == 'https://www.drugratingz.com/reviews/163/Drug-Ortho-Tri-Cyclen-Lo.html'
def test_url_fake_drug_name(): """ Tests tha the get_url function returns 'None' for a drug name that does not have a review page """ scraper = DrugRatingzScraper() url = scraper.get_url('garbage') assert not url