from datetime import timedelta

import pytest
import requests
import requests_cache


requests_cache.install_cache(
    'redirect_cache',
    expire_after=timedelta(days=1)
)


BASE_URL = 'https://cg-dae9433e-23a0-46d7-bafb-dc79d2d3756c.app.cloud.gov/preview/18f/cv_faq/flatten-question-urls'

URLS = [
    # f'{BASE_URL}/animals/',
    # f'{BASE_URL}/basics/',
    # f'{BASE_URL}/community-events/',
    # f'{BASE_URL}/financial-help/',
    # f'{BASE_URL}/food-safety/',
    # f'{BASE_URL}/funerals/',
    # f'{BASE_URL}/keeping-home-safe/',
    # f'{BASE_URL}/medications/',
    # f'{BASE_URL}/parents-and-children/',
    # f'{BASE_URL}/pregnancy/',
    # f'{BASE_URL}/protect-yourself/',
    # f'{BASE_URL}/rumors/',
    # f'{BASE_URL}/spread/',
    # f'{BASE_URL}/support-for-business/',
    # f'{BASE_URL}/symptoms-and-testing/',
    # f'{BASE_URL}/travel/',
    # f'{BASE_URL}/underlying-conditions/',
    # f'{BASE_URL}/water-transmission/',
    f'{BASE_URL}/community-events/information-that-i-can-share-with-attendees-about-covid-19/',
    f'{BASE_URL}/community-events/steps-to-take-if-attendee-or-event-staff-develops-covid-19/',
    f'{BASE_URL}/community-events/things-to-consider-when-deciding-to-postpone-or-cancel-events/',
    f'{BASE_URL}/community-events/what-actions-staff-and-attendees-can-take-to-prevent-covid-19/',
    f'{BASE_URL}/community-events/what-actions-to-take-to-plan-for-outbreak/',
    f'{BASE_URL}/community-events/what-is-the-best-way-to-clean-event-space-after-confirmed-case-of-covid-19-at-an-event/',
    f'{BASE_URL}/community-events/when-does-the-cdc-recommend-i-cancel-or-postpone-events/',
    f'{BASE_URL}/spread/will-warm-weather-stop-the-outbreak-of-covid-19/',
    f'{BASE_URL}/keeping-home-safe/soap-or-hand-sanitizer/',
    f'{BASE_URL}/keeping-home-safe/which-cleaning-products/',
    f'{BASE_URL}/animals/do-i-need-to-get-my-pet-tested/',
    f'{BASE_URL}/animals/what-about-imported-animals-or-animal-products/',
    f'{BASE_URL}/animals/what-precautions-with-imported-animals/',
    f'{BASE_URL}/funerals/am-i-at-risk-funeral/',
    f'{BASE_URL}/funerals/am-i-at-risk-touch-body/',
    f'{BASE_URL}/funerals/what-do-funeral-home-workers-need-to-know/',
    f'{BASE_URL}/parents-and-children/while-school-is-out-should-i-limit-time-with-older-adults/',
    f'{BASE_URL}/parents-and-children/while-school-is-out-will-kids-have-access-to-meals/',
    f'{BASE_URL}/protect-yourself/is-it-okay-to-donate-blood/',
    f'{BASE_URL}/protect-yourself/what-should-people-at-higher-risk-of-serious-illness-with-covid-19-do/',
    f'{BASE_URL}/spread/can-someone-who-has-had-covid-19-spread-the-illness-to-others/',
    f'{BASE_URL}/symptoms-and-testing/can-a-person-test-negative-and-later-test-positive-for-covid-19/',
    f'{BASE_URL}/symptoms-and-testing/where-can-i-get-tested/',
    f'{BASE_URL}/underlying-conditions/are-people-with-disabilities-at-higher-risk/',
    f'{BASE_URL}/underlying-conditions/how-were-the-underlying-conditions-selected/',
    f'{BASE_URL}/underlying-conditions/what-about-underlying-medical-conditions-that-are-not-included-on-this-list/',
    f'{BASE_URL}/underlying-conditions/what-does-more-sever-illness-mean/',
    f'{BASE_URL}/underlying-conditions/what-does-well-controlled-mean/',
    f'{BASE_URL}/rumors/is-there-a-national-lockdown/',
    f'{BASE_URL}/travel/will-read-id-implementation-be-delayed/',
    f'{BASE_URL}/travel/return-to-work-international-travel/',
    f'{BASE_URL}/travel/should-i-go-on-a-cruise/',
    f'{BASE_URL}/travel/sick-passenger-on-my-flight/',
    f'{BASE_URL}/travel/what-can-i-expect-when-arriving-to-the-united-states/',
    f'{BASE_URL}/travel/what-can-i-expect-when-departing-other-countries/',
    f'{BASE_URL}/travel/what-if-i-recently-traveled-and-get-sick/',
    f'{BASE_URL}/travel/what-is-the-risk-of-getting-covid-19-on-an-airplane/',
    f'{BASE_URL}/keeping-home-safe/should-i-make-my-own-hand-sanitizer/',
    f'{BASE_URL}/spread/can-mosquitoes-spread-covid19/',
    f'{BASE_URL}/basics/is-there-a-list-of-essential-industries/',
    f'{BASE_URL}/basics/what-are-essential-industries/',
    f'{BASE_URL}/community-events/do-i-need-to-cancel-if-there-are-confirmed-covid19-cases/',
    f'{BASE_URL}/financial-help/how-will-the-irs-know-where-to-send/',
    f'{BASE_URL}/financial-help/i-need-to-file-a-tax-return/',
    f'{BASE_URL}/financial-help/what-should-i-do-if-i-receive-calls-claiming-to-be-from-the-treasury-department/',
    f'{BASE_URL}/financial-help/where-can-i-go-for-more-information/',
    f'{BASE_URL}/rumors/is-the-federal-government-mandating-businesses-to-close/',
    f'{BASE_URL}/support-for-business/can-the-sba-help-me-with-other-assistance/',
    f'{BASE_URL}/support-for-business/what-capital-assistance-is-available-to-small-business-owners/',
    f'{BASE_URL}/support-for-business/where-should-a-small-business-go-to-find-help/',
    f'{BASE_URL}/support-for-business/when-are-taxes-due-for-alcohol-tobacco-firearms-ammunition-businesses/',
    f'{BASE_URL}/travel/are-the-northern-southern-us-borders-closed/',
    f'{BASE_URL}/travel/are-undocumented-immigrants-still-being-held/',
    f'{BASE_URL}/financial-help/if-i-receive-social-security-benefits/',
    f'{BASE_URL}/support-for-business/employee-retention-credit/',
    f'{BASE_URL}/support-for-business/small-medium-businesses-paid-leave/',
    f'{BASE_URL}/financial-help/will-the-irs-call-or-email-me/',
    f'{BASE_URL}/travel/should-travelers-wear-facemasks/',
    f'{BASE_URL}/water-transmission/additional-information-about-water-transmission-and-covid-19/',
    f'{BASE_URL}/water-transmission/if-utility-issued-boil-water-advisory-can-i-use-tap-water-to-wash-hands/',
    f'{BASE_URL}/animals/can-i-get-covid-19-from-my-pets/',
    f'{BASE_URL}/basics/why-might-someone-create-stigma/',
    f'{BASE_URL}/underlying-conditions/who-is-at-higher-risk-for-serious-illness-from-covid-19/',
    f'{BASE_URL}/rumors/is-5g-phone-technology-linked/',
    f'{BASE_URL}/rumors/on-medicare-and-someone-offered-me-a-test/',
    f'{BASE_URL}/protect-yourself/is-contact-lens-disinfecting-solution-effective-against-covid-19/',
    f'{BASE_URL}/protect-yourself/should-contact-lens-wearers-take-extra-precaustions/',
    f'{BASE_URL}/financial-help/how-do-i-submit-banking-information/',
    f'{BASE_URL}/underlying-conditions/are-there-any-medications-i-should-avoid/',
    f'{BASE_URL}/animals/can-i-walk-my-dog/',
    f'{BASE_URL}/animals/what-should-i-do-if-my-pet-gets-sick/',
    f'{BASE_URL}/animals/why-are-animals-being-tested-when-people-cant/',
    f'{BASE_URL}/animals/are-there-any-approved-products-to-prevent-covid-19-in-animals/',
    f'{BASE_URL}/animals/are-there-going-to-be-animal-drug-shortages/',
    f'{BASE_URL}/animals/if-my-pet-has-been-vaccinated-for-species-specific-cornavirus/',
    f'{BASE_URL}/animals/is-it-true-animals-get-their-own-types-of-virus/',
    f'{BASE_URL}/animals/is-the-animal-food-supply-safe/',
    f'{BASE_URL}/animals/my-pet-has-health-problems/',
    f'{BASE_URL}/animals/will-there-be-animal-food-shortages/',
    f'{BASE_URL}/basics/what-treatments-are-available/',
    f'{BASE_URL}/financial-help/how-do-i-know-if-i-am-an-essential-worker/',
    f'{BASE_URL}/food-safety/are-food-products-a-risk-for-spread/',
    f'{BASE_URL}/food-safety/can-i-get-coronavirus-from-food/',
    f'{BASE_URL}/food-safety/is-the-food-supply-safe/',
    f'{BASE_URL}/food-safety/will-there-be-food-shortages/',
    f'{BASE_URL}/medications/am-i-at-risk-from-taking-fda-approved-drugs-made-in-china/',
    f'{BASE_URL}/medications/are-antibiotics-effective/',
    f'{BASE_URL}/medications/are-there-any-approved-medicines/',
    f'{BASE_URL}/medications/are-there-going-to-be-drug-shortages/',
    f'{BASE_URL}/medications/should-i-take-ivermectin/',
    f'{BASE_URL}/medications/what-is-fda-doing-to-protect-people-from-fraud/',
    f'{BASE_URL}/medications/will-miracle-mineral-solution-cure-covid-19/',
    f'{BASE_URL}/protect-yourself/can-disinfectant-sprays-or-wipes-be-used-on-my-skin/',
    f'{BASE_URL}/protect-yourself/what-if-i-get-a-rash-hand-sanitizer/',
    f'{BASE_URL}/rumors/i-built-a-diy-ventilator-may-i-sell-it/',
    f'{BASE_URL}/rumors/products-online-claim-to-prevent-or-treat/',
    f'{BASE_URL}/spread/can-i-donate-convalescent-plasma/',
    f'{BASE_URL}/spread/can-i-get-covid-19-from-a-food-worker/',
    f'{BASE_URL}/spread/can-the-virus-be-transmitted-by-blood-transfusion/',
    f'{BASE_URL}/spread/should-ill-food-workers-stay-home/',
    f'{BASE_URL}/symptoms-and-testing/how-are-people-tested/',
    f'{BASE_URL}/symptoms-and-testing/why-arent-blood-centers-testing/',
    f'{BASE_URL}/financial-help/how-can-i-check-the-status-of-my-economic-impact-payment/',
    f'{BASE_URL}/protect-yourself/how-to-keep-myself-safe-when-i-go-grocery-store/',
    f'{BASE_URL}/animals/can-animals-carry-the-virus/',
    f'{BASE_URL}/animals/can-i-travel-to-the-us-with-dogs/',
    f'{BASE_URL}/animals/should-avoid-contact-with-pets/',
    f'{BASE_URL}/parents-and-children/additional-steps-child-special-healthcare-need/',
    f'{BASE_URL}/parents-and-children/child-with-special-healthcare-need-higher-risk/',
    f'{BASE_URL}/parents-and-children/how-can-my-family-cope-with-added-stress/',
    f'{BASE_URL}/parents-and-children/what-if-child-needs-to-go-to-hospital/',
    f'{BASE_URL}/parents-and-children/what-if-child-or-someone-in-home-is-sick/',
    f'{BASE_URL}/parents-and-children/what-if-child-underlying-symptoms-get-worse/',
    f'{BASE_URL}/symptoms-and-testing/are-there-home-tests/',
    f'{BASE_URL}/symptoms-and-testing/if-antibody-tests-not-used-for-diagnosis/',
    f'{BASE_URL}/symptoms-and-testing/when-will-other-tests-be-authorized/',
    f'{BASE_URL}/animals/can-bats-in-us-get-covid19-and-spread-it-to-people/',
    f'{BASE_URL}/animals/can-wild-animals-spread-covid19-to-people-and-pets/',
    f'{BASE_URL}/animals/since-tigers-can-get-infected-should-i-worry-about-my-pet-cat/',
    f'{BASE_URL}/protect-yourself/am-i-at-risk-for-covid-19-from-packages-or-products-shipping-from-china/',
    f'{BASE_URL}/symptoms-and-testing/kind-of-test-used-to-diagnose-covid19/',
    f'{BASE_URL}/water-transmission/can-the-covid-19-virus-spread-through-drinking-water/',
    f'{BASE_URL}/water-transmission/can-the-covid-19-virus-spread-through-pools-and-hot-tubs/',
    f'{BASE_URL}/water-transmission/is-the-covid-19-virus-found-in-feces/',
    f'{BASE_URL}/financial-help/i-am-not-typically-required-to-file-a-tax-return/',
    f'{BASE_URL}/financial-help/i-no-longer-have-a-bank-account-i-used-for-tax-return/',
    f'{BASE_URL}/financial-help/i-recently-filed-what-do-i-need-to-do-to-get-payment/',
    f'{BASE_URL}/financial-help/what-do-i-do-if-i-cant-pay-mortgage/',
    f'{BASE_URL}/financial-help/what-do-i-do-if-i-cant-pay-rent/',
    f'{BASE_URL}/financial-help/what-do-i-do-if-someone-calls-texts-claiming-to-be-irs/',
    f'{BASE_URL}/financial-help/what-does-it-mean-get-my-payment-please-try-again/',
    f'{BASE_URL}/financial-help/do-online-classes-still-qualify-for-gi-bill-benefits/',
    f'{BASE_URL}/funerals/are-department-of-veterans-affairs-national-cemeteries-open/',
    f'{BASE_URL}/protect-yourself/can-i-visit-patient-at-department-of-veterans-affairs-facility/',
    f'{BASE_URL}/animals/are-pets-from-a-shelter-safe/',
    f'{BASE_URL}/basics/what-is-a-novel-coronavirus/',
    f'{BASE_URL}/keeping-home-safe/family-reduce-risk/',
    f'{BASE_URL}/symptoms-and-testing/what-is-antibody-testing/',
    f'{BASE_URL}/travel/is-it-safe-to-travel-to-campgrounds-or-go-camping/',
    f'{BASE_URL}/travel/is-it-safe-to-visit-family-friends/',
    f'{BASE_URL}/travel/should-i-cancel-my-international-travel/',
    f'{BASE_URL}/travel/should-i-travel-within-the-us/',
    f'{BASE_URL}/community-events/is-it-safe-to-vacuum-in-a-school-business-or-community-facility-after-someone-with-covid-19-present/',
    f'{BASE_URL}/community-events/who-should-clean-and-disinfect-community-spaces/',
    f'{BASE_URL}/keeping-home-safe/what-is-the-difference-between-cleaning-and-disinfecting/',
    f'{BASE_URL}/parents-and-children/should-outdoor-playgrounds-be-cleaned-and-disinfected/',
    f'{BASE_URL}/protect-yourself/how-effective-are-alternative-disinfection-methods/',
    f'{BASE_URL}/protect-yourself/is-cleaning-alone-effective-against-the-virus/',
    f'{BASE_URL}/protect-yourself/what-is-routine-cleaning/',
    f'{BASE_URL}/spread/can-sanitizing-tunnels-be-used-to-prevent-spread/',
    f'{BASE_URL}/spread/should-sidewalks-and-roads-be-disinfected-to-prevent-covid-19/',
    f'{BASE_URL}/animals/if-my-pet-had-species-specific-coronavirus-are-they-more-likely-to-get-covid-19/',
    f'{BASE_URL}/financial-help/what-do-i-do-if-a-payment-was-sent-to-someone-who-died/',
    f'{BASE_URL}/funerals/if-someone-dies-overseas/',
    f'{BASE_URL}/medications/does-remdesivir-benefit-patients-with-covid-19/',
    f'{BASE_URL}/travel/when-will-the-borders-reopen/',
    f'{BASE_URL}/financial-help/i-am-a-veteran-do-i-need-to-provide-information-to-irs/',
    f'{BASE_URL}/protect-yourself/how-do-i-prepare-for-hurricane-season-during-covid19/',
    f'{BASE_URL}/protect-yourself/if-i-need-to-evacuate-my-home-during-the-covid19-pandemic/',
    f'{BASE_URL}/support-for-business/how-to-apply-for-a-small-business-loan/',
    f'{BASE_URL}/support-for-business/how-to-apply-for-benefits/',
    f'{BASE_URL}/financial-help/is-the-irs-sending-prepaid-debit-cards/',
    f'{BASE_URL}/travel/can-american-citizen-return-to-us/',
    f'{BASE_URL}/travel/which-airports-have-enhanced-travel-screening/',
    f'{BASE_URL}/travel/which-countries-are-subject-travel-restrictions-us/',
    f'{BASE_URL}/rumors/are-uscis-offices-open/',
    f'{BASE_URL}/travel/what-expect-airport-security-checkpoints/',
    f'{BASE_URL}/pregnancy/i-am-pregnant-what-are-the-risks/',
    f'{BASE_URL}/financial-help/can-snap-participants-order-groceries-online/',
    f'{BASE_URL}/financial-help/if-my-financial-situation-changed-could-i-be-eligible-for-snap/',
    f'{BASE_URL}/financial-help/what-happens-to-snap-recipients-who-cannot-meet-work-requirements-due-to-covid19/',
    f'{BASE_URL}/food-safety/are-meats-compromised-by-covid19/',
    f'{BASE_URL}/food-safety/is-there-guidance-on-food-planning/',
    f'{BASE_URL}/food-safety/where-can-i-find-info-about-nutrition-assistance/',
    f'{BASE_URL}/funerals/can-i-schedule-burial-national-cemetery/',
    f'{BASE_URL}/funerals/can-i-schedule-committal-service-military-funeral-service-honors/',
    f'{BASE_URL}/parents-and-children/can-parents-pick-up-meals-for-their-kids-without-them-present/',
    f'{BASE_URL}/parents-and-children/can-schools-provide-home-delivery-of-meals/',
    f'{BASE_URL}/parents-and-children/can-schools-provide-multiple-meals-at-once/',
    f'{BASE_URL}/parents-and-children/can-schools-serve-meals-while-they-are-closed/',
    f'{BASE_URL}/parents-and-children/do-school-meals-still-have-to-meet-nutrition-requirements/',
    f'{BASE_URL}/parents-and-children/what-action-is-being-taken-to-ensure-children-have-food-while-schools-are-closed/',
    f'{BASE_URL}/protect-yourself/can-the-public-still-visit-national-forest-recreation-sites/',
    f'{BASE_URL}/water-transmission/can-the-covid-19-virus-spread-through-sewerage-systems/',
    f'{BASE_URL}/water-transmission/should-wasterwater-workers-take-extra-precautions-to-protect-from-covid19/',
    f'{BASE_URL}/medications/are-chloroquine-phosphate-hydroxychloroquine-effective/',
    f'{BASE_URL}/medications/should-i-take-aquarium-chloroquine-phosphate/',
    f'{BASE_URL}/rumors/do-i-need-to-register-with-fema-to-be-considered-for-help/',
    f'{BASE_URL}/rumors/fema-and-acquisition-of-ppe/',
    f'{BASE_URL}/rumors/how-is-the-national-guard-responding/',
    f'{BASE_URL}/rumors/is-fema-suspending-rent-for-people-in-certain-states/',
    f'{BASE_URL}/basics/why-is-the-disease-called-covid-19/',
    f'{BASE_URL}/parents-and-children/are-children-at-risk/',
    f'{BASE_URL}/parents-and-children/are-symptoms-of-covid-19-different-in-children/',
    f'{BASE_URL}/parents-and-children/how-can-i-protect-my-child-from-covid-19/',
    f'{BASE_URL}/parents-and-children/how-do-i-prepare-my-child-for-an-outbreak/',
    f'{BASE_URL}/parents-and-children/should-children-wear-face-masks/',
    f'{BASE_URL}/parents-and-children/what-is-multisystem-inflammatory-syndrome-in-children/',
    f'{BASE_URL}/protect-yourself/is-it-safe-to-get-medical-care-for-other-conditions/',
    f'{BASE_URL}/protect-yourself/what-should-i-do-if-i-had-close-contact-with-someone-who-has-covid-19/',
    f'{BASE_URL}/spread/can-the-virus-that-causes-covid-19-be-spread-through-food/',
    f'{BASE_URL}/spread/how-does-the-virus-spread/',
    f'{BASE_URL}/spread/what-is-community-spread/',
    f'{BASE_URL}/symptoms-and-testing/should-i-be-tested-for-covid-19/',
    f'{BASE_URL}/financial-help/what-do-i-do-if-i-lost-my-eip-debit-card/',
    f'{BASE_URL}/financial-help/who-is-eligible-for-payment/',
    f'{BASE_URL}/financial-help/why-am-i-receiving-a-debit-card/',
    f'{BASE_URL}/medications/are-there-any-vaccines-to-prevent-covid-19/',
    f'{BASE_URL}/animals/what-animals-can-get-covid-19/',
    f'{BASE_URL}/basics/how-can-people-help-stop-stigma-related-to-covid-19/',
    f'{BASE_URL}/basics/what-does-the-mortality-rate-mean/',
    f'{BASE_URL}/basics/why-are-the-death-counts-different-from-provisional-counts/',
    f'{BASE_URL}/basics/why-do-some-numbers-differ-from-the-cdc-numbers/',
    f'{BASE_URL}/funerals/how-to-safely-handle-belongings-of-someone-died-from-covid-19/',
    f'{BASE_URL}/funerals/what-are-requirements-to-return-body-to-united-states/',
    f'{BASE_URL}/symptoms-and-testing/what-are-the-symptoms-and-complications-that-covid-19-can-cause/',
    f'{BASE_URL}/keeping-home-safe/how-can-i-prepare-for-an-outbreak/',
    f'{BASE_URL}/keeping-home-safe/if-someone-in-my-house-gets-sick/',
    f'{BASE_URL}/protect-yourself/does-cdc-recommend-facemasks/',
    f'{BASE_URL}/protect-yourself/how-can-i-prepare-for-covid19-at-work/',
    f'{BASE_URL}/protect-yourself/how-long-do-companies-need-to-close-for-disinfection-after-an-exposure/',
    f'{BASE_URL}/parents-and-children/how-can-i-keep-my-children-healthy/',
    f'{BASE_URL}/parents-and-children/how-should-parents-talk-to-children-about-covid19/',
    f'{BASE_URL}/parents-and-children/what-to-do-if-child-has-difficulty-adjusting/',
    f'{BASE_URL}/parents-and-children/while-school-is-out-can-my-child-hang-with-friend/',
    f'{BASE_URL}/parents-and-children/while-school-is-out-how-can-i-help-my-child-continue-learning/',
    f'{BASE_URL}/spread/if-i-have-recovered-will-i-be-immune/',
    f'{BASE_URL}/basics/donations-to-charities/',
    f'{BASE_URL}/basics/how-can-i-manage-anxiety-stress/',
    f'{BASE_URL}/medications/ads-for-covid-treatments-and-cures/',
    f'{BASE_URL}/protect-yourself/how-can-i-protect-myself/',
    f'{BASE_URL}/protect-yourself/i-ordered-facemasks-and-they-did-not-arrive/',
    f'{BASE_URL}/rumors/how-can-i-find-out-about-frauds-and-scams/',
    f'{BASE_URL}/rumors/i-am-getting-calls-from-people-claiming-they-are-from-the-government/',
    f'{BASE_URL}/support-for-business/calls-to-small-businesses-promising-quick-financial-relief/',
    f'{BASE_URL}/financial-help/missed-tax-day/',
    f'{BASE_URL}/pregnancy/can-covid-19-be-passed-from-a-pregnant-woman-to-her-fetus-or-newborn/',
    f'{BASE_URL}/pregnancy/how-can-pregnant-women-protect-themselves-from-getting-covid-19/',
    f'{BASE_URL}/pregnancy/what-is-the-risk-to-pregnant-women-of-getting-covid-19/',
    f'{BASE_URL}/pregnancy/what-should-breastfeeding-mothers-do/',
    # f'{BASE_URL}/all-topics.html',
    # f'{BASE_URL}/api/',
    # f'{BASE_URL}/',
]


@pytest.mark.parametrize('url', URLS)
def test_redirects(url):
    assert '<title>Redirecting&hellip;</title>' in requests.get(url).text
