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

Handle new beta versions with signing (bug 1160593) #555

Merged
merged 1 commit into from May 18, 2015
Merged

Handle new beta versions with signing (bug 1160593) #555

merged 1 commit into from May 18, 2015

Conversation

robhudson
Copy link
Member

TODO:

  • Handle toggling of is_beta checkbox.

file_ = File.objects.all().order_by("-created")[0]
assert self.addon.status == amo.STATUS_PUBLIC
assert file_.status == amo.STATUS_BETA
assert mock_sign_file.called
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magopian I'm not sure where this test should go. Under TestAddVersion or TestVersionAddFile? I'll get rid of one of the above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe both? One is a new version with the first file and the other is another file on the same version?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be both

@robhudson
Copy link
Member Author

@magopian I'm struggling with this one. The combination of beta, waffle flags, statuses, etc is making my head spin. I think this might be close but would you mind reviewing and giving me a detailed list of what you think is left? Thanks.

@magopian
Copy link
Contributor

I'm not sure there's already a method to reset the form. And thinking about it, that's not what we want: if we reset the form, and resubmit the same file, it'll be detected as beta again (and the checkbox will be re-checked), so there would be no way to submit a file that shouldn't be beta (as long as it has a version that looks like a beta version).

What we should do instead: if the checkbox is unchecked, remove the message and enable the submit button.

Also, I think the message should be a bit more explicit about the fact that we don't accept beta versions that don't pass the automatic validation, something like:

Your version was detected as beta. It didn't pass automatic validation and thus can't be submitted. If you didn't mean to submit it as beta, please unselect the above checkbox.

@@ -27,7 +27,8 @@ class SigningError(Exception):
def get_endpoint(file_obj):
"""Get the endpoint to sign the file, depending on its review status."""
server = settings.SIGNING_SERVER
if file_obj.version.addon.status != amo.STATUS_PUBLIC:
if (file_obj.status == amo.STATUS_BETA or
file_obj.version.addon.status != amo.STATUS_PUBLIC):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird: the first line is redundant, right? If it's amo.STATUS_BETA it sure isn't amo.STATUS_PUBLIC. I think this change isn't needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One is checking the file status, the other is checking the addon status. If the add-on isn't PUBLIC or the file is BETA, we sign with prelim. Right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are completely right, my bad, and very well thought!

@magopian
Copy link
Contributor

You are indeed nearly done I believe. The only thing missing apart the small nits I added is to have the toggling of the error message and the submit button if the beta checkbox is checked/unchecked.

@robhudson
Copy link
Member Author

@magopian Ok, I've updated this. I may need help deciphering the tests. I still don't see why the status changes from PUBLIC to UNREVIEWED. But the mechanics of the tests should be correct. Mind taking a look?

the flag is enabled."""
self.create_flag('automatic-validation')
version = self.addon.latest_version
version.all_files[0].update(status=amo.STATUS_BETA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes the test to fail on line 2497 because the addon having no reviewed file (only beta files) will have its status reset to "unreviewed".

You're testing that the file you're posting is set as beta and signed, you don't care about the existing files, so you should simply remove this line.

@magopian
Copy link
Contributor

When you rebased on master, it seems that line 1186 slipped through, and should now be removed (this will also fix the test test_no_force_beta_for_unlisted_addons).

With the other comments I posted on the tests, they should pass, and this should be ready to merge!

Thanks!

r+wc

@robhudson robhudson changed the title [WIP] Handle new beta versions with signing (bug 1160593) Handle new beta versions with signing (bug 1160593) May 18, 2015
magopian added a commit that referenced this pull request May 18, 2015
Handle new beta versions with signing (bug 1160593)
@magopian magopian merged commit 1780867 into mozilla:master May 18, 2015
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.

None yet

2 participants