Exemple #1
0
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
Exemple #2
0
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'
Exemple #3
0
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'
Exemple #4
0
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