-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add script for validating redirects #6023
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks/works great overall, just a note about making this script more reusable.
default='https://www.consumerfinance.gov', | ||
nargs='?' | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the comment above, let's add arguments for the from and to indexes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent suggestion as always. Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wpears just added a commit that adds optional --from-index
and --to-index
parameters, for review at your convenience.
This new script allows for validation of a set of redirects as defined in a CSV or XLSX file. The first line of the file will be ignored as headers. The "from" and "to" paths must live in the 6th and 7th column of the input file, respectively. To run against www.consumerfinance.gov, using an input XLSX: cfgov/scripts/validate_redirects.py redirects.xlsx To run against localhost, using an input CSV: cfgov/scripts/validate_redirects.py redirects.csv http://localhost:8000 To test, run without one of the redirects and observe that the check fails. Now add the redirect and note that the check passes as long as it redirects to the correct path.
ae88224
to
901771f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇 love it
This new script allows for validation of a set of redirects as defined in a CSV or XLSX file. The first line of the file will be ignored as headers. The "from" and "to" paths default to being read from the 6th and 7th column of the input file, respectively.
To run against www.consumerfinance.gov, using an input XLSX:
To run against localhost, using an input CSV:
To specify alternate CSV columns for the "from" and "to" paths:
How to test this PR
To test, run without one of the redirects and observe that the check fails. Now add the redirect and note that the check passes as long as it redirects to the correct path.
Checklist