From d0f03daf6108b1cc4cb892c7af3bc5fcea35187c Mon Sep 17 00:00:00 2001 From: mprahl Date: Thu, 9 May 2019 13:27:49 -0400 Subject: [PATCH] Raise a ValidationError when buildonly or buildafter are set This can be reverted when #1216 is implemented. --- module_build_service/utils/submit.py | 4 ++++ tests/test_utils/test_utils.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/module_build_service/utils/submit.py b/module_build_service/utils/submit.py index f853ba99..46890067 100644 --- a/module_build_service/utils/submit.py +++ b/module_build_service/utils/submit.py @@ -173,6 +173,10 @@ def format_mmd(mmd, scmurl, module=None, session=None): "Custom component caches aren't allowed. " "%r bears cache %r" % (pkgname, pkg.get_cache()) ) + if pkg.get_buildonly() is True: + raise ValidationError('The usage of "buildonly" is not yet supported') + if pkg.get_buildafter(): + raise ValidationError('The usage of "buildafter" is not yet supported') if not pkg.get_repository(): pkg.set_repository(conf.rpms_default_repository + pkgname) if not pkg.get_cache(): diff --git a/tests/test_utils/test_utils.py b/tests/test_utils/test_utils.py index 9622e919..bcacd341 100644 --- a/tests/test_utils/test_utils.py +++ b/tests/test_utils/test_utils.py @@ -480,8 +480,10 @@ class TestUtils: @pytest.mark.parametrize( "scmurl", [ - "https://src.stg.fedoraproject.org/modules/testmodule.git" - "?#620ec77321b2ea7b0d67d82992dda3e1d67055b4", + ( + "https://src.stg.fedoraproject.org/modules/testmodule.git" + "?#620ec77321b2ea7b0d67d82992dda3e1d67055b4" + ), None, ], ) @@ -489,6 +491,10 @@ class TestUtils: def test_format_mmd(self, mocked_scm, scmurl): mocked_scm.return_value.commit = "620ec77321b2ea7b0d67d82992dda3e1d67055b4" # For all the RPMs in testmodule, get_latest is called + mocked_scm.return_value.get_latest.side_effect = [ + "4ceea43add2366d8b8c5a622a2fb563b625b9abf", + "fbed359411a1baa08d4a88e0d12d426fbf8f602c", + ] hashes_returned = { "master": "fbed359411a1baa08d4a88e0d12d426fbf8f602c", "f28": "4ceea43add2366d8b8c5a622a2fb563b625b9abf",