[koji-wrapper] Use more descriptive method names

The methods mentioning image build are generic and can work for other
task types.

get_image_build_paths -> get_image_paths
run_create_image_cmd -> run_blocking_cmd

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-01-28 14:58:24 +01:00
parent d85f00818d
commit ae30c07553
6 changed files with 19 additions and 15 deletions

View file

@ -349,12 +349,12 @@ class TestCreateImageBuildThread(unittest.TestCase):
"link_type": 'hardlink-or-copy',
}
koji_wrapper = KojiWrapper.return_value
koji_wrapper.run_create_image_cmd.return_value = {
koji_wrapper.run_blocking_cmd.return_value = {
"retcode": 0,
"output": None,
"task_id": 1234,
}
koji_wrapper.get_image_build_paths.return_value = {
koji_wrapper.get_image_paths.return_value = {
'amd64': [
'/koji/task/1235/tdl-amd64.xml',
'/koji/task/1235/Fedora-Docker-Base-20160103.amd64.qcow2',
@ -468,7 +468,7 @@ class TestCreateImageBuildThread(unittest.TestCase):
"link_type": 'hardlink-or-copy',
}
koji_wrapper = KojiWrapper.return_value
koji_wrapper.run_create_image_cmd.return_value = {
koji_wrapper.run_blocking_cmd.return_value = {
"retcode": 1,
"output": None,
"task_id": 1234,
@ -520,7 +520,7 @@ class TestCreateImageBuildThread(unittest.TestCase):
raise RuntimeError('BOOM')
koji_wrapper = KojiWrapper.return_value
koji_wrapper.run_create_image_cmd.side_effect = boom
koji_wrapper.run_blocking_cmd.side_effect = boom
t = CreateImageBuildThread(pool)
with mock.patch('os.stat') as stat:

View file

@ -75,7 +75,7 @@ class KojiWrapperTest(unittest.TestCase):
mock.call('distro = test-distro\n'),
mock.call('\n')])
def test_get_image_build_paths(self):
def test_get_image_paths(self):
# The data for this tests is obtained from the actual Koji build. It
# includes lots of fields that are not used, but for the sake of
@ -233,7 +233,7 @@ class KojiWrapperTest(unittest.TestCase):
getTaskChildren=mock.Mock(side_effect=lambda task_id, request: getTaskChildren_data.get(task_id)),
getTaskResult=mock.Mock(side_effect=lambda task_id: getTaskResult_data.get(task_id))
)
result = self.koji.get_image_build_paths(12387273)
result = self.koji.get_image_paths(12387273)
self.assertItemsEqual(result.keys(), ['i386', 'x86_64'])
self.maxDiff = None
self.assertItemsEqual(result['i386'],

View file

@ -129,7 +129,7 @@ class TestCreateLiveImageThread(unittest.TestCase):
koji_wrapper = KojiWrapper.return_value
koji_wrapper.get_create_image_cmd.return_value = 'koji spin-livecd ...'
koji_wrapper.run_create_image_cmd.return_value = {
koji_wrapper.run_blocking_cmd.return_value = {
'retcode': 0,
'output': 'some output',
'task_id': 123
@ -140,7 +140,7 @@ class TestCreateLiveImageThread(unittest.TestCase):
with mock.patch('time.sleep'):
t.process((compose, cmd, compose.variants['Client'], 'amd64'), 1)
self.assertEqual(koji_wrapper.run_create_image_cmd.mock_calls,
self.assertEqual(koji_wrapper.run_blocking_cmd.mock_calls,
[mock.call('koji spin-livecd ...', log_file='/a/b/log/log_file')])
self.assertEqual(koji_wrapper.get_image_path.mock_calls, [mock.call(123)])
self.assertEqual(copy2.mock_calls,
@ -178,7 +178,7 @@ class TestCreateLiveImageThread(unittest.TestCase):
koji_wrapper = KojiWrapper.return_value
koji_wrapper.get_create_image_cmd.return_value = 'koji spin-livecd ...'
koji_wrapper.run_create_image_cmd.return_value = {
koji_wrapper.run_blocking_cmd.return_value = {
'retcode': 1,
'output': 'some output',
'task_id': 123