def test_review_scenario(mock_request, addon_with_files, review_action, addon_status, file_status, review_class, review_type, final_addon_status, final_file_status): # Setup the addon and files. addon = addon_with_files addon.update(status=addon_status) version = addon.versions.get() version.files.filter(status=amo.STATUS_AWAITING_REVIEW).update( status=file_status) # Get the review helper. helper = helpers.ReviewHelper(mock_request, addon, version) assert isinstance(helper.handler, review_class) helper.get_review_type(mock_request) assert helper.handler.review_type == review_type helper.set_data({'comments': 'testing review scenarios'}) # Run the action (process_public, process_sandbox). try: getattr(helper.handler, review_action)() except AssertionError: # Some scenarios are expected to fail. We don't need to check it here, # the scenario has the final statuses, and those are the ones we want # to check. pass # Check the final statuses. assert addon.reload().status == final_addon_status assert list(version.files.values_list('status', flat=True)) == ([ amo.STATUS_BETA, amo.STATUS_DISABLED, final_file_status, final_file_status ])
def test_request_more_information_no_versions(self): assert len(mail.outbox) == 0 assert self.check_log_count(amo.LOG.REQUEST_INFORMATION.id) == 0 self.version.delete() self.helper = helpers.ReviewHelper(request=self.request, addon=self.addon) data = {'comments': 'foo', 'action': 'info', 'operating_systems': 'osx', 'applications': 'Firefox'} self.helper.set_data(data) self.helper.handler.request_information() assert len(mail.outbox) == 1 subject = 'Mozilla Add-ons: Delicious Bookmarks ' assert mail.outbox[0].subject == subject assert self.check_log_count(amo.LOG.REQUEST_INFORMATION.id) == 1
def test_no_version(self): helper = helpers.ReviewHelper(request=self.request, addon=self.addon, version=None) assert helper.handler.review_type == 'pending'
def get_helper(self): return helpers.ReviewHelper(request=self.request, addon=self.addon, version=self.version)
def test_no_version(self): helper = helpers.ReviewHelper(request=self.request, addon=self.addon, version=None) eq_(helper.review_type, 'pending')