-
Notifications
You must be signed in to change notification settings - Fork 535
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
GitHub Sponsor path validation & tests #15608
Conversation
you've got some codestyle fails around line length https://travis-ci.org/github/mozilla/addons-server/jobs/731753477#L555 (you can replicate locally with |
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.
This looks great! Outstanding job, @conema! I had one suggestion for a possible improvement, but I'm seeking feedback from the primary server developers on that. Great work so far, and stay tuned!
if not hostname.endswith(amo.VALID_CONTRIBUTION_DOMAINS): | ||
raise forms.ValidationError(ugettext( | ||
'URL domain must be one of [%s], or a subdomain.' | ||
) % ', '.join(amo.VALID_CONTRIBUTION_DOMAINS)) | ||
elif (hostname == 'github.com' and |
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.
I wonder if it's worth making github.com
into a constant, so that it can be used here, in src/olympia/constants/base.py
, and also in the tests, without having to hardcode it multiple times? It would also allow for it to be changed easily if for some reason the GitHub hostname changed.
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.
I don't think it's really worth the effort.
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.
Fair enough. This is good to land, then. Thanks for the patch @conema!
Thanks so much for the patch, @conema! 🙌 Your contribution has been added to our recognition wiki. Welcome onboard -- we look forward to seeing you around the project! 😎 |
Fixes mozilla/addons#7934
The PR implements a special-case path validator for GitHub Sponsor as described by @diox's reply and adds two tests.