Example #1
0
    def test_autosign_pending_version(self):
        self.addon.update(status=amo.STATUS_NOMINATED)
        latest_version = self.addon.find_latest_version(
            channel=amo.RELEASE_CHANNEL_LISTED)

        file = latest_version.files.all()[0]
        validation = dict(notices=0,
                          errors=0,
                          messages=[],
                          metadata={},
                          warnings=1,
                          passed_auto_validation=1,
                          signing_summary=dict(trivial=0,
                                               low=0,
                                               medium=0,
                                               high=0))
        FileValidation.from_json(file, validation)
        file.update(status=amo.STATUS_AWAITING_REVIEW)

        self.client.post(self.unlist_url)

        self.addon.refresh_from_db()
        file.refresh_from_db()
        assert self.addon.status == amo.STATUS_PUBLIC
        assert file.status == amo.STATUS_PUBLIC
Example #2
0
def handle_file_validation_result(results, file_id, annotate=True):
    """Annotates a set of validation results, unless `annotate is false, and
    saves them to the given File instance."""
    if annotate:
        results = annotate_validation_results(results)

    file_ = File.objects.get(pk=file_id)
    return FileValidation.from_json(file_, results)
Example #3
0
def handle_file_validation_result(results, file_id, annotate=True):
    """Annotates a set of validation results, unless `annotate is false, and
    saves them to the given File instance."""
    if annotate:
        results = annotate_validation_results(results)

    file_ = File.objects.get(pk=file_id)
    return FileValidation.from_json(file_, results)
    def test_autosign_pending_version(self):
        self.addon.update(status=amo.STATUS_NOMINATED)

        file = self.addon.latest_version.files.all()[0]
        validation = dict(notices=0, errors=0, messages=[], metadata={},
                          warnings=1, passed_auto_validation=1,
                          signing_summary=dict(trivial=0, low=0, medium=0,
                                               high=0))
        FileValidation.from_json(file, validation)
        file.update(status=amo.STATUS_UNREVIEWED)

        self.client.post(self.unlist_url)

        self.addon.refresh_from_db()
        file.refresh_from_db()
        assert self.addon.status == amo.STATUS_PUBLIC
        assert file.status == amo.STATUS_PUBLIC
Example #5
0
def handle_file_validation_result(results, file_id, *args):
    """Annotate a set of validation results and save them to the given File
    instance."""

    file_ = File.objects.get(pk=file_id)

    annotations.annotate_webext_incompatibilities(
        results=results, file_=file_, addon=file_.version.addon,
        version_string=file_.version.version, channel=file_.version.channel)

    return FileValidation.from_json(file_, results).pk
Example #6
0
def handle_file_validation_result(results, file_id, *args):
    """Annotate a set of validation results and save them to the given File
    instance."""

    file_ = File.objects.get(pk=file_id)

    annotations.annotate_webext_incompatibilities(
        results=results, file_=file_, addon=file_.version.addon,
        version_string=file_.version.version, channel=file_.version.channel)

    return FileValidation.from_json(file_, results).pk
Example #7
0
def handle_file_validation_result(results, file_id, annotate=True):
    """Annotates a set of validation results, unless `annotate is false, and
    saves them to the given File instance."""
    if annotate:
        results = annotate_validation_results(results)

    file_ = File.objects.get(pk=file_id)

    annotate_webext_incompatibilities(
        results=results, file_=file_, addon=file_.version.addon,
        version_string=file_.version.version)

    return FileValidation.from_json(file_, results)
Example #8
0
def handle_file_validation_result(results, file_id, annotate=True):
    """Annotates a set of validation results, unless `annotate is false, and
    saves them to the given File instance."""
    if annotate:
        results = annotate_validation_results(results)

    file_ = File.objects.get(pk=file_id)

    annotate_webext_incompatibilities(
        results=results, file_=file_, addon=file_.version.addon,
        version_string=file_.version.version)

    return FileValidation.from_json(file_, results)
Example #9
0
def handle_file_validation_result(results, file_id, *args):
    """Annotate a set of validation results and save them to the given File
    instance."""

    file_ = File.objects.get(pk=file_id)
    return FileValidation.from_json(file_, results).pk
Example #10
0
 def test_has_been_validated_returns_true_when_validation_exists(self):
     file = File(validation=FileValidation())
     assert file.has_been_validated
Example #11
0
def handle_file_validation_result(results, file_id, *args):
    """Save a set of validation results to a FileValidation instance
    corresponding to the given file_id."""

    file_ = File.objects.get(pk=file_id)
    return FileValidation.from_json(file_, results).pk