def test_name_with_numbers(): """ Tests get_url function on drug name with numbers """ scraper = DrugsScraper() url = scraper.get_url('B3-500-Gr') assert url == 'https://www.drugs.com/comments/niacin/b3-500-gr.html'
def test_short_drug_name(): """ Tests that the get_url function does not search for drug names shorter than 4 characters """ scraper = DrugsScraper() url = scraper.get_url('ACE') assert not url
def test_url_fake_drug_name(): """ Tests that the get_url function returns 'None' for a drug name that does not have a review page """ scraper = DrugsScraper() url = scraper.get_url('garbage') assert not url
def test_drug_name_with_space(): """ Tests that the get_url function returns the correct url for a drug name with a space in it """ scraper = DrugsScraper() url = scraper.get_url('Advair Diskus') assert url == 'https://www.drugs.com/comments/fluticasone-salmeterol/advair-diskus.html'
def test_get_url_real_drug_name(): """ Tests that the get_url function returns the correct url for a standard drug name ('actos') """ scraper = DrugsScraper() url = scraper.get_url('actos') assert url == 'https://www.drugs.com/comments/pioglitazone/actos.html'