Skip to content
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

Merged
merged 3 commits into from
Oct 1, 2020
Merged

GitHub Sponsor path validation & tests #15608

merged 3 commits into from
Oct 1, 2020

Conversation

conema
Copy link
Contributor

@conema conema commented Sep 30, 2020

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.

immagine

@eviljeff eviljeff requested review from a team and bobsilverberg and removed request for a team October 1, 2020 08:51
@eviljeff
Copy link
Member

eviljeff commented Oct 1, 2020

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 make lint)

Copy link
Contributor

@bobsilverberg bobsilverberg left a 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
Copy link
Contributor

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.

@eviljeff | @diox WDYT?

Copy link
Member

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.

Copy link
Contributor

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!

@bobsilverberg bobsilverberg merged commit 737c70d into mozilla:master Oct 1, 2020
@caitmuenster
Copy link

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! 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add GitHub Sponsor to contributors domain
5 participants