mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-14 01:09:52 +08:00
Allow passing in multiple tag names to the validation decorator.
We have problems when we try to wrap one decorator around another. There are ways to do that with the [decorator](https://pypi.python.org/pypi/decorator) module nicely, however.. they are ugly. Take a look at this: https://github.com/micheles/decorator/blob/master/src/decorator.py#L217-L218 And this: https://github.com/micheles/decorator/blob/master/src/decorator.py#L185-L188 The approach in this PR is.. simpler.
This commit is contained in:
@@ -233,3 +233,25 @@ class TestUtils(unittest.TestCase):
|
||||
self.assertEquals(
|
||||
validate_koji_tag_good_tag_value_in_dict_nondefault_key(
|
||||
{'nondefault': 'module-foo'}), True)
|
||||
|
||||
def test_validate_koji_tag_double_trouble_good(self):
|
||||
""" Test that we pass on a list of tags that are good. """
|
||||
|
||||
expected = 'foo'
|
||||
|
||||
@module_build_service.utils.validate_koji_tag(['tag_arg1', 'tag_arg2'])
|
||||
def validate_koji_tag_double_trouble(tag_arg1, tag_arg2):
|
||||
return expected
|
||||
|
||||
actual = validate_koji_tag_double_trouble('module-1', 'module-2')
|
||||
self.assertEquals(actual, expected)
|
||||
|
||||
def test_validate_koji_tag_double_trouble_bad(self):
|
||||
""" Test that we fail on a list of tags that are bad. """
|
||||
|
||||
@module_build_service.utils.validate_koji_tag(['tag_arg1', 'tag_arg2'])
|
||||
def validate_koji_tag_double_trouble(tag_arg1, tag_arg2):
|
||||
pass
|
||||
|
||||
with self.assertRaises(ValidationError):
|
||||
validate_koji_tag_double_trouble('module-1', 'BADNEWS-2')
|
||||
|
||||
Reference in New Issue
Block a user