Fix KojiModuleBuilder.build return values in tests

This commit is contained in:
Jan Kaluza
2016-11-01 12:05:08 +01:00
parent 737a6f8b19
commit 42138810d5
3 changed files with 5 additions and 2 deletions

View File

@@ -212,6 +212,7 @@ class GenericBuilder(six.with_metaclass(ABCMeta)):
collections).
:param source : an SCM URL, clearly identifying the build artifact in a
repository
:return 4-tuple of the form (build task id, state, reason, nvr)
The artifact_name parameter is used in koji add-pkg (and it's actually
the only reason why we need to pass it). We don't really limit source

View File

@@ -39,6 +39,7 @@ class TestModuleWait(unittest.TestCase):
def test_init_basic(self, pdc, from_module_event, KojiModuleBuilder):
builder = mock.Mock()
builder.get_disttag_srpm.return_value = 'some srpm disttag'
builder.build.return_value = 1234, 1, "", None
KojiModuleBuilder.return_value = builder
mocked_module_build = mock.Mock()
mocked_module_build.json.return_value = {

View File

@@ -70,6 +70,7 @@ class TestRepoDone(unittest.TestCase):
module_build.batch = 1
module_build.component_builds = [unbuilt_component_build, built_component_build]
module_build.current_batch.return_value = [built_component_build]
build_fn.return_value = 1234, 1, "", None
from_repo_done_event.return_value = module_build
@@ -102,7 +103,7 @@ class TestRepoDone(unittest.TestCase):
module_build.batch = 1
module_build.component_builds = [unbuilt_component_build, built_component_build]
module_build.current_batch.return_value = [built_component_build]
build_fn.return_value = None
build_fn.return_value = None, 4, "Failed to submit artifact foo to Koji", None
from_repo_done_event.return_value = module_build
@@ -115,4 +116,4 @@ class TestRepoDone(unittest.TestCase):
module_build.transition.assert_called_once_with(self.config,
module_build_service.models.BUILD_STATES["failed"],
'Failed to submit artifact foo to Koji')
self.assertEquals(unbuilt_component_build.state_reason, "Failed to submit to Koji")
self.assertEquals(unbuilt_component_build.state_reason, "Failed to submit artifact foo to Koji")