Commit a33bfcf9 authored by Clément Schreiner's avatar Clément Schreiner
Browse files

Update the 'distribution' plugin to the new API.

parent 09a0e00d
......@@ -41,7 +41,17 @@ import logging
import os
from debexpo.lib import constants
from debexpo.plugins import BasePlugin
from debexpo.plugins.api import *
@test_result
class DistributionTest(PluginResult):
is_unreleased = bool_field('unreleased')
def __str__(self):
if is_unreleased:
return 'Package uploaded for the unreleased distribution'
else:
return None
class DistributionPlugin(BasePlugin):
......@@ -50,14 +60,14 @@ class DistributionPlugin(BasePlugin):
Checks whether the package is for the UNRELEASED distribution
"""
data = {
"is-unreleased": False,
}
distribution = self.changes["Distribution"]
if distribution.lower() == "unreleased":
data["is-unreleased"] = True
self.failed("Package uploaded for the unreleased distribution", data, constants.PLUGIN_SEVERITY_ERROR)
self.new_test_result(is_unreleased=True,
severity=constants.PLUGIN_SEVERITY_ERROR)
plugin = DistributionPlugin
models = [
DistributionTest
]
<div class="qa-header">
${o.outcome}
${test_result}
</div>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment