mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-27 18:31:33 +00:00
Add a verdict field to all policies with the actual verdict
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
552e82c3dc
commit
b34ac3bdd9
@ -99,7 +99,11 @@ class BasePolicy(object):
|
|||||||
def apply_policy(self, general_policy_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse):
|
def apply_policy(self, general_policy_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse):
|
||||||
pinfo = {}
|
pinfo = {}
|
||||||
general_policy_info[self.policy_id] = pinfo
|
general_policy_info[self.policy_id] = pinfo
|
||||||
return self.apply_policy_impl(pinfo, suite, source_name, source_data_tdist, source_data_srcdist, excuse)
|
verdict = self.apply_policy_impl(pinfo, suite, source_name, source_data_tdist, source_data_srcdist, excuse)
|
||||||
|
# The base policy provides this field, so the subclass should leave it blank
|
||||||
|
assert 'verdict' not in pinfo
|
||||||
|
pinfo['verdict'] = verdict.name
|
||||||
|
return verdict
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def apply_policy_impl(self, policy_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse): # pragma: no cover
|
def apply_policy_impl(self, policy_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse): # pragma: no cover
|
||||||
|
@ -54,8 +54,10 @@ def create_policy_objects(source_name, target_version, source_version):
|
|||||||
def apply_policy(policy, expected_verdict, src_name, *, suite='unstable', source_version='1.0', target_version='2.0'):
|
def apply_policy(policy, expected_verdict, src_name, *, suite='unstable', source_version='1.0', target_version='2.0'):
|
||||||
src_t, src_u, excuse, policy_info = create_policy_objects(src_name, source_version, target_version)
|
src_t, src_u, excuse, policy_info = create_policy_objects(src_name, source_version, target_version)
|
||||||
verdict = policy.apply_policy(policy_info, suite, src_name, src_t, src_u, excuse)
|
verdict = policy.apply_policy(policy_info, suite, src_name, src_t, src_u, excuse)
|
||||||
|
pinfo = policy_info[policy.policy_id]
|
||||||
assert verdict == expected_verdict
|
assert verdict == expected_verdict
|
||||||
return policy_info[policy.policy_id]
|
assert pinfo['verdict'] == expected_verdict.name
|
||||||
|
return pinfo
|
||||||
|
|
||||||
|
|
||||||
class TestRCBugsPolicy(unittest.TestCase):
|
class TestRCBugsPolicy(unittest.TestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user